openapi

package
v1.28.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 5 Imported by: 0

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://messaging.twilio.com

Class Method HTTP request Description
ChannelsSendersApi CreateChannelsSender Post /v2/Channels/Senders Create a Sender
ChannelsSendersApi DeleteChannelsSender Delete /v2/Channels/Senders/{Sid} Delete a Sender
ChannelsSendersApi FetchChannelsSender Get /v2/Channels/Senders/{Sid} Retrieve a Sender
ChannelsSendersApi ListChannelsSender Get /v2/Channels/Senders Retrieve a list of Senders
ChannelsSendersApi UpdateChannelsSender Post /v2/Channels/Senders/{Sid} Update a sender's information, including `profile`, `webhook`, and `configuration`.
IndicatorsTypingApi CreateTypingIndicator Post /v2/Indicators/Typing.json Send a typing indicator

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 ApiService

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

func NewApiService

func NewApiService(requestHandler *twilio.RequestHandler) *ApiService

func NewApiServiceWithClient

func NewApiServiceWithClient(client twilio.BaseClient) *ApiService

func (*ApiService) CreateChannelsSender

Create a Sender.

func (*ApiService) CreateTypingIndicator added in v1.28.2

func (c *ApiService) CreateTypingIndicator(params *CreateTypingIndicatorParams) (*CreateTypingIndicatorResponse, error)

Send a typing indicator to notify the recipient that you are composing a message. Currently supported for whatsapp channel only. For WhatsApp, `messageId` is required.

func (*ApiService) DeleteChannelsSender

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

(WhatsApp only) Delete a Sender.

func (*ApiService) FetchChannelsSender

func (c *ApiService) FetchChannelsSender(Sid string) (*MessagingV2ChannelsSenderResponse, error)

Retrieve a Sender.

func (*ApiService) ListChannelsSender

func (c *ApiService) ListChannelsSender(params *ListChannelsSenderParams) ([]MessagingV2ChannelsSenderResponse, error)

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

func (*ApiService) PageChannelsSender

func (c *ApiService) PageChannelsSender(params *ListChannelsSenderParams, pageToken, pageNumber string) (*ListChannelsSenderResponse, error)

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

func (*ApiService) RequestHandler

func (c *ApiService) RequestHandler() *twilio.RequestHandler

func (*ApiService) StreamChannelsSender

func (c *ApiService) StreamChannelsSender(params *ListChannelsSenderParams) (chan MessagingV2ChannelsSenderResponse, chan error)

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

func (*ApiService) UpdateChannelsSender

func (c *ApiService) UpdateChannelsSender(Sid string, params *UpdateChannelsSenderParams) (*MessagingV2ChannelsSenderResponse, error)

(WhatsApp only) Update a Sender. You can update a sender's information, including `profile`, `webhook`, and `configuration`. To verify a phone number, set `configuration.verification_code` to the One-time Password (OTP) that you received.

type CreateChannelsSenderParams

type CreateChannelsSenderParams struct {
	//
	MessagingV2Create *MessagingV2Create `json:"MessagingV2Create,omitempty"`
}

Optional parameters for the method 'CreateChannelsSender'

func (*CreateChannelsSenderParams) SetMessagingV2Create

func (params *CreateChannelsSenderParams) SetMessagingV2Create(MessagingV2Create MessagingV2Create) *CreateChannelsSenderParams

type CreateTypingIndicatorParams added in v1.28.2

type CreateTypingIndicatorParams struct {
	// Shared channel identifier
	Channel *string `json:"channel,omitempty"`
	// Message SID that identifies the conversation thread for the typing indicator. Must be a valid Twilio Message SID (SM*) or Media SID (MM*) from an existing WhatsApp conversation.
	MessageId *string `json:"messageId,omitempty"`
}

Optional parameters for the method 'CreateTypingIndicator'

func (*CreateTypingIndicatorParams) SetChannel added in v1.28.2

func (params *CreateTypingIndicatorParams) SetChannel(Channel string) *CreateTypingIndicatorParams

func (*CreateTypingIndicatorParams) SetMessageId added in v1.28.2

func (params *CreateTypingIndicatorParams) SetMessageId(MessageId string) *CreateTypingIndicatorParams

type CreateTypingIndicatorResponse added in v1.28.2

type CreateTypingIndicatorResponse struct {
	// Indicates if the typing indicator was sent successfully.
	Success bool `json:"success,omitempty"`
}

CreateTypingIndicatorResponse struct for CreateTypingIndicatorResponse

type ListChannelsSenderParams

type ListChannelsSenderParams struct {
	//
	Channel *string `json:"Channel,omitempty"`
	// The number of items to return per page.
	PageSize *int `json:"PageSize,omitempty"`
	// Max number of records to return.
	Limit *int `json:"limit,omitempty"`
}

Optional parameters for the method 'ListChannelsSender'

func (*ListChannelsSenderParams) SetChannel

func (params *ListChannelsSenderParams) SetChannel(Channel string) *ListChannelsSenderParams

func (*ListChannelsSenderParams) SetLimit

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

func (*ListChannelsSenderParams) SetPageSize

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

type ListChannelsSenderResponse

type ListChannelsSenderResponse struct {
	Senders []MessagingV2ChannelsSenderResponse `json:"senders,omitempty"`
	Meta    ListChannelsSenderResponseMeta      `json:"meta,omitempty"`
}

ListChannelsSenderResponse struct for ListChannelsSenderResponse

type ListChannelsSenderResponseMeta

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

ListChannelsSenderResponseMeta struct for ListChannelsSenderResponseMeta

type MessagingV2ChannelsSenderProfileGenericResponseEmails added in v1.27.1

type MessagingV2ChannelsSenderProfileGenericResponseEmails struct {
	Email string `json:"email,omitempty"`
	Label string `json:"label,omitempty"`
}

MessagingV2ChannelsSenderProfileGenericResponseEmails struct for MessagingV2ChannelsSenderProfileGenericResponseEmails

type MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers added in v1.27.1

type MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers struct {
	PhoneNumber string `json:"phone_number,omitempty"`
	Label       string `json:"label,omitempty"`
}

MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers struct for MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers

type MessagingV2ChannelsSenderProfileGenericResponseWebsites added in v1.27.1

type MessagingV2ChannelsSenderProfileGenericResponseWebsites struct {
	Website string `json:"website,omitempty"`
	Label   string `json:"label,omitempty"`
}

MessagingV2ChannelsSenderProfileGenericResponseWebsites struct for MessagingV2ChannelsSenderProfileGenericResponseWebsites

type MessagingV2ChannelsSenderResponse added in v1.27.1

type MessagingV2ChannelsSenderResponse struct {
	// The SID of the sender.
	Sid    *string `json:"sid,omitempty"`
	Status *string `json:"status,omitempty"`
	// The ID of the sender in `whatsapp:<E.164_PHONE_NUMBER>` format.
	SenderId      *string                            `json:"sender_id,omitempty"`
	Configuration *MessagingV2Configuration          `json:"configuration,omitempty"`
	Webhook       *MessagingV2Webhook                `json:"webhook,omitempty"`
	Profile       *MessagingV2ProfileGenericResponse `json:"profile,omitempty"`
	Properties    *MessagingV2Properties             `json:"properties,omitempty"`
	// The reasons why the sender is offline.
	OfflineReasons *[]MessagingV2Items               `json:"offline_reasons,omitempty"`
	Compliance     *MessagingV2RcsComplianceResponse `json:"compliance,omitempty"`
	// The URL of the resource.
	Url *string `json:"url,omitempty"`
}

MessagingV2ChannelsSenderResponse struct for MessagingV2ChannelsSenderResponse

type MessagingV2Configuration

type MessagingV2Configuration struct {
	// The ID of the WhatsApp Business Account (WABA) to use for this sender.
	WabaId *string `json:"waba_id,omitempty"`
	// The verification method.
	VerificationMethod *string `json:"verification_method,omitempty"`
	// The verification code.
	VerificationCode *string `json:"verification_code,omitempty"`
	// The SID of the Twilio Voice application.
	VoiceApplicationSid *string `json:"voice_application_sid,omitempty"`
}

MessagingV2Configuration The configuration settings for creating a sender.

type MessagingV2Create

type MessagingV2Create struct {
	// The ID of the sender in `whatsapp:<E.164_PHONE_NUMBER>` format.
	SenderId      *string                   `json:"sender_id"`
	Configuration *MessagingV2Configuration `json:"configuration,omitempty"`
	Webhook       *MessagingV2Webhook       `json:"webhook,omitempty"`
	Profile       *MessagingV2Profile       `json:"profile,omitempty"`
}

MessagingV2Create struct for MessagingV2Create

type MessagingV2Items

type MessagingV2Items struct {
	// The error code.
	Code *string `json:"code,omitempty"`
	// The error message.
	Message *string `json:"message,omitempty"`
	// The URL to get more information about the error.
	MoreInfo *string `json:"more_info,omitempty"`
}

MessagingV2Items struct for MessagingV2Items

type MessagingV2Profile

type MessagingV2Profile struct {
	// The name of the sender. Required for WhatsApp senders and must follow [Meta's display name guidelines](https://www.facebook.com/business/help/757569725593362).
	Name *string `json:"name,omitempty"`
	// The profile about text for the sender.
	About *string `json:"about,omitempty"`
	// The address of the sender.
	Address *string `json:"address,omitempty"`
	// The description of the sender.
	Description *string `json:"description,omitempty"`
	// The logo URL of the sender.
	LogoUrl *string `json:"logo_url,omitempty"`
	// The banner URL of the sender.
	BannerUrl *string `json:"banner_url,omitempty"`
	// The privacy URL of the sender. Must be a publicly accessible HTTP or HTTPS URI associated with the sender.
	PrivacyUrl *string `json:"privacy_url,omitempty"`
	// The terms of service URL of the sender.
	TermsOfServiceUrl *string `json:"terms_of_service_url,omitempty"`
	// The color theme of the sender. Must be in hex format and have at least a 4:5:1 contrast ratio against white.
	AccentColor *string `json:"accent_color,omitempty"`
	// The vertical of the sender. Allowed values are: - `Automotive` - `Beauty, Spa and Salon` - `Clothing and Apparel` - `Education` - `Entertainment` - `Event Planning and Service` - `Finance and Banking` - `Food and Grocery` - `Public Service` - `Hotel and Lodging` - `Medical and Health` - `Non-profit` - `Professional Services` - `Shopping and Retail` - `Travel and Transportation` - `Restaurant` - `Other`
	Vertical *string `json:"vertical,omitempty"`
	// The websites of the sender.
	Websites *interface{} `json:"websites,omitempty"`
	// The emails of the sender.
	Emails *interface{} `json:"emails,omitempty"`
	// The phone numbers of the sender.
	PhoneNumbers *interface{} `json:"phone_numbers,omitempty"`
}

MessagingV2Profile The profile information for the sender.

type MessagingV2ProfileGenericResponse added in v1.27.1

type MessagingV2ProfileGenericResponse struct {
	// The name of the sender.
	Name *string `json:"name,omitempty"`
	// The profile about text for the sender.
	About *string `json:"about,omitempty"`
	// The address of the sender.
	Address *string `json:"address,omitempty"`
	// The description of the sender.
	Description *string `json:"description,omitempty"`
	// The logo URL of the sender.
	LogoUrl *string `json:"logo_url,omitempty"`
	// The banner URL of the sender.
	BannerUrl *string `json:"banner_url,omitempty"`
	// The privacy URL of the sender. Must be a publicly accessible HTTP or HTTPS URI associated with the sender.
	PrivacyUrl *string `json:"privacy_url,omitempty"`
	// The terms of service URL of the sender.
	TermsOfServiceUrl *string `json:"terms_of_service_url,omitempty"`
	// The color theme of the sender. Must be in hex format and have at least a 4:5:1 contrast ratio against white.
	AccentColor *string `json:"accent_color,omitempty"`
	// The vertical of the sender. Allowed values are: - `Automotive` - `Beauty, Spa and Salon` - `Clothing and Apparel` - `Education` - `Entertainment` - `Event Planning and Service` - `Finance and Banking` - `Food and Grocery` - `Public Service` - `Hotel and Lodging` - `Medical and Health` - `Non-profit` - `Professional Services` - `Shopping and Retail` - `Travel and Transportation` - `Restaurant` - `Other`
	Vertical *string `json:"vertical,omitempty"`
	// The websites of the sender.
	Websites *[]MessagingV2ChannelsSenderProfileGenericResponseWebsites `json:"websites,omitempty"`
	// The emails of the sender.
	Emails *[]MessagingV2ChannelsSenderProfileGenericResponseEmails `json:"emails,omitempty"`
	// The phone numbers of the sender.
	PhoneNumbers *[]MessagingV2ChannelsSenderProfileGenericResponsePhoneNumbers `json:"phone_numbers,omitempty"`
}

MessagingV2ProfileGenericResponse The profile information for the sender.

type MessagingV2Properties

type MessagingV2Properties struct {
	// The quality rating of the sender.
	QualityRating *string `json:"quality_rating,omitempty"`
	// The messaging limit of the sender.
	MessagingLimit *string `json:"messaging_limit,omitempty"`
}

MessagingV2Properties The additional properties for the sender.

type MessagingV2RcsCarrier added in v1.27.1

type MessagingV2RcsCarrier struct {
	// The name of the carrier. For example, `Verizon` or `AT&T` for US.
	Name   string                      `json:"name,omitempty"`
	Status MessagingV2RcsCarrierStatus `json:"status,omitempty"`
}

MessagingV2RcsCarrier struct for MessagingV2RcsCarrier

type MessagingV2RcsCarrierStatus added in v1.27.1

type MessagingV2RcsCarrierStatus string

MessagingV2RcsCarrierStatus The carrier-level status.

const (
	MESSAGINGV2RCSCARRIERSTATUS_UNKNOWN        MessagingV2RcsCarrierStatus = "UNKNOWN"
	MESSAGINGV2RCSCARRIERSTATUS_UNLAUNCHED     MessagingV2RcsCarrierStatus = "UNLAUNCHED"
	MESSAGINGV2RCSCARRIERSTATUS_CARRIER_REVIEW MessagingV2RcsCarrierStatus = "CARRIER_REVIEW"
	MESSAGINGV2RCSCARRIERSTATUS_APPROVED       MessagingV2RcsCarrierStatus = "APPROVED"
	MESSAGINGV2RCSCARRIERSTATUS_REJECTED       MessagingV2RcsCarrierStatus = "REJECTED"
	MESSAGINGV2RCSCARRIERSTATUS_SUSPENDED      MessagingV2RcsCarrierStatus = "SUSPENDED"
)

List of messaging.v2.rcs_carrier_status

type MessagingV2RcsComplianceCountryResponse added in v1.27.1

type MessagingV2RcsComplianceCountryResponse struct {
	// The ISO 3166-1 alpha-2 country code.
	Country string `json:"country"`
	// The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden in the `countries` array.
	RegistrationSid string                      `json:"registration_sid"`
	Status          MessagingV2RcsCountryStatus `json:"status"`
	Carriers        []MessagingV2RcsCarrier     `json:"carriers,omitempty"`
}

MessagingV2RcsComplianceCountryResponse struct for MessagingV2RcsComplianceCountryResponse

type MessagingV2RcsComplianceCountryUpdatePatchResponse added in v1.27.2

type MessagingV2RcsComplianceCountryUpdatePatchResponse struct {
	// The ISO 3166-1 alpha-2 country code.
	Country string `json:"country"`
	// The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden in the `countries` array.
	RegistrationSid string                      `json:"registration_sid"`
	Status          MessagingV2RcsCountryStatus `json:"status"`
}

MessagingV2RcsComplianceCountryUpdatePatchResponse struct for MessagingV2RcsComplianceCountryUpdatePatchResponse

type MessagingV2RcsCompliancePatchUpdateResponse added in v1.27.2

type MessagingV2RcsCompliancePatchUpdateResponse struct {
	// The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden within the `countries` array.
	RegistrationSid string `json:"registration_sid"`
	// A list of country-specific compliance details.
	Countries []MessagingV2RcsComplianceCountryUpdatePatchResponse `json:"countries"`
}

MessagingV2RcsCompliancePatchUpdateResponse The KYC compliance information. This section consists of response to the request launch.

type MessagingV2RcsComplianceResponse added in v1.27.1

type MessagingV2RcsComplianceResponse struct {
	// The default compliance registration SID (e.g., from CR-Google) that applies to all countries unless overridden in the `countries` array.
	RegistrationSid string `json:"registration_sid"`
	// A list of country-specific compliance details.
	Countries []MessagingV2RcsComplianceCountryResponse `json:"countries"`
}

MessagingV2RcsComplianceResponse The KYC compliance information. This section consists of response to the request launch.

type MessagingV2RcsCountryStatus added in v1.27.1

type MessagingV2RcsCountryStatus string

MessagingV2RcsCountryStatus The country-level status. Based on the aggregation of the carrier-level status.

const (
	MESSAGINGV2RCSCOUNTRYSTATUS_ONLINE               MessagingV2RcsCountryStatus = "ONLINE"
	MESSAGINGV2RCSCOUNTRYSTATUS_OFFLINE              MessagingV2RcsCountryStatus = "OFFLINE"
	MESSAGINGV2RCSCOUNTRYSTATUS_TWILIO_REVIEW        MessagingV2RcsCountryStatus = "TWILIO_REVIEW"
	MESSAGINGV2RCSCOUNTRYSTATUS_PENDING_VERIFICATION MessagingV2RcsCountryStatus = "PENDING_VERIFICATION"
)

List of messaging.v2.rcs_country_status

type MessagingV2Update

type MessagingV2Update struct {
	Configuration *MessagingV2Configuration `json:"configuration,omitempty"`
	Webhook       *MessagingV2Webhook       `json:"webhook,omitempty"`
	Profile       *MessagingV2Profile       `json:"profile,omitempty"`
}

MessagingV2Update struct for MessagingV2Update

type MessagingV2Webhook

type MessagingV2Webhook struct {
	// The URL to send the webhook to.
	CallbackUrl *string `json:"callback_url,omitempty"`
	// The HTTP method for the webhook.
	CallbackMethod *string `json:"callback_method,omitempty"`
	// The URL to send the fallback webhook to.
	FallbackUrl *string `json:"fallback_url,omitempty"`
	// The HTTP method for the fallback webhook.
	FallbackMethod *string `json:"fallback_method,omitempty"`
	// The URL to send the status callback to.
	StatusCallbackUrl *string `json:"status_callback_url,omitempty"`
	// The HTTP method for the status callback.
	StatusCallbackMethod *string `json:"status_callback_method,omitempty"`
}

MessagingV2Webhook The configuration settings for webhooks.

type UpdateChannelsSenderParams

type UpdateChannelsSenderParams struct {
	//
	MessagingV2Update *MessagingV2Update `json:"MessagingV2Update,omitempty"`
}

Optional parameters for the method 'UpdateChannelsSender'

func (*UpdateChannelsSenderParams) SetMessagingV2Update

func (params *UpdateChannelsSenderParams) SetMessagingV2Update(MessagingV2Update MessagingV2Update) *UpdateChannelsSenderParams

Jump to

Keyboard shortcuts

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