Documentation ¶
Index ¶
Constants ¶
View Source
const ( // BaseUri is the main url to the api. BaseUri = "https://ws.api.video" // ApiKeyPath is the path for the authentication. ApiKeyPath = "/auth/api-key" // RefreshPath is the path for the token refresh. RefreshPath = "/auth/refresh" )
View Source
const (
// VideosPath is the path for creating videos.
VideosPath = "/videos"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResponse ¶
type AuthResponse struct { TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` }
AuthResponse is the model of the authentication and refresh responses.
type Client ¶
type Client struct { // Username stands for the email you used to register your account. Username string // Password stands for the api token you received in the registration email. Password string // BaseUri should always be the constant BaseUrl. BaseUri string // TokenType is provided inside the response to the authentication. TokenType string // ExpiresIn is provided inside the response to the authentication, it is the timeout for the AccessToken. ExpiresIn time.Time // AccessToken is provided inside the response to the authentication, it is used to make requests to the api. AccessToken string // RefreshToken is provided inside the response to the authentication, it is used to update the AccessToken when- // expired. RefreshToken string }
Client is the instance that is used to communicate with the api.
func LoadClientFromEnv ¶
func LoadClientFromEnv() *Client
LoadClientFromEnv creates a Client instance with input from env.
func (*Client) Authenticate ¶
Authenticate has to be executed in order to use the api, it authenticates the client to get the token.
func (*Client) CreateVideo ¶
func (c *Client) CreateVideo(u *UploadVideo, fromSource bool) (*Video, error)
CreateVideo creates a new video using the client.
type UploadVideo ¶
type UploadVideo struct { Title string `json:"title"` Description string `json:"description"` Tags []string `json:"tags"` Metadata []struct { Key string `json:"key"` Value string `json:""` } `json:"metadata"` Public bool `json:"public"` Source string `json:"source"` PlayerId string `json:"playerId"` }
UploadVideo is the model of the post form that is sent to the api when creating a new video.
func (*UploadVideo) ToJson ¶
func (u *UploadVideo) ToJson() (string, error)
ToJson converts the UploadVideo type to a json encoded string.
type Video ¶
type Video struct { VideoId string `json:"videoId"` PlayerId string `json:"playerId"` Title string `json:"title"` Description string `json:"description"` Public bool `json:"public"` Tags []string `json:"tags"` Metadata []struct { Key string `json:"key"` Value string `json:""` } `json:"metadata"` PublishedAt string `json:"publishedAt"` Source struct { Uri string `json:"uri"` } `json:"source"` Assets struct { Iframe string `json:"iframe"` Player string `json:"player"` Hls string `json:"hls"` Thumbnail string `json:"thumbnail"` } `json:"assets"` }
Video is the model for the response received from the api.
Click to show internal directories.
Click to hide internal directories.