nexmo

package module
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 9 Imported by: 0

README

Nexmo Client Library For Go

Go Report Card Build Status Coverage

This library is moving towards a full client implementation of the Nexmo APIs. The library is supported by Nexmo.

The library currently has good coverage for the following APIs:

API Coverage
Voice (9/9)
SMS (1/4)
Insight (3/4)
Verify (4/4)
Application (5/5)

It currently has only a handful of Developer (5/15) endpoints implemented, and no webhook support.

Current API Coverage can be found in this spreadsheet

Installation

To install the package, use go get:

go get github.com/fabriziomanunta/nexmo-go

Or import the package into your project and then do go get ..

Usage

Usage looks a bit like this:

package main

import (
	"fmt"
	"net/http"

	"log"

	"github.com/fabriziomanunta/nexmo-go"
)

func main() {
	auth := nexmo.NewAuthSet()
	auth.SetAPISecret(API_KEY, API_SECRET)
	client := nexmo.NewClient(http.DefaultClient, auth)
	insight, _, err := client.Insight.GetBasicInsight(nexmo.BasicInsightRequest{
		Number: PHONE_NUMBER,
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Country Name:", insight.CountryName)
	fmt.Println("Local Formatting:", insight.NationalFormatNumber)
	fmt.Println("International Formatting:", insight.InternationalFormatNumber)
}

More documentation will be coming as the API stabilises! Things are still in flux.

To Do

Lots has been done, but there's still lots left to do! If you'd like to help, please get in touch first! Progress is moving swiftly and I wouldn't want to waste your time!

Testing

There isn't any testing yet! A test harness is currently in the works, to allow some quality tests to be written. Every API call has been tested manually during development, so they do work, but there's more work to be done.

Error Handling

Error responses from Nexmo APIs are not currently dealt with very gracefully. Fortunately, much of the work can be done in one place (inside the custom fork of Sling - which is why I forked it). This comes directly after testing, so I can ensure that all the different error responses in different parts of the API are dealt with properly.

Remaining Endpoints

Coverage is actually really high. 90% of Voice, SMS, Insight, Verify & Application APIs are covered, with some of the Developer API as well.

Webhook Support

Support for webhook parsing and validation. Made easier because Golang has a widely-used request/response API!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status       int64
	ErrorMessage string
}

func (APIError) Error

func (a APIError) Error() string

type AdvancedInsightRequest

type AdvancedInsightRequest struct {
	Credentials
	Number  string `json:"number,omitempty"`
	Country string `json:"country,omitempty"`
	CNAM    bool   `json:"cnam,omitempty"`
	IP      string `json:"ip,omitempty"`
}

type AdvancedInsightResponse

type AdvancedInsightResponse struct {
	StandardInsightResponse
	ValidNumber string `json:"valid_number"`
	Reachable   string `json:"reachable"`
	Ported      string `json:"ported"`
	Roaming     struct {
		Status             string `json:"status"`
		RoamingCountryCode string `json:"roaming_country_code"`
		RoamingNetworkCode string `json:"roaming_network_code"`
		RoamingNetworkName string `json:"roaming_network_name"`
	} `json:"roaming"`
	LookupOutcome        int    `json:"lookup_outcome"`
	LookupOutcomeMessage string `json:"lookup_outcome_message"`
	IP                   string `json:"ip"`
	IPWarnings           string `json:"ip_warnings"`
	IPMatchLevel         string `json:"ip_match_level"`
	IPCountry            string `json:"ip_country"`
}

type ApplicationConfiguration

type ApplicationConfiguration struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Voice struct {
		Webhooks []struct {
			EndpointType string `json:"endpoint_type"`
			Endpoint     string `json:"endpoint"`
			HTTPMethod   string `json:"http_method"`
		} `json:"webhooks"`
	}
	Keys struct {
		PublicKey  string `json:"public_key"`
		PrivateKey string `json:"private_key"`
	} `json:"keys"`
	Links Links `json:"_links"`
}

type ApplicationService

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

func (*ApplicationService) CreateApplication

func (*ApplicationService) DeleteApplication

func (s *ApplicationService) DeleteApplication(id string) (*http.Response, error)

func (*ApplicationService) GetApplication

func (s *ApplicationService) GetApplication(id string) (*GetApplicationResponse, *http.Response, error)

func (*ApplicationService) ListApplications

func (*ApplicationService) ModifyApplication

func (*ApplicationService) SetBaseURL

func (c *ApplicationService) SetBaseURL(baseURL string)

type AuthSet

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

func NewAuthSet

func NewAuthSet() *AuthSet

func (*AuthSet) ApplyAPICredentials

func (a *AuthSet) ApplyAPICredentials(request apiSecretRequest)

func (*AuthSet) ApplyJWT

func (a *AuthSet) ApplyJWT(sling *sling.Sling) error

func (*AuthSet) GenerateToken

func (a *AuthSet) GenerateToken() (string, error)

func (*AuthSet) SetAPISecret

func (a *AuthSet) SetAPISecret(apiKey, apiSecret string)

func (*AuthSet) SetApplicationAuth

func (a *AuthSet) SetApplicationAuth(appID string, key []byte) error

type AuthType

type AuthType uint8
const (
	ApiSecretAuth AuthType = iota + 1
	ApiSecretPathAuth
	JwtAuth
)

type BasicInsightRequest

type BasicInsightRequest struct {
	Credentials
	Number  string `json:"number,omitempty"`
	Country string `json:"country,omitempty"`
}

type BasicInsightResponse

type BasicInsightResponse struct {
	Status                    int64  `json:"status,omitempty"`
	StatusMessage             string `json:"status_message,omitempty"`
	ErrorText                 string `json:"error_text,omitempty"`
	RequestID                 string `json:"request_id,omitempty"`
	InternationalFormatNumber string `json:"international_format_number,omitempty"`
	NationalFormatNumber      string `json:"national_format_number,omitempty"`
	CountryCode               string `json:"country_code,omitempty"`
	CountryCodeIso3           string `json:"country_code_iso3,omitempty"`
	CountryName               string `json:"country_name,omitempty"`
	CountryPrefix             string `json:"country_prefix,omitempty"`
}

type CallErrorResponse

type CallErrorResponse struct {
	Type       string `json:"type,omitempty"`
	ErrorTitle string `json:"error_title,omitempty"`
}

func (*CallErrorResponse) Error

func (c *CallErrorResponse) Error() string

type CallInfo

type CallInfo struct {
	UUID             string      `json:"uuid,omitempty"`
	ConversationUUID string      `json:"conversation_uuid,omitempty"`
	To               interface{} `json:"to,omitempty"`
	From             interface{} `json:"from,omitempty"`
	Status           string      `json:"status,omitempty"`
	Direction        string      `json:"direction,omitempty"`
	Rate             string      `json:"rate,omitempty"`
	Price            string      `json:"price,omitempty"`
	Duration         string      `json:"duration,omitempty"`
	Network          string      `json:"network,omitempty"`
	StartTime        string      `json:"start_time,omitempty"`
	EndTime          string      `json:"end_time,omitempty"`
}

type CallRecordResponse

type CallRecordResponse struct {
	AccountID         string `json:"account_id"`
	CallID            string `json:"call_id"`
	Direction         string `json:"direction"`
	From              string `json:"from"`
	To                string `json:"to"`
	Network           string `json:"network"`
	NetworkName       string `json:"network_name"`
	Country           string `json:"country"`
	CountryName       string `json:"country_name"`
	DateStart         string `json:"date_start"`
	DateEnd           string `json:"date_end"`
	Duration          string `json:"duration"`
	Status            string `json:"status"`
	StatusDescription string `json:"status_description"`
	Currency          string `json:"currency"`
	Price             string `json:"price"`
	TotalPrice        string `json:"total_price"`
}

func (*CallRecordResponse) GetAccountId

func (r *CallRecordResponse) GetAccountId() string

func (*CallRecordResponse) GetId added in v1.0.6

func (r *CallRecordResponse) GetId() string

func (*CallRecordResponse) GetPrice added in v1.0.4

func (r *CallRecordResponse) GetPrice() string

type CallService

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

func (*CallService) CreateCall

func (c *CallService) CreateCall(request CreateCallRequest) (*CreateCallResponse, *http.Response, error)

CreateCall starts a voice call, configured using the provided CreateCallRequest.

func (*CallService) GetCallInfo

func (c *CallService) GetCallInfo(uuid string) (*CallInfo, *http.Response, error)

func (*CallService) ModifyCall

func (c *CallService) ModifyCall(uuid string, request interface{}) (*ModifyCallResponse, *http.Response, error)

func (*CallService) SearchCalls

func (c *CallService) SearchCalls(request SearchCallsRequest) (*SearchCallsResponse, *http.Response, error)

SearchCalls returns information about calls matching the filter in the provided SearchCallsRequest

func (*CallService) SendDTMF

func (c *CallService) SendDTMF(uuid string, request DTMFRequest) (*ModifyCallResponse, *http.Response, error)

func (*CallService) SetBaseURL

func (c *CallService) SetBaseURL(baseURL string)

func (*CallService) StopStream

func (c *CallService) StopStream(uuid string) (*ModifyCallResponse, *http.Response, error)

func (*CallService) StopTalk

func (c *CallService) StopTalk(uuid string) (*ModifyCallResponse, *http.Response, error)

func (*CallService) Stream

func (c *CallService) Stream(uuid string, request StreamRequest) (*ModifyCallResponse, *http.Response, error)

func (*CallService) Talk

func (c *CallService) Talk(uuid string, request TalkRequest) (*ModifyCallResponse, *http.Response, error)

type CarrierRecord

type CarrierRecord struct {
	NetworkCode string `json:"network_code"`
	Name        string `json:"name"`
	Country     string `json:"country"`
	NetworkType string `json:"network_type"`
}

type CheckVerificationRequest

type CheckVerificationRequest struct {
	Credentials
	RequestID string `json:"request_id"`
	Code      string `json:"code"`
	IPAddress string `json:"ip_address,omitempty"`
}

type CheckVerificationResponse

type CheckVerificationResponse struct {
	RequestID string `json:"event_id"`
	Status    string `json:"status"`
	Price     string `json:"price"`
	Currency  string `json:"currency"`
	ErrorText string `json:"error_text"`
}

type Client

type Client struct {
	Insight     *InsightService
	SMS         *SMSService
	Call        *CallService
	Verify      *VerifyService
	Developer   *DeveloperService
	Application *ApplicationService
	Report      *ReportService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client, authSet *AuthSet) *Client

type ControlVerificationRequest

type ControlVerificationRequest struct {
	Credentials
	RequestID string `json:"request_id"`
	Command   string `json:"cmd"`
}

type ControlVerificationResponse

type ControlVerificationResponse struct {
	Status    string `json:"status"`
	Command   string `json:"command"`
	ErrorText string `json:"error_text"`
}

type CountryPrices

type CountryPrices struct {
	MT       string         `json:"mt"`
	Country  string         `json:"country"`
	Prefix   string         `json:"prefix"`
	Name     string         `json:"name"`
	Networks []NetworkPrice `json:"networks"`
}

type CreateApplicationRequest

type CreateApplicationRequest struct {
	Credentials
	Name         string `json:"name"`
	Type         string `json:"type"`
	AnswerURL    string `json:"answer_url"`
	AnswerMethod string `json:"answer_method,omitempty"`
	EventURL     string `json:"event_url"`
	EventMethod  string `json:"event_method,omitempty"`
}

type CreateApplicationResponse

type CreateApplicationResponse ApplicationConfiguration

type CreateCallRequest

type CreateCallRequest struct {
	To               []interface{}       `json:"to"`
	From             map[string]string   `json:"from"`
	Ncco             []map[string]string `json:"ncco"`
	AnswerURL        []string            `json:"answer_url"`
	AnswerMethod     string              `json:"answer_method,omitempty"`
	EventURL         []string            `json:"event_url,omitempty"`
	EventMethod      string              `json:"event_method,omitempty"`
	MachineDetection string              `json:"machine_detection,omitempty"`
	LengthTimer      int64               `json:"length_timer,omitempty"`
	RingingTimer     int64               `json:"ringing_timer,omitempty"`
}

type CreateCallResponse

type CreateCallResponse struct {
	UUID             string `json:"uuid"`
	ConversationUUID string `json:"conversation_uuid"`
	Direction        string `json:"direction"`
	Status           string `json:"status"`
}

type Credentials

type Credentials struct {
	APIKey    string `json:"api_key" url:"api_key"`
	APISecret string `json:"api_secret" url:"api_secret"`
}

type DTMFRequest

type DTMFRequest struct {
	Digits string `json:"digits"`
}

type DeveloperService

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

func (*DeveloperService) GetBalance

func (s *DeveloperService) GetBalance() (*GetBalanceResponse, *http.Response, error)

func (*DeveloperService) GetOutboundPricingForCountry

func (s *DeveloperService) GetOutboundPricingForCountry(request GetOutboundPricingForCountryRequest) (*CountryPrices, *http.Response, error)

GetOutboundPricingForCountry requests pricing for a given country

func (*DeveloperService) GetOutboundProductPricing

GetOutboundProductPricing requests prices for a product in a given country

func (*DeveloperService) GetPhoneOutboundPricing

GetPhoneOutboundPricing requests outbound pricing for a given phone number

func (*DeveloperService) GetPrefixOutboundPricing

GetPrefixOutboundPricing requests outbound pricing for a given international prefix

func (*DeveloperService) SetBaseURL

func (c *DeveloperService) SetBaseURL(baseURL string)

type EmbeddedCalls

type EmbeddedCalls struct {
	Calls []CallInfo `json:"calls,omitempty"`
}

type GetApplicationRequest

type GetApplicationRequest struct {
	// Created with embedded Credentials, so this will support setApiCredentials
	// (if we alias to Credentials, we lose the implementation)
	Credentials
}

type GetApplicationResponse

type GetApplicationResponse ApplicationConfiguration

type GetBalanceResponse

type GetBalanceResponse struct {
	Value float64 `json:"value,omitempty"`
}

type GetOutboundPricingForCountryRequest

type GetOutboundPricingForCountryRequest struct {
	Credentials
	Country string `url:"country"`
}

type GetOutboundProductPricingRequest

type GetOutboundProductPricingRequest struct {
	Credentials
	Product string `url:"-"`
	Country string `url:"country"`
}

type GetOutboundProductPricingResponse

type GetOutboundProductPricingResponse struct {
	DialingPrefix      string           `json:"dialingPrefix"`
	DefaultPrice       string           `json:"defaultPrice"`
	Currency           string           `json:"currency"`
	CountryDisplayName string           `json:"countryDisplayName"`
	CountryCode        string           `json:"countryCode"`
	CountryName        string           `json:"countryName"`
	Networks           []NetworkDetails `json:"networks"`
}

type GetPhoneOutboundPricingRequest

type GetPhoneOutboundPricingRequest struct {
	// This is defined here because Product must not be serialized, and I haven't implemented that in the json-schema
	Credentials
	Phone   string `url:"phone"`
	Product string `url:"-"`
}

GetPhoneOutboundPricingRequest is the request object for DeveloperService.GetPhoneOutboundPricing

type GetPhoneOutboundPricingResponse

type GetPhoneOutboundPricingResponse struct {
	Network     string `json:"network,omitempty"`
	Phone       string `json:"phone,omitempty"`
	CountryCode string `json:"country-code,omitempty"`
	Price       string `json:"price,omitempty"`
}

type GetPrefixOutboundPricingRequest

type GetPrefixOutboundPricingRequest struct {
	Credentials
	Prefix string `url:"prefix"`
}

type GetPrefixOutboundPricingResponse

type GetPrefixOutboundPricingResponse struct {
	Count  int64           `json:"count"`
	Prices []CountryPrices `json:"prices"`
}

type InsightService

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

func (*InsightService) GetAdvancedInsight

func (*InsightService) GetBasicInsight

func (c *InsightService) GetBasicInsight(request BasicInsightRequest) (BasicInsightResponse, *http.Response, error)

func (*InsightService) GetStandardInsight

func (*InsightService) SetBaseURL

func (c *InsightService) SetBaseURL(baseURL string)
type Link struct {
	Href string `json:"href,omitempty"`
}
type Links struct {
	Self  Link `json:"self,omitempty"`
	Next  Link `json:"next,omitempty"`
	Prev  Link `json:"prev,omitempty"`
	First Link `json:"first,omitempty"`
	Last  Link `json:"last,omitempty"`
}

type ListApplicationsRequest

type ListApplicationsRequest struct {
	Credentials
	PageSize  int64 `url:"page_size,omitempty"`
	PageIndex int64 `url:"page_index,omitempty"`
}

type ListApplicationsResponse

type ListApplicationsResponse struct {
	Count    int64 `json:"count,omitempty"`
	PageSize int64 `json:"page_size,omitempty"`
	Embedded struct {
		Applications []ApplicationConfiguration `json:"applications"`
	} `json:"_embedded"`
	Links Links `json:"_links"`
}

type LoadRecordsRequest

type LoadRecordsRequest struct {
	AccountID      string `json:"account_id"`
	ID             string `json:"id"`        // The UUID of the message or call to be searched for.
	Product        string `json:"product"`   // Must be one of: SMS, VOICE-CALL, WEBSOCKET-CALL, VERIFY-API, NUMBER-INSIGHT, MESSAGES, CONVERSATIONS or ASR
	Direction      string `json:"direction"` // Must be one of: inbound or outbound
	DateStart      string `json:"date_start"`
	DateEnd        string `json:"date_end"`
	IncludeMessage bool   `json:"include_message"`
	Type           string `json:"type"`
	Status         string `json:"status"` // Must be one of: delivered, expired, failed, rejected, accepted, buffered, unknown or deleted
}

type LoadRecordsResponse

type LoadRecordsResponse struct {
	Links          Links                  `json:"_links,omitempty"`
	RequestID      string                 `json:"request_id"`
	RequestStatus  string                 `json:"request_status"`
	ReceivedAt     string                 `json:"received_at"`
	Price          string                 `json:"price"`
	Currency       string                 `json:"currency"`
	AccountID      string                 `json:"account_id"`
	Product        string                 `json:"product"`
	Direction      string                 `json:"direction"`
	IncludeMessage string                 `json:"include_message"`
	ItemsCount     int                    `json:"items_count"`
	Records        []ReportRecordResponse `json:"records"`
}

type ModifyApplicationRequest

type ModifyApplicationRequest CreateApplicationRequest

type ModifyApplicationResponse

type ModifyApplicationResponse ApplicationConfiguration

type ModifyCallResponse

type ModifyCallResponse struct {
	Message string `json:"message,omitempty"`
	UUID    string `json:"uuid,omitempty"`
}

type NetworkDetails

type NetworkDetails struct {
	Type        string  `json:"type"`
	Price       string  `json:"price"`
	Currency    string  `json:"currency"`
	Ranges      []int64 `json:"ranges"`
	MNC         string  `json:"mnc"`
	MCC         string  `json:"mcc"`
	NetworkCode string  `json:"networkCode"`
	NetworkName string  `json:"networkName"`
}

type NetworkPrice

type NetworkPrice struct {
	Network string `json:"network"`
	Code    string `json:"code"`
	MTPrice string `json:"mtPrice"`
}

type PhoneCallEndpoint

type PhoneCallEndpoint struct {
	Type       string `json:"type"`
	Number     string `json:"number"`
	Dtmfanswer string `json:"dtmfAnswer,omitempty"`
}

type RandomProvider

type RandomProvider interface {
	Int31() int32
}

type ReportErrorResponse

type ReportErrorResponse struct {
	Type       string `json:"type,omitempty"`
	ErrorTitle string `json:"error_title,omitempty"`
}

func (*ReportErrorResponse) Error

func (c *ReportErrorResponse) Error() string

type ReportRecordResponse

type ReportRecordResponse interface {
	GetAccountId() string
	GetPrice() string
	GetId() string
}

Reports api

type ReportService

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

func (*ReportService) LoadRecords

Load Records gets the list of records with the given search criterias

func (*ReportService) SetBaseURL

func (c *ReportService) SetBaseURL(baseURL string)

type SIPCallEndpoint

type SIPCallEndpoint struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

type SMSRecordResponse

type SMSRecordResponse struct {
	AccountID            string `json:"account_id"`
	MessageID            string `json:"message_id"`
	ClientRef            string `json:"client_ref"`
	Direction            string `json:"direction"`
	From                 string `json:"from"`
	To                   string `json:"to"`
	Network              string `json:"network"`
	NetworkName          string `json:"network_name"`
	Country              string `json:"country"`
	CountryName          string `json:"country_name"`
	DateReceived         string `json:"date_received"`
	DateFinalized        string `json:"date_finalized"`
	Latency              string `json:"latency"`
	Status               string `json:"status"`
	ErrorCode            string `json:"error_code"`
	ErrorCodeDescription string `json:"error_code_description"`
	Currency             string `json:"currency"`
	TotalPrice           string `json:"total_price"`
	MessageBody          string `json:"message_body"`
}

func (*SMSRecordResponse) GetAccountId

func (r *SMSRecordResponse) GetAccountId() string

func (*SMSRecordResponse) GetId added in v1.0.6

func (r *SMSRecordResponse) GetId() string

func (*SMSRecordResponse) GetPrice added in v1.0.4

func (r *SMSRecordResponse) GetPrice() string

type SMSService

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

func (*SMSService) SendSMS

func (c *SMSService) SendSMS(request SendSMSRequest) (*SendSMSResponse, *http.Response, error)

func (*SMSService) SetBaseURL

func (c *SMSService) SetBaseURL(baseURL string)

type SearchCallsRequest

type SearchCallsRequest struct {
	Status           string `url:"status,omitempty"`
	DateStart        string `url:"date_start,omitempty"`
	DateEnd          string `url:"date_end,omitempty"`
	PageSize         int64  `url:"page_size,omitempty"`
	RecordIndex      int64  `url:"record_index,omitempty"`
	Order            string `url:"order,omitempty"`
	ConversationUUID string `url:"conversation_uuid,omitempty"`
}

type SearchCallsResponse

type SearchCallsResponse struct {
	Count       int64         `json:"count,omitempty"`
	PageSize    int64         `json:"page_size,omitempty"`
	RecordIndex int64         `json:"record_index,omitempty"`
	Links       Links         `json:"_links,omitempty"`
	Embedded    EmbeddedCalls `json:"_embedded,omitempty"`
}

type SearchVerificationRequest

type SearchVerificationRequest struct {
	Credentials
	RequestIDs []string `json:"request_ids" url:"request_ids"`
}

type SearchVerificationResponse

type SearchVerificationResponse struct {
	Status               string `json:"status"`
	ErrorText            string `json:"error_text"`
	VerificationRequests []struct {
		RequestID      string `json:"request_id"`
		AccountID      string `json:"account_id"`
		Number         string `json:"number"`
		SenderID       string `json:"sender_id"`
		DateSubmitted  string `json:"date_submitted"`
		DateFinalized  string `json:"date_finalized"`
		FirstEventDate string `json:"first_event_date"`
		LastEventDate  string `json:"last_event_date"`
		Status         string `json:"status"`
		Price          string `json:"price"`
		Currency       string `json:"currency"`
		Checks         []struct {
			DateReceived string `json:"date_received"`
			Code         string `json:"code"`
			Status       string `json:"status"`
			IPAddress    string `json:"ip_address"`
		} `json:"checks"`
	} `json:"verification_requests"`
}

type SendSMSRequest

type SendSMSRequest struct {
	APIKey          string `json:"api_key"`
	APISecret       string `json:"api_secret"`
	From            string `json:"from,omitempty"`
	To              string `json:"to,omitempty"`
	Type            string `json:"type,omitempty"`
	Text            string `json:"text,omitempty"`
	StatusReportReq int64  `json:"status-report-req,omitempty"`
	ClientRef       string `json:"client-ref,omitempty"`
	Vcard           string `json:"vcard,omitempty"`
	Vcal            string `json:"vcal,omitempty"`
	TTL             int64  `json:"ttl,omitempty"`
	Callback        string `json:"callback,omitempty"`
	MessageClass    int64  `json:"message-class,omitempty"`
	Udh             string `json:"udh,omitempty"`
	ProtocolID      int64  `json:"protocol-id,omitempty"`
	Body            string `json:"body,omitempty"`
	Title           string `json:"title,omitempty"`
	URL             string `json:"url,omitempty"`
	Validity        int64  `json:"validity,omitempty"`
}

type SendSMSResponse

type SendSMSResponse struct {
	MessageCount string                   `json:"message-count,omitempty"`
	Messages     []SendSMSResponseMessage `json:"messages,omitempty"`
}

type SendSMSResponseMessage

type SendSMSResponseMessage struct {
	Status           string `json:"status,omitempty"`
	MessageID        string `json:"message-id,omitempty"`
	To               string `json:"to,omitempty"`
	ClientRef        string `json:"client-ref,omitempty"`
	RemainingBalance string `json:"remaining-balance,omitempty"`
	MessagePrice     string `json:"message-price,omitempty"`
	Network          string `json:"network,omitempty"`
	ErrorText        string `json:"error-text,omitempty"`
}

type SimpleModifyCallRequest

type SimpleModifyCallRequest struct {
	Action string `json:"action,omitempty"`
}

type StandardInsightRequest

type StandardInsightRequest struct {
	Credentials
	Number  string `json:"number,omitempty"`
	Country string `json:"country,omitempty"`
	CNAM    bool   `json:"cnam,omitempty"`
}

type StandardInsightResponse

type StandardInsightResponse struct {
	BasicInsightResponse
	RequestPrice     string         `json:"request_price"`
	RefundPrice      string         `json:"refund_price"`
	RemainingBalance string         `json:"remaining_balance"`
	Ported           string         `json:"ported"`
	CurrentCarrier   *CarrierRecord `json:"current_carrier,omitempty"`
	OriginalCarrier  *CarrierRecord `json:"original_carrier,omitempty"`

	// CNAM fields:
	CallerName string `json:"caller_name"`
	LastName   string `json:"last_name"`
	FirstName  string `json:"first_name"`
	CallerType string `json:"caller_type"`
}

type StartVerificationRequest

type StartVerificationRequest struct {
	Credentials
	Number        string `json:"number"`
	Brand         string `json:"brand"`
	Country       string `json:"country,omitempty"`
	SenderID      string `json:"sender_id,omitempty"`
	CodeLength    int8   `json:"code_length,omitempty"`
	LG            string `json:"lg,omitempty"`
	RequireType   string `json:"require_type,omitempty"`
	PINExpiry     int16  `json:"pin_expiry,omitempty"`
	NextEventWait int16  `json:"next_event_wait,omitempty"`
}

type StartVerificationResponse

type StartVerificationResponse struct {
	RequestID string `json:"request_id"`
	Status    string `json:"status"`
	ErrorText string `json:"error_text"`
}

type StreamRequest

type StreamRequest struct {
	StreamURL []string `json:"stream_url"`
	Loop      int64    `json:"loop,omitempty"`
}

type TalkRequest

type TalkRequest struct {
	Text      string `json:"text"`
	VoiceName string `json:"voice_name,omitempty"`
	Loop      int64  `json:"loop,omitempty"`
}

type TransferCallRequest

type TransferCallRequest struct {
	Action      string              `json:"action,omitempty"`
	Destination TransferDestination `json:"destination,omitempty"`
}

type TransferDestination

type TransferDestination struct {
	Type string   `json:"type,omitempty"`
	URL  []string `json:"url,omitempty"`
}

type VerifyService

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

func (*VerifyService) Check

func (*VerifyService) Control

func (*VerifyService) Search

func (*VerifyService) SetBaseURL

func (c *VerifyService) SetBaseURL(baseURL string)

func (*VerifyService) Start

type WebSocketCallEndpoint

type WebSocketCallEndpoint struct {
	Type        string      `json:"type"`
	URI         string      `json:"uri"`
	ContentType string      `json:"content-type,omitempty"`
	Headers     interface{} `json:"headers,omitempty"`
}

Directories

Path Synopsis
Package sling is a Go HTTP client library for creating and sending API requests.
Package sling is a Go HTTP client library for creating and sending API requests.

Jump to

Keyboard shortcuts

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