application

package
v0.0.0-...-1a4eb7b Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
	ContextOAuth2 = contextKey("token")

	// ContextBasicAuth takes BasicAuth as authentication for the request.
	ContextBasicAuth = contextKey("basic")

	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
	ContextAccessToken = contextKey("accesstoken")

	// ContextAPIKey takes an APIKey as authentication for the request
	ContextAPIKey = contextKey("apikey")
)

Functions

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	DefaultApi *DefaultApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Application API API v2.0.5 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) ChangeBasePath

func (c *APIClient) ChangeBasePath(path string)

ChangeBasePath changes base path to allow switching to mocks

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type APIKey

type APIKey struct {
	Key    string
	Prefix string
}

APIKey provides API key based authentication to a request passed via context using ContextAPIKey

type APIResponse

type APIResponse struct {
	*http.Response `json:"-"`
	Message        string `json:"message,omitempty"`
	// Operation is the name of the OpenAPI operation.
	Operation string `json:"operation,omitempty"`
	// RequestURL is the request URL. This value is always available, even if the
	// embedded *http.Response is nil.
	RequestURL string `json:"url,omitempty"`
	// Method is the HTTP method used for the request.  This value is always
	// available, even if the embedded *http.Response is nil.
	Method string `json:"method,omitempty"`
	// Payload holds the contents of the response body (which may be nil or empty).
	// This is provided here as the raw response.Body() reader will have already
	// been drained.
	Payload []byte `json:"-"`
}

APIResponse stores the API response returned by the server.

func NewAPIResponse

func NewAPIResponse(r *http.Response) *APIResponse

NewAPIResponse returns a new APIResonse object.

func NewAPIResponseWithError

func NewAPIResponseWithError(errorMessage string) *APIResponse

NewAPIResponseWithError returns a new APIResponse object with the provided error message.

type ApplicationResponse

type ApplicationResponse struct {
	// The application's ID
	Id string `json:"id,omitempty"`
	// Friendly identifier for your application. This is not unique
	Name         string                          `json:"name,omitempty"`
	Capabilities ApplicationResponseCapabilities `json:"capabilities,omitempty"`

	// **WARNING** Manually added because the AllOf from the spec didn't help
	Keys ApplicationResponseKeys `json:"keys,omitempty"`
}

ApplicationResponse struct for ApplicationResponse

type ApplicationResponseCapabilities

type ApplicationResponseCapabilities struct {
	Voice    ApplicationResponseCapabilitiesVoice    `json:"voice,omitempty"`
	Messages ApplicationResponseCapabilitiesMessages `json:"messages,omitempty"`
	Rtc      ApplicationResponseCapabilitiesRtc      `json:"rtc,omitempty"`
	// Specify the `vbc` capability to enable zero-rated calls for VBC number programmability service applications. This is always an empty object.
	Vbc map[string]interface{} `json:"vbc,omitempty"`
}

ApplicationResponseCapabilities Configuration for the products available in this application

type ApplicationResponseCapabilitiesMessages

type ApplicationResponseCapabilitiesMessages struct {
	Webhooks ApplicationResponseCapabilitiesMessagesWebhooks `json:"webhooks,omitempty"`
}

ApplicationResponseCapabilitiesMessages Messages / Dispatch related configuration

type ApplicationResponseCapabilitiesMessagesWebhooks

type ApplicationResponseCapabilitiesMessagesWebhooks struct {
	InboundUrl ApplicationResponseCapabilitiesMessagesWebhooksInboundUrl `json:"inbound_url,omitempty"`
	StatusUrl  ApplicationResponseCapabilitiesMessagesWebhooksStatusUrl  `json:"status_url,omitempty"`
}

ApplicationResponseCapabilitiesMessagesWebhooks struct for ApplicationResponseCapabilitiesMessagesWebhooks

type ApplicationResponseCapabilitiesMessagesWebhooksInboundUrl

type ApplicationResponseCapabilitiesMessagesWebhooksInboundUrl struct {
	// The URL that Nexmo forwards inbound messages to on your server
	Address string `json:"address,omitempty"`
	// The HTTP method used to send inbound messages to your server
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesMessagesWebhooksInboundUrl struct for ApplicationResponseCapabilitiesMessagesWebhooksInboundUrl

type ApplicationResponseCapabilitiesMessagesWebhooksStatusUrl

type ApplicationResponseCapabilitiesMessagesWebhooksStatusUrl struct {
	// The URL that Nexmo sends events related to your messages to
	Address string `json:"address,omitempty"`
	// The HTTP method used to send events to your server (always `POST`)
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesMessagesWebhooksStatusUrl struct for ApplicationResponseCapabilitiesMessagesWebhooksStatusUrl

type ApplicationResponseCapabilitiesRtc

type ApplicationResponseCapabilitiesRtc struct {
	Webhooks ApplicationResponseCapabilitiesRtcWebhooks `json:"webhooks,omitempty"`
}

ApplicationResponseCapabilitiesRtc RTC / Conversation Service related configuration

type ApplicationResponseCapabilitiesRtcWebhooks

type ApplicationResponseCapabilitiesRtcWebhooks struct {
	EventUrl ApplicationResponseCapabilitiesRtcWebhooksEventUrl `json:"event_url,omitempty"`
}

ApplicationResponseCapabilitiesRtcWebhooks struct for ApplicationResponseCapabilitiesRtcWebhooks

type ApplicationResponseCapabilitiesRtcWebhooksEventUrl

type ApplicationResponseCapabilitiesRtcWebhooksEventUrl struct {
	Address    string `json:"address,omitempty"`
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesRtcWebhooksEventUrl struct for ApplicationResponseCapabilitiesRtcWebhooksEventUrl

type ApplicationResponseCapabilitiesVoice

type ApplicationResponseCapabilitiesVoice struct {
	Webhooks ApplicationResponseCapabilitiesVoiceWebhooks `json:"webhooks,omitempty"`
}

ApplicationResponseCapabilitiesVoice Voice related configuration

type ApplicationResponseCapabilitiesVoiceWebhooks

type ApplicationResponseCapabilitiesVoiceWebhooks struct {
	AnswerUrl         ApplicationResponseCapabilitiesVoiceWebhooksAnswerUrl         `json:"answer_url,omitempty"`
	FallbackAnswerUrl ApplicationResponseCapabilitiesVoiceWebhooksFallbackAnswerUrl `json:"fallback_answer_url,omitempty"`
	EventUrl          ApplicationResponseCapabilitiesVoiceWebhooksEventUrl          `json:"event_url,omitempty"`
}

ApplicationResponseCapabilitiesVoiceWebhooks struct for ApplicationResponseCapabilitiesVoiceWebhooks

type ApplicationResponseCapabilitiesVoiceWebhooksAnswerUrl

type ApplicationResponseCapabilitiesVoiceWebhooksAnswerUrl struct {
	// The URL that Nexmo requests when a call is placed/received. Must return an NCCO
	Address string `json:"address,omitempty"`
	// The HTTP method used to fetch your NCCO from your `answer_url`
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesVoiceWebhooksAnswerUrl struct for ApplicationResponseCapabilitiesVoiceWebhooksAnswerUrl

type ApplicationResponseCapabilitiesVoiceWebhooksEventUrl

type ApplicationResponseCapabilitiesVoiceWebhooksEventUrl struct {
	// The URL that Nexmo sends events related to your call to
	Address string `json:"address,omitempty"`
	// The HTTP method used to send events to your server
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesVoiceWebhooksEventUrl struct for ApplicationResponseCapabilitiesVoiceWebhooksEventUrl

type ApplicationResponseCapabilitiesVoiceWebhooksFallbackAnswerUrl

type ApplicationResponseCapabilitiesVoiceWebhooksFallbackAnswerUrl struct {
	// If your `answer_url` is offline or returns a HTTP error code, Nexmo will make a request to a `fallback_answer_url` if it is set. This URL must return an NCCO.
	Address string `json:"address,omitempty"`
	// The HTTP method used to fetch your NCCO from your `answer_url`
	HttpMethod string `json:"http_method,omitempty"`
}

ApplicationResponseCapabilitiesVoiceWebhooksFallbackAnswerUrl struct for ApplicationResponseCapabilitiesVoiceWebhooksFallbackAnswerUrl

type ApplicationResponseCollection

type ApplicationResponseCollection struct {
	// The number of applications per page
	PageSize int32 `json:"page_size,omitempty"`
	// The current page number (starts at 1)
	Page int32 `json:"page,omitempty"`
	// The total number of applications
	TotalItems int32 `json:"total_items,omitempty"`
	// The total number of pages returned
	TotalPages int32                                 `json:"total_pages,omitempty"`
	Embedded   ApplicationResponseCollectionEmbedded `json:"_embedded,omitempty"`
}

ApplicationResponseCollection struct for ApplicationResponseCollection

type ApplicationResponseCollectionEmbedded

type ApplicationResponseCollectionEmbedded struct {
	Applications []ApplicationResponse `json:"applications,omitempty"`
}

ApplicationResponseCollectionEmbedded A list of applications matching your existing filters

type ApplicationResponseKeys

type ApplicationResponseKeys struct {
	PublicKey  string `json:"public_key,omitempty"`
	PrivateKey string `json:"private_key,omitempty"`
}

ApplicationResponseKeys

type BasicAuth

type BasicAuth struct {
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth

type Configuration

type Configuration struct {
	BasePath      string            `json:"basePath,omitempty"`
	Host          string            `json:"host,omitempty"`
	Scheme        string            `json:"scheme,omitempty"`
	DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
	UserAgent     string            `json:"userAgent,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Servers       []ServerConfiguration
	HTTPClient    *http.Client
}

Configuration stores the configuration of the API client

func NewConfiguration

func NewConfiguration() *Configuration

NewConfiguration returns a new Configuration object

func (*Configuration) AddDefaultHeader

func (c *Configuration) AddDefaultHeader(key string, value string)

AddDefaultHeader adds a new HTTP header to the default header in the request

func (*Configuration) ServerUrl

func (c *Configuration) ServerUrl(index int, variables map[string]string) (string, error)

ServerUrl returns URL based on server settings

type CreateApplicationOpts

type CreateApplicationOpts struct {
	Opts optional.Interface
}

type DefaultApiService

type DefaultApiService service

DefaultApiService DefaultApi service

func (*DefaultApiService) CreateApplication

func (a *DefaultApiService) CreateApplication(ctx _context.Context, localVarOptionals *CreateApplicationOpts) (ApplicationResponse, *_nethttp.Response, error)

CreateApplication Create an application

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param uNKNOWNBASETYPE

@return ApplicationResponse

func (*DefaultApiService) DeleteApplication

func (a *DefaultApiService) DeleteApplication(ctx _context.Context, id string) (*_nethttp.Response, error)

DeleteApplication Delete an application Deleting an application **cannot be undone**.

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id The ID of the application

func (*DefaultApiService) GetApplication

GetApplication Get an application

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id The ID of the application

@return ApplicationResponse

func (*DefaultApiService) ListApplication

ListApplication List available applications

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param optional nil or *ListApplicationOpts - Optional Parameters:
  • @param "PageSize" (optional.Int32) - The number of applications per page
  • @param "Page" (optional.Int32) - The current page number (starts at 1)

@return ApplicationResponseCollection

func (*DefaultApiService) UpdateApplication

func (a *DefaultApiService) UpdateApplication(ctx _context.Context, id string, localVarOptionals *UpdateApplicationOpts) (ApplicationResponse, *_nethttp.Response, error)

UpdateApplication Update an application

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @param id The ID of the application
  • @param uNKNOWNBASETYPE

@return ApplicationResponse

type GenericOpenAPIError

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

GenericOpenAPIError Provides access to the body, error and model on returned errors.

func (GenericOpenAPIError) Body

func (e GenericOpenAPIError) Body() []byte

Body returns the raw bytes of the response

func (GenericOpenAPIError) Error

func (e GenericOpenAPIError) Error() string

Error returns non-empty string if there was an error.

func (GenericOpenAPIError) Model

func (e GenericOpenAPIError) Model() interface{}

Model returns the unpacked model of the error

type ListApplicationOpts

type ListApplicationOpts struct {
	PageSize optional.Int32
	Page     optional.Int32
}

ListApplicationOpts Optional parameters for the method 'ListApplication'

type ServerConfiguration

type ServerConfiguration struct {
	Url         string
	Description string
	Variables   map[string]ServerVariable
}

ServerConfiguration stores the information about a server

type ServerVariable

type ServerVariable struct {
	Description  string
	DefaultValue string
	EnumValues   []string
}

ServerVariable stores the information about a server variable

type UpdateApplicationOpts

type UpdateApplicationOpts struct {
	Opts optional.Interface
}

Jump to

Keyboard shortcuts

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