notifications

package
v0.0.0-...-e40a8b4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 20 Imported by: 0

README

Telestream Cloud Notifications Go SDK

This library provides a low-level interface to the REST API of Telestream Cloud, the online video encoding service.

Getting Started

Initialize client
config := notifications.NewConfiguration()
client := notifications.NewAPIClient(config)

Authorization
ctx := context.Background()
ctx = context.WithValue(ctx, notifications.ContextAPIKey, notifications.APIKey{Key: "YOUR_API_KEY"})
client.Service.Operation(ctx, args)
Create subscription
_, err := client.NotificationsApi.CreateSubscription(ctx, map[string]interface{}{
    "subscription" : notifications.Subscription{
        Type_: "webhook",
        Topic: &notifications.Topic{
            Service: "qc",
            Event: "video-passed",
            Project: projectID,
        },
        Params: &notifications.Params{
            Url: "user@example.com",
        },
    }

if err != nil {
    // handle error
}
List subscriptions
subscriptions, _, err := client.NotificationsApi.ListSubscriptions(ctx)

if err != nil {
    // handle error
}

for _, sub := range subscriptions {
}

Overview

This API client was generated by the swagger-codegen project. By using the swagger-spec from a remote server, you can easily generate an API client.

  • API version: 2.1.0
  • Package version: 2.1.0
  • Build package: io.swagger.codegen.languages.GoClientCodegen

Documentation for API Endpoints

All URIs are relative to https://api.cloud.telestream.net/notifications/v2.0

Class Method HTTP request Description
NotificationsApi CreateSubscription Post /subscriptions Create a new subscription
NotificationsApi DeleteSubscription Delete /subscriptions/{id}
NotificationsApi GetSubscription Get /subscriptions/{id}
NotificationsApi ListSubscriptions Get /subscriptions
NotificationsApi ModifySubscription Put /subscriptions/{id} Modify subscription

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key

Example

	auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
		Key: "APIKEY",
		Prefix: "Bearer", // Omit if not necessary.
	})
    r, err := client.Service.Operation(auth, args)

Author

cloudsupport@telestream.net

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ContextOAuth2 takes a 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 {

	// API Services
	NotificationsApi *NotificationsApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Notifications API API v2.1.0 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)

Change base path to allow switching to mocks

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 swagger 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 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"`
	HTTPClient    *http.Client
}

func NewConfiguration

func NewConfiguration() *Configuration

func (*Configuration) AddDefaultHeader

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

type NotificationsApiService

type NotificationsApiService service

func (*NotificationsApiService) CreateSubscription

func (a *NotificationsApiService) CreateSubscription(ctx context.Context, localVarOptionals map[string]interface{}) (Subscription, *http.Response, error)

NotificationsApiService Create a new subscription

* @param ctx context.Context for authentication, logging, tracing, etc. @param optional (nil or map[string]interface{}) with one or more of:

@param "subscription" (Subscription)

@return Subscription

func (*NotificationsApiService) DeleteSubscription

func (a *NotificationsApiService) DeleteSubscription(ctx context.Context, id string) (*http.Response, error)

NotificationsApiService * @param ctx context.Context for authentication, logging, tracing, etc. @param id @return

func (*NotificationsApiService) GetSubscription

func (a *NotificationsApiService) GetSubscription(ctx context.Context, id string) (Subscription, *http.Response, error)

NotificationsApiService * @param ctx context.Context for authentication, logging, tracing, etc. @param id @return Subscription

func (*NotificationsApiService) ListSubscriptions

func (a *NotificationsApiService) ListSubscriptions(ctx context.Context, localVarOptionals map[string]interface{}) ([]Subscription, *http.Response, error)

NotificationsApiService * @param ctx context.Context for authentication, logging, tracing, etc. @param optional (nil or map[string]interface{}) with one or more of:

@param "serviceType" (string) Service type (qc, tts, flip)
@param "type_" (string) Subscription type (email, webhook, sns, aeg, pubsub)

@return []Subscription

func (*NotificationsApiService) ModifySubscription

func (a *NotificationsApiService) ModifySubscription(ctx context.Context, id string, localVarOptionals map[string]interface{}) (Subscription, *http.Response, error)

NotificationsApiService Modify subscription * @param ctx context.Context for authentication, logging, tracing, etc. @param id @param optional (nil or map[string]interface{}) with one or more of:

@param "updateData" (UpdateData)

@return Subscription

type Params

type Params struct {

	// (for email subscription type);  E-mail addresses
	Addresses []string `json:"addresses,omitempty"`

	// (for webhook subscription type);  Webhook URL
	Url string `json:"url,omitempty"`

	// (for webhook subscription type);  HTTP method; default: POST (GET, POST)
	Method string `json:"method,omitempty"`

	// (for webhook subscription type);  Number of retries before forgetting the notification; default: 0
	Retries int32 `json:"retries,omitempty"`

	// (for webhook subscription type); default: application/json (application/json, application/x-www-form-urlencoded)
	ContentType string `json:"content_type,omitempty"`

	// (for sns subscription type) identifier of an AWS SNS Topic that events will be posted to.
	TopicArn string `json:"topic_arn,omitempty"`

	// (for sns subscription type) identifier of an AWS IAM Role that will be used for authorization.
	RoleArn string `json:"role_arn,omitempty"`

	// (for aeg subscription type) address of an Azure Event Grid Topic that events will be posted to.
	TopicEndpoint string `json:"topic_endpoint,omitempty"`

	// (for aeg subscription type) secret access key that authorizes Telestream Cloud to write to an Azure Event Grid Topic.
	AccessKey string `json:"access_key,omitempty"`

	// (for pubsub subscription type) id of a Google Cloud project that hosts the topic.
	ProjectId string `json:"project_id,omitempty"`

	// (for pubsub subscription type) name of a Google Cloud Pub/Sub topic to which notifications will be published.
	TopicName string `json:"topic_name,omitempty"`
}

type Subscription

type Subscription struct {

	// [read-only] Subscription identifier
	Id string `json:"id,omitempty"`

	// Type of subscription (email, webhook, sns, aeg, pubsub)
	Type_ string `json:"type"`

	Topic *Topic `json:"topic"`

	Params *Params `json:"params"`
}

type Topic

type Topic struct {

	// [read-only] Account identifier connected to subscription notification
	Account string `json:"account,omitempty"`

	// Name of service (qc, flip, tts)
	Service string `json:"service"`

	// Name of the event;  Quality Control (media-passed, media-error, media-warning, media-rejected, media-canceled, job-created, job-progress), Flip (video-created, video-encoded, encoding-complete, encoding-progress), Transcription (job-created, job-completed, job-error, job-progress)
	Event string `json:"event"`

	// (for tts, qc service); Project ID
	Project string `json:"project,omitempty"`

	// (for flip service); Factory ID
	Factory string `json:"factory,omitempty"`
}

type UpdateData

type UpdateData struct {
	Topic *UpdateTopic `json:"topic,omitempty"`

	Params *Params `json:"params,omitempty"`
}

type UpdateTopic

type UpdateTopic struct {

	// Name of the event; Quality Control (media-passed, media-error, media-warning, media-rejected, media-canceled, job-created, job-progress), Flip (video-created, video-encoded, encoding-complete, encoding-progress), Transcription (job-created, job-completed, job-error, job-progress)
	Event string `json:"event,omitempty"`
}

Jump to

Keyboard shortcuts

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