Documentation ¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type ApiError
- type BasicAuth
- type CompiledRead
- type Configuration
- type Cursor
- type GenericOpenAPIError
- type LocalizationMetaRead
- type LocalizationRead
- type LocalizationsApiService
- type TemplateMetaRead
- type TemplateRead
- type TemplatesApiService
- func (a *TemplatesApiService) TemplatesGet(ctx context.Context, accept string, localVarOptionals *TemplatesGetOpts) (TemplatesRead, *http.Response, error)
- func (a *TemplatesApiService) TemplatesTemplateIdGet(ctx context.Context, templateId string, accept string) (TemplateRead, *http.Response, error)
- type TemplatesGetOpts
- type TemplatesRead
Constants ¶
This section is empty.
Variables ¶
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 ¶
Types ¶
type APIClient ¶
type APIClient struct { LocalizationsApi *LocalizationsApiService TemplatesApi *TemplatesApiService // contains filtered or unexported fields }
APIClient manages communication with the Dyspatch API API v2018.08 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 ¶
Change base path to allow switching to mocks
type APIKey ¶
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:"-"` }
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type ApiError ¶
type ApiError struct { // Error code: * server_error - Internal server error. * invalid_parameter - Validation error, parameter will contain invalid field and message will contain the reason. * invalid_body - Body could not be parsed, message will contain the reason. * invalid_request - Validation error, the protocol used to make the request was not https. * unauthorized - Credentials were found but permissions were not sufficient. * unauthenticated - Credentials were not found or were not valid. * not_found - The requested resource was not found. * rate_limited - The request was refused because a rate limit was exceeded. There is an account wide rate limit of 3600 requests per-minute, although that is subject to change. The current remaining rate limit can be viewed by checking the X-Ratelimit-Remaining header. Code string `json:"code,omitempty"` // Human readable error message Message string `json:"message,omitempty"` // The invalid parameter, if 'code' is invalid_parameter Parameter string `json:"parameter,omitempty"` }
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 CompiledRead ¶
type CompiledRead struct { // Sender address Sender string `json:"sender,omitempty"` // Reply-To address ReplyTo string `json:"replyTo,omitempty"` // Base64 encoded template subject line Subject string `json:"subject,omitempty"` // Base64 encoded template HTML body Html string `json:"html,omitempty"` // Base64 encoded template text body Text string `json:"text,omitempty"` }
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"` HTTPClient *http.Client }
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type Cursor ¶
type Cursor struct { // A cursor to fetch the next page of results Next string `json:"next,omitempty"` // Whether there is a next page of results HasMore bool `json:"hasMore,omitempty"` }
Information about paginated results
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 LocalizationMetaRead ¶
type LocalizationMetaRead struct { // An opaque, unique identifier for a localization Id string `json:"id,omitempty"` // A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/). Language string `json:"language,omitempty"` // The user-specified name of a localization Name string `json:"name,omitempty"` // The API url for a specific localization Url string `json:"url,omitempty"` }
type LocalizationRead ¶
type LocalizationRead struct { // An opaque, unique identifier for a localization Id string `json:"id,omitempty"` // A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/). Language string `json:"language,omitempty"` // The API url for a specific localization Url string `json:"url,omitempty"` // An opaque, unique identifier for a template Template string `json:"template,omitempty"` Compiled CompiledRead `json:"compiled,omitempty"` // The time of initial creation CreatedAt time.Time `json:"createdAt,omitempty"` // The time of last update UpdatedAt time.Time `json:"updatedAt,omitempty"` // The user-specified name of a localization Name string `json:"name,omitempty"` }
type LocalizationsApiService ¶
type LocalizationsApiService service
func (*LocalizationsApiService) LocalizationsLocalizationIdGet ¶
func (a *LocalizationsApiService) LocalizationsLocalizationIdGet(ctx context.Context, localizationId string, accept string) (LocalizationRead, *http.Response, error)
LocalizationsApiService Get Localization Object by ID Returns a specific localization object with a matching ID
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param localizationId A localization ID
- @param accept A version of the API that should be used for the request. For example, to use version \"2018.08\", set the value to \"application/vnd.dyspatch.2018.08+json\"
@return LocalizationRead
type TemplateMetaRead ¶
type TemplateMetaRead struct { // An opaque, unique identifier for a template Id string `json:"id,omitempty"` // The name of a template Name string `json:"name,omitempty"` // A description of the template Description string `json:"description,omitempty"` // The API url for a specific template Url string `json:"url,omitempty"` // A list of the template's available localization objects Localizations []LocalizationMetaRead `json:"localizations,omitempty"` // The time of initial creation CreatedAt time.Time `json:"createdAt,omitempty"` // The time of last update UpdatedAt time.Time `json:"updatedAt,omitempty"` }
type TemplateRead ¶
type TemplateRead struct { // An opaque, unique identifier for a template Id string `json:"id,omitempty"` // The name of a template Name string `json:"name,omitempty"` // A description of the template Description string `json:"description,omitempty"` // The API url for a specific template Url string `json:"url,omitempty"` Compiled CompiledRead `json:"compiled,omitempty"` // The time of initial creation CreatedAt time.Time `json:"createdAt,omitempty"` // The time of last update UpdatedAt time.Time `json:"updatedAt,omitempty"` // A list of the Template's available localizations Localizations []LocalizationMetaRead `json:"localizations,omitempty"` }
type TemplatesApiService ¶
type TemplatesApiService service
func (*TemplatesApiService) TemplatesGet ¶
func (a *TemplatesApiService) TemplatesGet(ctx context.Context, accept string, localVarOptionals *TemplatesGetOpts) (TemplatesRead, *http.Response, error)
func (*TemplatesApiService) TemplatesTemplateIdGet ¶
func (a *TemplatesApiService) TemplatesTemplateIdGet(ctx context.Context, templateId string, accept string) (TemplateRead, *http.Response, error)
TemplatesApiService Get Template by ID Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template .
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param templateId A template ID
- @param accept A version of the API that should be used for the request. For example, to use version \"2018.08\", set the value to \"application/vnd.dyspatch.2018.08+json\"
@return TemplateRead
type TemplatesGetOpts ¶
type TemplatesRead ¶
type TemplatesRead struct { Cursor Cursor `json:"cursor,omitempty"` // A list of template metadata objects Data []TemplateMetaRead `json:"data,omitempty"` }