openapi

package
v1.23.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 6 Imported by: 1

README

Go API client for openapi

This is the public Twilio REST API.

Overview

This API client was generated by the OpenAPI Generator project from the OpenAPI specs located at twilio/twilio-oai. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • 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

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import "./openapi"

Documentation for API Endpoints

All URIs are relative to https://accounts.twilio.com

Class Method HTTP request Description
AuthTokensPromoteApi UpdateAuthTokenPromotion Post /v1/AuthTokens/Promote
AuthTokensSecondaryApi CreateSecondaryAuthToken Post /v1/AuthTokens/Secondary
AuthTokensSecondaryApi DeleteSecondaryAuthToken Delete /v1/AuthTokens/Secondary
ConsentsBulkApi CreateBulkConsents Post /v1/Consents/Bulk
ContactsBulkApi CreateBulkContacts Post /v1/Contacts/Bulk
CredentialsAWSApi CreateCredentialAws Post /v1/Credentials/AWS
CredentialsAWSApi DeleteCredentialAws Delete /v1/Credentials/AWS/{Sid}
CredentialsAWSApi FetchCredentialAws Get /v1/Credentials/AWS/{Sid}
CredentialsAWSApi ListCredentialAws Get /v1/Credentials/AWS
CredentialsAWSApi UpdateCredentialAws Post /v1/Credentials/AWS/{Sid}
CredentialsPublicKeysApi CreateCredentialPublicKey Post /v1/Credentials/PublicKeys
CredentialsPublicKeysApi DeleteCredentialPublicKey Delete /v1/Credentials/PublicKeys/{Sid}
CredentialsPublicKeysApi FetchCredentialPublicKey Get /v1/Credentials/PublicKeys/{Sid}
CredentialsPublicKeysApi ListCredentialPublicKey Get /v1/Credentials/PublicKeys
CredentialsPublicKeysApi UpdateCredentialPublicKey Post /v1/Credentials/PublicKeys/{Sid}
SafeListNumbersApi CreateSafelist Post /v1/SafeList/Numbers
SafeListNumbersApi DeleteSafelist Delete /v1/SafeList/Numbers
SafeListNumbersApi FetchSafelist Get /v1/SafeList/Numbers

Documentation For Models

Documentation For Authorization

accountSid_authToken

  • Type: HTTP basic authentication

Example

auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
    UserName: "username",
    Password: "password",
})
r, err := client.Service.Operation(auth, args)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.
	AccountSid *string `json:"account_sid,omitempty"`
	// 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.
	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"`
	// The URI for this resource, relative to `https://accounts.twilio.com`
	Url *string `json:"url,omitempty"`
}

AccountsV1AuthTokenPromotion struct for AccountsV1AuthTokenPromotion

type AccountsV1BulkConsents added in v1.23.2

type AccountsV1BulkConsents struct {
	// A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
	Items *interface{} `json:"items,omitempty"`
}

AccountsV1BulkConsents struct for AccountsV1BulkConsents

type AccountsV1BulkContacts added in v1.23.2

type AccountsV1BulkContacts struct {
	// A list of objects where each object represents the result of processing a `correlation_id`. Each object contains the following fields: `correlation_id`, a unique 32-character UUID that maps the response to the original request; `error_code`, an integer where 0 indicates success and any non-zero value represents an error; and `error_messages`, an array of strings describing specific validation errors encountered. If the request is successful, the error_messages array will be empty.
	Items *interface{} `json:"items,omitempty"`
}

AccountsV1BulkContacts struct for AccountsV1BulkContacts

type AccountsV1CredentialAws added in v0.14.0

type AccountsV1CredentialAws struct {
	// 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.
	AccountSid *string `json:"account_sid,omitempty"`
	// 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.
	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.
	DateUpdated *time.Time `json:"date_updated,omitempty"`
	// The URI for this resource, relative to `https://accounts.twilio.com`
	Url *string `json:"url,omitempty"`
}

AccountsV1CredentialAws struct for AccountsV1CredentialAws

type AccountsV1CredentialPublicKey added in v0.14.0

type AccountsV1CredentialPublicKey struct {
	// 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.
	AccountSid *string `json:"account_sid,omitempty"`
	// 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.
	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.
	DateUpdated *time.Time `json:"date_updated,omitempty"`
	// The URI for this resource, relative to `https://accounts.twilio.com`
	Url *string `json:"url,omitempty"`
}

AccountsV1CredentialPublicKey struct for AccountsV1CredentialPublicKey

type AccountsV1Safelist added in v1.15.0

type AccountsV1Safelist struct {
	// The unique string that we created to identify the SafeList resource.
	Sid *string `json:"sid,omitempty"`
	// The phone number in SafeList.
	PhoneNumber *string `json:"phone_number,omitempty"`
}

AccountsV1Safelist struct for AccountsV1Safelist

type 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.
	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.
	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.
	DateUpdated *time.Time `json:"date_updated,omitempty"`
	// 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`
	Url *string `json:"url,omitempty"`
}

AccountsV1SecondaryAuthToken struct for AccountsV1SecondaryAuthToken

type ApiService added in v0.11.0

type ApiService struct {
	// contains filtered or unexported fields
}

func NewApiService added in v0.11.0

func NewApiService(requestHandler *twilio.RequestHandler) *ApiService

func NewApiServiceWithClient added in v0.11.0

func NewApiServiceWithClient(client twilio.BaseClient) *ApiService

func (*ApiService) CreateBulkConsents added in v1.23.2

func (c *ApiService) CreateBulkConsents(params *CreateBulkConsentsParams) (*AccountsV1BulkConsents, error)

func (*ApiService) CreateBulkContacts added in v1.23.2

func (c *ApiService) CreateBulkContacts(params *CreateBulkContactsParams) (*AccountsV1BulkContacts, error)

func (*ApiService) CreateCredentialAws added in v0.11.0

func (c *ApiService) CreateCredentialAws(params *CreateCredentialAwsParams) (*AccountsV1CredentialAws, error)

Create a new AWS Credential

func (*ApiService) CreateCredentialPublicKey added in v0.11.0

func (c *ApiService) CreateCredentialPublicKey(params *CreateCredentialPublicKeyParams) (*AccountsV1CredentialPublicKey, error)

Create a new Public Key Credential

func (*ApiService) CreateSafelist added in v1.15.0

func (c *ApiService) CreateSafelist(params *CreateSafelistParams) (*AccountsV1Safelist, error)

Add a new phone number to SafeList.

func (*ApiService) CreateSecondaryAuthToken added in v0.11.0

func (c *ApiService) CreateSecondaryAuthToken() (*AccountsV1SecondaryAuthToken, error)

Create a new secondary Auth Token

func (*ApiService) DeleteCredentialAws added in v0.11.0

func (c *ApiService) DeleteCredentialAws(Sid string) error

Delete a Credential from your account

func (*ApiService) DeleteCredentialPublicKey added in v0.11.0

func (c *ApiService) DeleteCredentialPublicKey(Sid string) error

Delete a Credential from your account

func (*ApiService) DeleteSafelist added in v1.15.0

func (c *ApiService) DeleteSafelist(params *DeleteSafelistParams) error

Remove a phone number from SafeList.

func (*ApiService) DeleteSecondaryAuthToken added in v0.11.0

func (c *ApiService) DeleteSecondaryAuthToken() error

Delete the secondary Auth Token from your account

func (*ApiService) FetchCredentialAws added in v0.11.0

func (c *ApiService) FetchCredentialAws(Sid string) (*AccountsV1CredentialAws, error)

Fetch the AWS credentials specified by the provided Credential Sid

func (*ApiService) FetchCredentialPublicKey added in v0.11.0

func (c *ApiService) FetchCredentialPublicKey(Sid string) (*AccountsV1CredentialPublicKey, error)

Fetch the public key specified by the provided Credential Sid

func (*ApiService) FetchSafelist added in v1.15.0

func (c *ApiService) FetchSafelist(params *FetchSafelistParams) (*AccountsV1Safelist, error)

Check if a phone number exists in SafeList.

func (*ApiService) ListCredentialAws added in v0.11.0

func (c *ApiService) ListCredentialAws(params *ListCredentialAwsParams) ([]AccountsV1CredentialAws, error)

Lists CredentialAws records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService) ListCredentialPublicKey added in v0.11.0

func (c *ApiService) ListCredentialPublicKey(params *ListCredentialPublicKeyParams) ([]AccountsV1CredentialPublicKey, error)

Lists CredentialPublicKey records from the API as a list. Unlike stream, this operation is eager and loads 'limit' records into memory before returning.

func (*ApiService) PageCredentialAws added in v0.13.0

func (c *ApiService) PageCredentialAws(params *ListCredentialAwsParams, pageToken, pageNumber string) (*ListCredentialAwsResponse, error)

Retrieve a single page of CredentialAws records from the API. Request is executed immediately.

func (*ApiService) PageCredentialPublicKey added in v0.13.0

func (c *ApiService) PageCredentialPublicKey(params *ListCredentialPublicKeyParams, pageToken, pageNumber string) (*ListCredentialPublicKeyResponse, error)

Retrieve a single page of CredentialPublicKey records from the API. Request is executed immediately.

func (*ApiService) StreamCredentialAws added in v0.13.0

func (c *ApiService) StreamCredentialAws(params *ListCredentialAwsParams) (chan AccountsV1CredentialAws, chan error)

Streams CredentialAws records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

func (*ApiService) StreamCredentialPublicKey added in v0.13.0

func (c *ApiService) StreamCredentialPublicKey(params *ListCredentialPublicKeyParams) (chan AccountsV1CredentialPublicKey, chan error)

Streams CredentialPublicKey records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.

func (*ApiService) UpdateAuthTokenPromotion added in v0.11.0

func (c *ApiService) UpdateAuthTokenPromotion() (*AccountsV1AuthTokenPromotion, error)

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 (*ApiService) UpdateCredentialAws added in v0.11.0

func (c *ApiService) UpdateCredentialAws(Sid string, params *UpdateCredentialAwsParams) (*AccountsV1CredentialAws, error)

Modify the properties of a given Account

func (*ApiService) UpdateCredentialPublicKey added in v0.11.0

func (c *ApiService) UpdateCredentialPublicKey(Sid string, params *UpdateCredentialPublicKeyParams) (*AccountsV1CredentialPublicKey, error)

Modify the properties of a given Account

type CreateBulkConsentsParams added in v1.23.2

type CreateBulkConsentsParams struct {
	// This is a list of objects that describes a contact's opt-in status. Each object contains the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID used to uniquely map the request item with the response item; `sender_id`, which can be either a valid messaging service SID or a from phone number; `status`, a string representing the consent status. Can be one of [`opt-in`, `opt-out`]; and `source`, a string indicating the medium through which the consent was collected. Can be one of [`website`, `offline`, `opt-in-message`, `opt-out-message`, `others`].
	Items *[]interface{} `json:"Items,omitempty"`
}

Optional parameters for the method 'CreateBulkConsents'

func (*CreateBulkConsentsParams) SetItems added in v1.23.2

func (params *CreateBulkConsentsParams) SetItems(Items []interface{}) *CreateBulkConsentsParams

type CreateBulkContactsParams added in v1.23.2

type CreateBulkContactsParams struct {
	// A list of objects where each object represents a contact's details. Each object includes the following fields: `contact_id`, which must be a string representing phone number in [E.164 format](https://www.twilio.com/docs/glossary/what-e164); `correlation_id`, a unique 32-character UUID that maps the response to the original request; `country_iso_code`, a string representing the country using the ISO format (e.g., US for the United States); and `zip_code`, a string representing the postal code.
	Items *[]interface{} `json:"Items,omitempty"`
}

Optional parameters for the method 'CreateBulkContacts'

func (*CreateBulkContactsParams) SetItems added in v1.23.2

func (params *CreateBulkContactsParams) SetItems(Items []interface{}) *CreateBulkContactsParams

type CreateCredentialAwsParams

type CreateCredentialAwsParams struct {
	// A string that contains the AWS access credentials in the format `<AWS_ACCESS_KEY_ID>:<AWS_SECRET_ACCESS_KEY>`. 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"`
}

Optional parameters for the method 'CreateCredentialAws'

func (*CreateCredentialAwsParams) SetAccountSid

func (params *CreateCredentialAwsParams) SetAccountSid(AccountSid string) *CreateCredentialAwsParams

func (*CreateCredentialAwsParams) SetCredentials

func (params *CreateCredentialAwsParams) SetCredentials(Credentials string) *CreateCredentialAwsParams

func (*CreateCredentialAwsParams) SetFriendlyName

func (params *CreateCredentialAwsParams) SetFriendlyName(FriendlyName string) *CreateCredentialAwsParams

type CreateCredentialPublicKeyParams

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"`
}

Optional parameters for the method 'CreateCredentialPublicKey'

func (*CreateCredentialPublicKeyParams) SetAccountSid

func (params *CreateCredentialPublicKeyParams) SetAccountSid(AccountSid string) *CreateCredentialPublicKeyParams

func (*CreateCredentialPublicKeyParams) SetFriendlyName

func (params *CreateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) *CreateCredentialPublicKeyParams

func (*CreateCredentialPublicKeyParams) SetPublicKey

type CreateSafelistParams added in v1.15.0

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"`
}

Optional parameters for the method 'CreateSafelist'

func (*CreateSafelistParams) SetPhoneNumber added in v1.15.0

func (params *CreateSafelistParams) SetPhoneNumber(PhoneNumber string) *CreateSafelistParams

type DeleteSafelistParams added in v1.15.0

type DeleteSafelistParams struct {
	// The phone number to be removed from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
	PhoneNumber *string `json:"PhoneNumber,omitempty"`
}

Optional parameters for the method 'DeleteSafelist'

func (*DeleteSafelistParams) SetPhoneNumber added in v1.15.0

func (params *DeleteSafelistParams) SetPhoneNumber(PhoneNumber string) *DeleteSafelistParams

type FetchSafelistParams added in v1.15.0

type FetchSafelistParams struct {
	// The phone number to be fetched from SafeList. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164).
	PhoneNumber *string `json:"PhoneNumber,omitempty"`
}

Optional parameters for the method 'FetchSafelist'

func (*FetchSafelistParams) SetPhoneNumber added in v1.15.0

func (params *FetchSafelistParams) SetPhoneNumber(PhoneNumber string) *FetchSafelistParams

type ListCredentialAwsParams

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"`
}

Optional parameters for the method 'ListCredentialAws'

func (*ListCredentialAwsParams) SetLimit added in v0.13.0

func (params *ListCredentialAwsParams) SetLimit(Limit int) *ListCredentialAwsParams

func (*ListCredentialAwsParams) SetPageSize

func (params *ListCredentialAwsParams) SetPageSize(PageSize int) *ListCredentialAwsParams

type ListCredentialAwsResponse

type ListCredentialAwsResponse struct {
	Credentials []AccountsV1CredentialAws     `json:"credentials,omitempty"`
	Meta        ListCredentialAwsResponseMeta `json:"meta,omitempty"`
}

ListCredentialAwsResponse struct for ListCredentialAwsResponse

type ListCredentialAwsResponseMeta

type ListCredentialAwsResponseMeta struct {
	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"`
}

ListCredentialAwsResponseMeta struct for ListCredentialAwsResponseMeta

type ListCredentialPublicKeyParams

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"`
}

Optional parameters for the method 'ListCredentialPublicKey'

func (*ListCredentialPublicKeyParams) SetLimit added in v0.13.0

func (*ListCredentialPublicKeyParams) SetPageSize

func (params *ListCredentialPublicKeyParams) SetPageSize(PageSize int) *ListCredentialPublicKeyParams

type ListCredentialPublicKeyResponse

type ListCredentialPublicKeyResponse struct {
	Credentials []AccountsV1CredentialPublicKey `json:"credentials,omitempty"`
	Meta        ListCredentialAwsResponseMeta   `json:"meta,omitempty"`
}

ListCredentialPublicKeyResponse struct for ListCredentialPublicKeyResponse

type UpdateCredentialAwsParams

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"`
}

Optional parameters for the method 'UpdateCredentialAws'

func (*UpdateCredentialAwsParams) SetFriendlyName

func (params *UpdateCredentialAwsParams) SetFriendlyName(FriendlyName string) *UpdateCredentialAwsParams

type UpdateCredentialPublicKeyParams

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"`
}

Optional parameters for the method 'UpdateCredentialPublicKey'

func (*UpdateCredentialPublicKeyParams) SetFriendlyName

func (params *UpdateCredentialPublicKeyParams) SetFriendlyName(FriendlyName string) *UpdateCredentialPublicKeyParams

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL