Movatterモバイル変換


[0]ホーム

URL:


client

package
v1.26.5Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License:MITImports:23Imported by:26

Details

Repository

github.com/twilio/twilio-go

Links

Documentation

Overview

Package client provides internal utilities for the twilio-go client library.

Package error provides the interface for Twilio specific errors.

Package mock_client is a generated GoMock package.

Package client provides internal utilities for the twilio-go client library.

Package config for config files.

Index

Constants

View Source
const LibraryVersion = "1.26.5"

LibraryVersion specifies the current version of twilio-go.

Variables

This section is empty.

Functions

funcGetNextadded inv0.13.0

func GetNext(baseUrlstring, response interface{}, getNextPage func(nextPageUristring) (interface{},error)) (interface{},error)

funcReadLimitsadded inv0.13.0

func ReadLimits(pageSize *int, limit *int)int

Takes a limit on the max number of records to read and a max pageSize and calculates the max number of pages to read.

funcUnmarshalFloat32added inv0.25.0

func UnmarshalFloat32(input *interface{}) (*float32,error)

Types

typeBaseClientadded inv0.5.0

type BaseClient interface {AccountSid()stringSetTimeout(timeouttime.Duration)SendRequest(methodstring, rawURLstring, dataurl.Values,headers map[string]interface{}, body ...byte) (*http.Response,error)SetOauth(authOAuth)OAuth()OAuth}

typeClient

type Client struct {*CredentialsHTTPClient *http.ClientUserAgentExtensions []string// contains filtered or unexported fields}

Client encapsulates a standard HTTP backend with authorization.

func (*Client)AccountSidadded inv0.8.0

func (c *Client) AccountSid()string

AccountSid returns the Account SID.

func (*Client)OAuthadded inv1.25.0

func (c *Client) OAuth()OAuth

func (*Client)SendRequest

func (c *Client) SendRequest(methodstring, rawURLstring, dataurl.Values,headers map[string]interface{}, body ...byte) (*http.Response,error)

SendRequest verifies, constructs, and authorizes an HTTP request.

func (*Client)SetAccountSidadded inv0.9.0

func (c *Client) SetAccountSid(sidstring)

SetAccountSid sets the Client's accountSid field

func (*Client)SetOauthadded inv1.25.0

func (c *Client) SetOauth(oauthOAuth)

func (*Client)SetTimeout

func (c *Client) SetTimeout(timeouttime.Duration)

SetTimeout sets the Timeout for HTTP requests.

typeCredentials

type Credentials struct {UsernamestringPasswordstring}

Credentials store user authentication credentials.

funcNewCredentialsadded inv0.8.0

func NewCredentials(usernamestring, passwordstring) *Credentials

typeMockBaseClientadded inv0.14.0

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

MockBaseClient is a mock of BaseClient interface.

funcNewMockBaseClientadded inv0.14.0

func NewMockBaseClient(ctrl *gomock.Controller) *MockBaseClient

NewMockBaseClient creates a new mock instance.

func (*MockBaseClient)AccountSidadded inv0.14.0

func (m *MockBaseClient) AccountSid()string

AccountSid mocks base method.

func (*MockBaseClient)EXPECTadded inv0.14.0

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBaseClient)OAuthadded inv1.26.2

func (m *MockBaseClient) OAuth()OAuth

func (*MockBaseClient)SendRequestadded inv0.14.0

func (m *MockBaseClient) SendRequest(method, rawURLstring, dataurl.Values, headers map[string]interface{}, body ...byte) (*http.Response,error)

SendRequest mocks base method.

func (*MockBaseClient)SetOauthadded inv1.26.2

func (m *MockBaseClient) SetOauth(authOAuth)

Oauth mocks base method.

func (*MockBaseClient)SetTimeoutadded inv0.14.0

func (m *MockBaseClient) SetTimeout(timeouttime.Duration)

SetTimeout mocks base method.

typeMockBaseClientMockRecorderadded inv0.14.0

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

MockBaseClientMockRecorder is the mock recorder for MockBaseClient.

func (*MockBaseClientMockRecorder)AccountSidadded inv0.14.0

func (mr *MockBaseClientMockRecorder) AccountSid() *gomock.Call

AccountSid indicates an expected call of AccountSid.

func (*MockBaseClientMockRecorder)OAuthadded inv1.26.2

OAuth indicates an expected call of OAuth.

func (*MockBaseClientMockRecorder)SendRequestadded inv0.14.0

func (mr *MockBaseClientMockRecorder) SendRequest(method, rawURL, data, headers interface{}, body ...interface{}) *gomock.Call

SendRequest indicates an expected call of SendRequest.

func (*MockBaseClientMockRecorder)SetTimeoutadded inv0.14.0

func (mr *MockBaseClientMockRecorder) SetTimeout(timeout interface{}) *gomock.Call

SetTimeout indicates an expected call of SetTimeout.

typeOAuthadded inv1.25.0

type OAuth interface {GetAccessToken(context.Context) (string,error)}

typeRequestHandleradded inv0.9.0

type RequestHandler struct {ClientBaseClientEdgestringRegionstring}

funcNewRequestHandleradded inv0.9.0

func NewRequestHandler(clientBaseClient) *RequestHandler

func (*RequestHandler)BuildUrladded inv0.9.0

func (c *RequestHandler) BuildUrl(rawURLstring) (string,error)

BuildUrl builds the target host string taking into account region and edge configurations.

func (*RequestHandler)Deleteadded inv0.9.0

func (c *RequestHandler) Delete(pathstring, queryDataurl.Values, headers map[string]interface{}) (*http.Response,error)

func (*RequestHandler)Getadded inv0.9.0

func (c *RequestHandler) Get(pathstring, queryDataurl.Values, headers map[string]interface{}) (*http.Response,error)

func (*RequestHandler)Patchadded inv1.25.0

func (c *RequestHandler) Patch(pathstring, bodyDataurl.Values, headers map[string]interface{}, body ...byte) (*http.Response,error)

func (*RequestHandler)Postadded inv0.9.0

func (c *RequestHandler) Post(pathstring, bodyDataurl.Values, headers map[string]interface{}, body ...byte) (*http.Response,error)

func (*RequestHandler)Putadded inv1.21.0

func (c *RequestHandler) Put(pathstring, bodyDataurl.Values, headers map[string]interface{}, body ...byte) (*http.Response,error)

typeRequestValidatoradded inv0.13.0

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

RequestValidator is used to verify the Twilio Signature included with Twilio requests to webhooks.This ensures the request is actually coming from Twilio and helps with securing your webhooks.

funcNewRequestValidatoradded inv0.13.0

func NewRequestValidator(authTokenstring)RequestValidator

NewRequestValidator returns a new RequestValidator which uses the specified auth token when verifyingTwilio signatures.

func (*RequestValidator)Validateadded inv0.13.0

func (rv *RequestValidator) Validate(urlstring, params map[string]string, expectedSignaturestring)bool

Validate can be used for Twilio Signatures sent with webhooks configured for GET calls. It returns trueif the computed signature matches the expectedSignature. Params are a map of string to string containingall the query params Twilio added to the configured webhook URL.

func (*RequestValidator)ValidateBodyadded inv0.13.0

func (rv *RequestValidator) ValidateBody(urlstring, body []byte, expectedSignaturestring)bool

ValidateBody can be used for Twilio Signatures sent with webhooks configured for POST calls. It returns trueif the computed signature matches the expectedSignature. Body is the HTTP request body from the webhook callas a slice of bytes.

typeTwilioRestErroradded inv0.11.0

type TwilioRestError struct {Codeint                    `json:"code"`Details  map[string]interface{} `json:"details"`Messagestring                 `json:"message"`MoreInfostring                 `json:"more_info"`Statusint                    `json:"status"`}

TwilioRestError provides information about an unsuccessful request.

func (*TwilioRestError)Erroradded inv0.11.0

func (err *TwilioRestError) Error()string

Source Files

View all Source files

Directories

PathSynopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp