openapi

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 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.43.1
  • 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://pricing.twilio.com

Class Method HTTP request Description
TrunkingCountriesApi FetchTrunkingCountry Get /v2/Trunking/Countries/{IsoCountry}
TrunkingCountriesApi ListTrunkingCountry Get /v2/Trunking/Countries
TrunkingNumbersApi FetchTrunkingNumber Get /v2/Trunking/Numbers/{DestinationNumber}
VoiceCountriesApi FetchVoiceCountry Get /v2/Voice/Countries/{IsoCountry}
VoiceCountriesApi ListVoiceCountry Get /v2/Voice/Countries
VoiceNumbersApi FetchVoiceNumber Get /v2/Voice/Numbers/{DestinationNumber}

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 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) FetchTrunkingCountry added in v0.14.1

func (c *ApiService) FetchTrunkingCountry(IsoCountry string) (*PricingV2TrunkingCountryInstance, error)

Fetch a specific Country.

func (*ApiService) FetchTrunkingNumber added in v0.14.1

func (c *ApiService) FetchTrunkingNumber(DestinationNumber string, params *FetchTrunkingNumberParams) (*PricingV2TrunkingNumber, error)

Fetch pricing information for a specific destination and, optionally, origination phone number.

func (*ApiService) FetchVoiceCountry added in v0.11.0

func (c *ApiService) FetchVoiceCountry(IsoCountry string) (*PricingV2VoiceCountryInstance, error)

Fetch a specific Country.

func (*ApiService) FetchVoiceNumber added in v0.11.0

func (c *ApiService) FetchVoiceNumber(DestinationNumber string, params *FetchVoiceNumberParams) (*PricingV2VoiceNumber, error)

Fetch pricing information for a specific destination and, optionally, origination phone number.

func (*ApiService) ListTrunkingCountry added in v0.14.1

func (c *ApiService) ListTrunkingCountry(params *ListTrunkingCountryParams) ([]PricingV2TrunkingCountry, error)

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

func (*ApiService) ListVoiceCountry added in v0.11.0

func (c *ApiService) ListVoiceCountry(params *ListVoiceCountryParams) ([]PricingV2VoiceCountry, error)

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

func (*ApiService) PageTrunkingCountry added in v0.14.1

func (c *ApiService) PageTrunkingCountry(params *ListTrunkingCountryParams, pageToken, pageNumber string) (*ListTrunkingCountryResponse, error)

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

func (*ApiService) PageVoiceCountry added in v0.13.0

func (c *ApiService) PageVoiceCountry(params *ListVoiceCountryParams, pageToken, pageNumber string) (*ListVoiceCountryResponse, error)

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

func (*ApiService) StreamTrunkingCountry added in v0.14.1

func (c *ApiService) StreamTrunkingCountry(params *ListTrunkingCountryParams) (chan PricingV2TrunkingCountry, chan error)

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

func (*ApiService) StreamVoiceCountry added in v0.13.0

func (c *ApiService) StreamVoiceCountry(params *ListVoiceCountryParams) (chan PricingV2VoiceCountry, chan error)

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

type FetchTrunkingNumberParams added in v0.14.1

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

Optional parameters for the method 'FetchTrunkingNumber'

func (*FetchTrunkingNumberParams) SetOriginationNumber added in v0.14.1

func (params *FetchTrunkingNumberParams) SetOriginationNumber(OriginationNumber string) *FetchTrunkingNumberParams

type FetchVoiceNumberParams

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

Optional parameters for the method 'FetchVoiceNumber'

func (*FetchVoiceNumberParams) SetOriginationNumber

func (params *FetchVoiceNumberParams) SetOriginationNumber(OriginationNumber string) *FetchVoiceNumberParams

type ListTrunkingCountryParams added in v0.14.1

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

Optional parameters for the method 'ListTrunkingCountry'

func (*ListTrunkingCountryParams) SetLimit added in v0.14.1

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

func (*ListTrunkingCountryParams) SetPageSize added in v0.14.1

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

type ListTrunkingCountryResponse added in v0.14.1

type ListTrunkingCountryResponse struct {
	Countries []PricingV2TrunkingCountry      `json:"countries,omitempty"`
	Meta      ListTrunkingCountryResponseMeta `json:"meta,omitempty"`
}

ListTrunkingCountryResponse struct for ListTrunkingCountryResponse

type ListTrunkingCountryResponseMeta added in v0.14.1

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"`
	PreviousPageUrl *string `json:"previous_page_url,omitempty"`
	Url             string  `json:"url,omitempty"`
	Key             string  `json:"key,omitempty"`
}

ListTrunkingCountryResponseMeta struct for ListTrunkingCountryResponseMeta

type ListVoiceCountryParams

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

Optional parameters for the method 'ListVoiceCountry'

func (*ListVoiceCountryParams) SetLimit added in v0.13.0

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

func (*ListVoiceCountryParams) SetPageSize

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

type ListVoiceCountryResponse

type ListVoiceCountryResponse struct {
	Countries []PricingV2VoiceCountry         `json:"countries,omitempty"`
	Meta      ListTrunkingCountryResponseMeta `json:"meta,omitempty"`
}

ListVoiceCountryResponse struct for ListVoiceCountryResponse

type PricingV2TrunkingCountry added in v0.14.1

type PricingV2TrunkingCountry struct {
	// 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 absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2TrunkingCountry struct for PricingV2TrunkingCountry

type PricingV2TrunkingCountryInstance added in v0.14.1

type PricingV2TrunkingCountryInstance struct {
	// 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 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.
	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`).
	PriceUnit *string `json:"price_unit,omitempty"`
	// The absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2TrunkingCountryInstance struct for PricingV2TrunkingCountryInstance

type PricingV2TrunkingCountryInstanceOriginatingCallPrices added in v0.14.1

type PricingV2TrunkingCountryInstanceOriginatingCallPrices struct {
	BasePrice    float32 `json:"base_price,omitempty"`
	CurrentPrice float32 `json:"current_price,omitempty"`
	NumberType   string  `json:"number_type,omitempty"`
}

PricingV2TrunkingCountryInstanceOriginatingCallPrices struct for PricingV2TrunkingCountryInstanceOriginatingCallPrices

func (*PricingV2TrunkingCountryInstanceOriginatingCallPrices) UnmarshalJSON added in v0.25.0

func (response *PricingV2TrunkingCountryInstanceOriginatingCallPrices) UnmarshalJSON(bytes []byte) (err error)

type PricingV2TrunkingCountryInstanceTerminatingPrefixPrices added in v0.14.1

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

PricingV2TrunkingCountryInstanceTerminatingPrefixPrices struct for PricingV2TrunkingCountryInstanceTerminatingPrefixPrices

func (*PricingV2TrunkingCountryInstanceTerminatingPrefixPrices) UnmarshalJSON added in v0.25.0

func (response *PricingV2TrunkingCountryInstanceTerminatingPrefixPrices) UnmarshalJSON(bytes []byte) (err error)

type PricingV2TrunkingNumber added in v0.14.1

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.
	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.
	OriginationNumber *string `json:"origination_number,omitempty"`
	// 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"`
	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`).
	PriceUnit *string `json:"price_unit,omitempty"`
	// The absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2TrunkingNumber struct for PricingV2TrunkingNumber

type PricingV2TrunkingNumberOriginatingCallPrice added in v0.14.1

type PricingV2TrunkingNumberOriginatingCallPrice struct {
	BasePrice    float32 `json:"base_price,omitempty"`
	CurrentPrice float32 `json:"current_price,omitempty"`
	NumberType   string  `json:"number_type,omitempty"`
}

PricingV2TrunkingNumberOriginatingCallPrice The [OriginatingCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.

func (*PricingV2TrunkingNumberOriginatingCallPrice) UnmarshalJSON added in v0.25.0

func (response *PricingV2TrunkingNumberOriginatingCallPrice) UnmarshalJSON(bytes []byte) (err error)

type PricingV2Voice

type PricingV2Voice struct {
	// The resource name.
	Name *string `json:"name,omitempty"`
	// The absolute URL of the resource.
	Url *string `json:"url,omitempty"`
	// The URLs of the related Countries and Numbers resources.
	Links *map[string]interface{} `json:"links,omitempty"`
}

PricingV2Voice struct for PricingV2Voice

type PricingV2VoiceCountry added in v0.14.0

type PricingV2VoiceCountry struct {
	// 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 absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2VoiceCountry struct for PricingV2VoiceCountry

type PricingV2VoiceCountryInstance added in v0.14.0

type PricingV2VoiceCountryInstance struct {
	// 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 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.
	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`).
	PriceUnit *string `json:"price_unit,omitempty"`
	// The absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2VoiceCountryInstance struct for PricingV2VoiceCountryInstance

type PricingV2VoiceNumber added in v0.14.0

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.
	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.
	OriginationNumber *string `json:"origination_number,omitempty"`
	// 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 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`).
	PriceUnit *string `json:"price_unit,omitempty"`
	// The absolute URL of the resource.
	Url *string `json:"url,omitempty"`
}

PricingV2VoiceNumber struct for PricingV2VoiceNumber

type PricingV2VoiceVoiceNumberInboundCallPrice

type PricingV2VoiceVoiceNumberInboundCallPrice struct {
	BasePrice    float32 `json:"base_price,omitempty"`
	CurrentPrice float32 `json:"current_price,omitempty"`
	NumberType   string  `json:"number_type,omitempty"`
}

PricingV2VoiceVoiceNumberInboundCallPrice The [InboundCallPrice](https://www.twilio.com/docs/voice/pricing#inbound-call-price) record.

func (*PricingV2VoiceVoiceNumberInboundCallPrice) UnmarshalJSON added in v0.25.0

func (response *PricingV2VoiceVoiceNumberInboundCallPrice) UnmarshalJSON(bytes []byte) (err error)

type PricingV2VoiceVoiceNumberOutboundCallPrices

type PricingV2VoiceVoiceNumberOutboundCallPrices struct {
	BasePrice           float32  `json:"base_price,omitempty"`
	CurrentPrice        float32  `json:"current_price,omitempty"`
	OriginationPrefixes []string `json:"origination_prefixes,omitempty"`
}

PricingV2VoiceVoiceNumberOutboundCallPrices struct for PricingV2VoiceVoiceNumberOutboundCallPrices

func (*PricingV2VoiceVoiceNumberOutboundCallPrices) UnmarshalJSON added in v0.25.0

func (response *PricingV2VoiceVoiceNumberOutboundCallPrices) UnmarshalJSON(bytes []byte) (err error)

Jump to

Keyboard shortcuts

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