apivideosdk

package module
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

README

api.video Golang SDK

The api.video web-service helps you put video on the web without the hassle. This documentation helps you use the corresponding Golang client.

Installation

go get github.com/darkfoxs96/go-sdk

Quick Start

For a more advanced usage you can checkout the rest of the documentation in the docs directory

package main

import (
	"fmt"
	"os"

	apivideosdk "github.com/darkfoxs96/go-sdk"
)

func main() {
    //Connect to production environment
    client := apivideosdk.NewClient(os.Getenv("API_VIDEO_KEY"))

    //Alternatively, connect to the sandbox environment for testing
    client := apivideosdk.NewSandboxClient(os.Getenv("API_VIDEO_SANDBOX_KEY"))

    //List Videos
    //First create the url options for searching
    opts := &apivideosdk.VideoOpts{
        CurrentPage: 1,
        PageSize: 25,
        SortBy:    "publishedAt",
        SortOrder: "desc",
    }

    //Then call the List endpoint with the options
    result, err := client.Videos.List(opts)
    
    if err != nil {
        fmt.Println(err)
    }

    for _, video := range result.Data {
        fmt.Printf("%s\n", video.VideoID)
        fmt.Printf("%s\n", video.Title)
    }

    //Upload a video
    //First create a container
    videoRequest := &apivideosdk.VideoRequest{
        Title: "My video title",
    }
    newVideo, err := client.Videos.Create(videoRequest)
    if err != nil {
        fmt.Println(err)
    }

    //Then upload your video to the container with the videoID
    uploadedVideo, err := client.Videos.Upload(newVideo.VideoID, "path/to/video.mp4")
    if err != nil {
        fmt.Println(err)
    }

    //And get the assets
    fmt.Printf("%s\n", uploadedVideo.Assets.Hls)
    fmt.Printf("%s\n", uploadedVideo.Assets.Iframe)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Quota    *Quota   `json:"quota,omitempty"`
	Features []string `json:"features,omitempty"`
}

Account represents an api.video Account

type AccountService

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

AccountService communicating with the Account endpoints of the api.video API

func (*AccountService) Get

func (s *AccountService) Get() (*Account, error)

Get returns an Account

type AccountServiceI

type AccountServiceI interface {
	Get() (*Account, error)
}

AccountServiceI is an interface representing the Account endpoints of the api.video API See: https://docs.api.video/5.1/captions

type Assets

type Assets struct {
	Hls       string `json:"hls,omitempty"`
	Iframe    string `json:"iframe,omitempty"`
	Player    string `json:"player,omitempty"`
	Thumbnail string `json:"thumbnail,omitempty"`
	Mp4       string `json:"mp4,omitempty"`
}

Assets represents Video assets

type Caption

type Caption struct {
	URI     string `json:"uri,omitempty"`
	Src     string `json:"src,omitempty"`
	Srclang string `json:"srclang,omitempty"`
	Default bool   `json:"default,omitempty"`
}

Caption represents an api.video Caption

type CaptionList

type CaptionList struct {
	Data       []Caption   `json:"data,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

CaptionList represents a list of captions

type CaptionRequest

type CaptionRequest struct {
	Default bool `json:"default"`
}

CaptionRequest represents a request to update a Caption

type CaptionsService

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

CaptionsService communicating with the Captions endpoints of the api.video API

func (*CaptionsService) Delete

func (s *CaptionsService) Delete(videoID string, language string) error

Delete a caption

func (*CaptionsService) Get

func (s *CaptionsService) Get(videoID string, language string) (*Caption, error)

Get returns a Caption by video id and language

func (*CaptionsService) List

func (s *CaptionsService) List(videoID string) (*CaptionList, error)

List returns a slice of Caption containing all captions for a videoId

func (*CaptionsService) Update

func (s *CaptionsService) Update(videoID string, language string, updateRequest *CaptionRequest) (*Caption, error)

Update a video container and returns it

func (*CaptionsService) Upload

func (s *CaptionsService) Upload(videoID string, language string, filePath string) (*Caption, error)

Upload a vtt for a video and language

type CaptionsServiceI

type CaptionsServiceI interface {
	Get(videoID string, language string) (*Caption, error)
	List(videoID string) (*CaptionList, error)
	Upload(videoID string, language string, filepath string) (*Caption, error)
	Update(videoID string, language string, updateRequest *CaptionRequest) (*Caption, error)
	Delete(videoID string, language string) error
}

CaptionsServiceI is an interface representing the Captions endpoints of the api.video API See: https://docs.api.video/5.1/captions

type Chapter

type Chapter struct {
	URI      string `json:"uri,omitempty"`
	Src      string `json:"src,omitempty"`
	Language string `json:"language,omitempty"`
}

Chapter represents an api.video Chapter

type ChapterList

type ChapterList struct {
	Data       []Chapter   `json:"data,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

ChapterList represents a list of chapters

type ChaptersService

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

ChaptersService communicating with the Chapters endpoints of the api.video API

func (*ChaptersService) Delete

func (s *ChaptersService) Delete(videoID string, language string) error

Delete a chapter

func (*ChaptersService) Get

func (s *ChaptersService) Get(videoID string, language string) (*Chapter, error)

Get returns a Chapter by video id and language

func (*ChaptersService) List

func (s *ChaptersService) List(videoID string) (*ChapterList, error)

List returns a slice of Chapter containing all chapters for a videoId

func (*ChaptersService) Upload

func (s *ChaptersService) Upload(videoID string, language string, filePath string) (*Chapter, error)

Upload a vtt for a video and language

type ChaptersServiceI

type ChaptersServiceI interface {
	Get(videoID string, language string) (*Chapter, error)
	List(videoID string) (*ChapterList, error)
	Upload(videoID string, language string, filepath string) (*Chapter, error)
	Delete(videoID string, language string) error
}

ChaptersServiceI is an interface representing the Chapters endpoints of the api.video API See: https://docs.api.video/5.1/chapters

type Client

type Client struct {
	BaseURL *url.URL
	APIKey  string

	Token *Token

	Videos       VideosServiceI
	Livestreams  LivestreamsServiceI
	UploadTokens UploadTokensServiceI
	Captions     CaptionsServiceI
	Chapters     ChaptersServiceI
	Players      PlayersServiceI
	Statistics   StatisticsServiceI
	Account      AccountServiceI
	// contains filtered or unexported fields
}

Client type handles communicating with the api.video API

func NewClient

func NewClient(apiKey string) *Client

NewClient returns a new api.video API client for production

func NewSandboxClient

func NewSandboxClient(apiKey string) *Client

NewSandboxClient returns a new api.video API client for sandbox environment

func (*Client) ChunkSize

func (c *Client) ChunkSize(size int64)

ChunkSize cganges chunk size for video upload, by default its 180MB

type Device

type Device struct {
	Type   string `json:"type,omitempty"`
	Vendor string `json:"vendor,omitempty"`
	Model  string `json:"model,omitempty"`
}

Device represents a Device

type Encoding

type Encoding struct {
	Playable  bool `json:"playable,omitempty"`
	Qualities []Quality
	Metadata  *EncodingMetadata
}

Encoding represents the encoding status of one video

type EncodingMetadata

type EncodingMetadata struct {
	Width       int    `json:"width,omitempty"`
	Height      int    `json:"height,omitempty"`
	Bitrate     int    `json:"bitrate,omitempty"`
	Duration    int    `json:"duration,omitempty"`
	Framerate   int    `json:"framerate,omitempty"`
	Samplerate  int    `json:"samplerate,omitempty"`
	VideoCodec  string `json:"videoCodec,omitempty"`
	AudioCodec  string `json:"audioCodec,omitempty"`
	AspectRatio string `json:"aspectRatio,omitempty"`
}

EncodingMetadata represents a encoding metadata

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Type     string `json:"type"`
	Title    string `json:"title"`
	Name     string `json:"name"`
}

ErrorResponse contains an error from the api.video API

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Ingest

type Ingest struct {
	Status        string              `json:"status,omitempty"`
	Filesize      int                 `json:"filesize,omitempty"`
	ReceivedBytes []ReceivedBytesItem `json:"receivedBytes,omitempty"`
}

Ingest represents the ingest status of one video

type Link struct {
	Rel string `json:"rel,omitempty"`
	URI string `json:"uri,omitempty"`
}

Link represents a link

type Livestream

type Livestream struct {
	LivestreamID string  `json:"liveStreamId,omitempty"`
	Name         string  `json:"name,omitempty"`
	StreamKey    string  `json:"streamKey,omitempty"`
	Record       bool    `json:"record,omitempty"`
	Assets       *Assets `json:"assets,omitempty"`
	PlayerID     string  `json:"playerId,omitempty"`
	Broadcasting bool    `json:"broadcasting,omitempty"`
}

Livestream represents an api.video Livestream

type LivestreamList

type LivestreamList struct {
	Data       []Livestream `json:"data,omitempty"`
	Pagination *Pagination  `json:"pagination,omitempty"`
}

LivestreamList represents a list of livestream

type LivestreamOpts

type LivestreamOpts struct {
	CurrentPage int    `url:"currentPage,omitempty"`
	PageSize    int    `url:"pageSize,omitempty"`
	StreamKey   string `url:"streamKey,omitempty"`
}

LivestreamOpts represents a query string to search on livestreams

type LivestreamRequest

type LivestreamRequest struct {
	Name     string `json:"name,omitempty"`
	Record   bool   `json:"record"`
	PlayerID string `json:"playerId,omitempty"`
}

LivestreamRequest represents a request to create / update a Livestream

type LivestreamsService

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

LivestreamsService communicating with the Livestream endpoints of the api.video API

func (*LivestreamsService) Create

func (s *LivestreamsService) Create(createRequest *LivestreamRequest) (*Livestream, error)

Create a livestream container and returns it

func (*LivestreamsService) Delete

func (s *LivestreamsService) Delete(livestreamID string) error

Delete a livestream container

func (*LivestreamsService) DeleteThumbnail

func (s *LivestreamsService) DeleteThumbnail(livestreamID string) (*Livestream, error)

DeleteThumbnail upload the thumbnail of a livestream

func (*LivestreamsService) Get

func (s *LivestreamsService) Get(livestreamID string) (*Livestream, error)

Get returns a Livestream by id

func (*LivestreamsService) List

List returns a LivestreamList containing all livestreams

func (*LivestreamsService) Update

func (s *LivestreamsService) Update(livestreamID string, updateRequest *LivestreamRequest) (*Livestream, error)

Update a video container and returns it

func (*LivestreamsService) UploadThumbnail

func (s *LivestreamsService) UploadThumbnail(livestreamID string, filePath string) (*Livestream, error)

UploadThumbnail upload the thumbnail of a livestream

type LivestreamsServiceI

type LivestreamsServiceI interface {
	Get(livestreamID string) (*Livestream, error)
	List(opts *LivestreamOpts) (*LivestreamList, error)
	Create(createRequest *LivestreamRequest) (*Livestream, error)
	Update(livestreamID string, updateRequest *LivestreamRequest) (*Livestream, error)
	Delete(livestreamID string) error
	UploadThumbnail(livestreamID string, filePath string) (*Livestream, error)
	DeleteThumbnail(livestreamID string) (*Livestream, error)
}

LivestreamsServiceI is an interface representing the Videos endpoints of the api.video API See: https://docs.api.video/5.1/live

type Location

type Location struct {
	Country string `json:"country,omitempty"`
	City    string `json:"city,omitempty"`
}

Location represents a Location

type Metadata

type Metadata struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

Metadata represents a Video metadata

type Os

type Os struct {
	Name      string `json:"name,omitempty"`
	Shortname string `json:"shortname,omitempty"`
	Version   string `json:"version,omitempty"`
}

Os represents a Os

type Pagination

type Pagination struct {
	CurrentPage      int    `json:"currentPage,omitempty"`
	PageSize         int    `json:"pageSize,omitempty"`
	PagesTotal       int    `json:"pagesTotal,omitempty"`
	ItemsTotal       int    `json:"itemsTotal,omitempty"`
	CurrentPageItems int    `json:"currentPageItems,omitempty"`
	Links            []Link `json:"links,omitempty"`
}

Pagination represents a pagination object

type Player

type Player struct {
	PlayerID              string        `json:"playerId,omitempty"`
	ShapeMargin           int           `json:"shapeMargin,omitempty"`
	ShapeRadius           int           `json:"shapeRadius,omitempty"`
	ShapeAspect           string        `json:"shapeAspect,omitempty"`
	ShapeBackgroundTop    string        `json:"shapeBackgroundTop,omitempty"`
	ShapeBackgroundBottom string        `json:"shapeBackgroundBottom,omitempty"`
	Text                  string        `json:"text,omitempty"`
	Link                  string        `json:"link,omitempty"`
	LinkHover             string        `json:"linkHover,omitempty"`
	LinkActive            string        `json:"linkActive,omitempty"`
	TrackPlayed           string        `json:"trackPlayed,omitempty"`
	TrackUnplayed         string        `json:"trackUnplayed,omitempty"`
	TrackBackground       string        `json:"trackBackground,omitempty"`
	BackgroundTop         string        `json:"backgroundTop,omitempty"`
	BackgroundBottom      string        `json:"backgroundBottom,omitempty"`
	BackgroundText        string        `json:"backgroundText,omitempty"`
	EnableAPI             bool          `json:"enableApi,omitempty"`
	EnableControls        bool          `json:"enableControls,omitempty"`
	ForceAutoplay         bool          `json:"forceAutoplay,omitempty"`
	HideTitle             bool          `json:"hideTitle,omitempty"`
	ForceLoop             bool          `json:"forceLoop,omitempty"`
	Assets                *PlayerAssets `json:"assets,omitempty"`
}

Player represents an api.video Player

type PlayerAssets

type PlayerAssets struct {
	Link string `json:"link,omitempty"`
}

PlayerAssets represents ths assets of a Player

type PlayerList

type PlayerList struct {
	Data       []Player    `json:"data,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

PlayerList represents a list of player

type PlayerOpts

type PlayerOpts struct {
	CurrentPage int `url:"currentPage,omitempty"`
	PageSize    int `url:"pageSize,omitempty"`
}

PlayerOpts represents a query string to search on players

type PlayerRequest

type PlayerRequest struct {
	ShapeMargin           int    `json:"shapeMargin,omitempty"`
	ShapeRadius           int    `json:"shapeRadius,omitempty"`
	ShapeAspect           string `json:"shapeAspect,omitempty"`
	ShapeBackgroundTop    string `json:"shapeBackgroundTop,omitempty"`
	ShapeBackgroundBottom string `json:"shapeBackgroundBottom,omitempty"`
	Text                  string `json:"text,omitempty"`
	Link                  string `json:"link,omitempty"`
	LinkHover             string `json:"linkHover,omitempty"`
	LinkActive            string `json:"linkActive,omitempty"`
	TrackPlayed           string `json:"trackPlayed,omitempty"`
	TrackUnplayed         string `json:"trackUnplayed,omitempty"`
	TrackBackground       string `json:"trackBackground,omitempty"`
	BackgroundTop         string `json:"backgroundTop,omitempty"`
	BackgroundBottom      string `json:"backgroundBottom,omitempty"`
	BackgroundText        string `json:"backgroundText,omitempty"`
	EnableAPI             bool   `json:"enableApi"`
	EnableControls        bool   `json:"enableControls"`
	ForceAutoplay         bool   `json:"forceAutoplay"`
	HideTitle             bool   `json:"hideTitle"`
	ForceLoop             bool   `json:"forceLoop"`
}

PlayerRequest represents a request to create / update a Player

type PlayersService

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

PlayersService communicating with the Players endpoints of the api.video API

func (*PlayersService) Create

func (s *PlayersService) Create(createRequest *PlayerRequest) (*Player, error)

Create a player and returns it

func (*PlayersService) Delete

func (s *PlayersService) Delete(playerID string) error

Delete a player

func (s *PlayersService) DeleteLogo(playerID string) error

DeleteLogo delete a player logo

func (*PlayersService) Get

func (s *PlayersService) Get(PlayerID string) (*Player, error)

Get returns a Player by id

func (*PlayersService) List

func (s *PlayersService) List(opts *PlayerOpts) (*PlayerList, error)

List returns a PlayerList containing all players

func (*PlayersService) Update

func (s *PlayersService) Update(playerID string, updateRequest *PlayerRequest) (*Player, error)

Update a player and returns it

func (s *PlayersService) UploadLogo(playerID string, link string, filePath string) (*Player, error)

UploadLogo upload the logo of a player

type PlayersServiceI

type PlayersServiceI interface {
	Get(playerID string) (*Player, error)
	List(opts *PlayerOpts) (*PlayerList, error)
	Create(createRequest *PlayerRequest) (*Player, error)
	Update(playerID string, updateRequest *PlayerRequest) (*Player, error)
	Delete(playerID string) error
}

PlayersServiceI is an interface representing the Players endpoints of the api.video API See: https://docs.api.video/5.1/players

type Quality

type Quality struct {
	Quality string `json:"quality,omitempty"`
	Status  string `json:"status,omitempty"`
}

Quality represents a quality

type Quota

type Quota struct {
	QuotaUsed      int `json:"quotaUsed,omitempty"`
	QuotaRemaining int `json:"quotaRemaining,omitempty"`
	QuotaTotal     int `json:"quotaTotal,omitempty"`
}

Quota represents a Quota

type ReceivedBytesItem

type ReceivedBytesItem struct {
	To    int `json:"to,omitempty"`
	From  int `json:"from,omitempty"`
	Total int `json:"total,omitempty"`
}

ReceivedBytesItem represents a received bytes item

type Referrer

type Referrer struct {
	URL        string `json:"url,omitempty"`
	Medium     string `json:"medium,omitempty"`
	Source     string `json:"source,omitempty"`
	SearchTerm string `json:"searchTerm,omitempty"`
}

Referrer represents a Referrer

type SessClient

type SessClient struct {
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

SessClient represents a SessClient

type Session

type Session struct {
	SessionID string            `json:"sessionId,omitempty"`
	LoadedAt  string            `json:"loadedAt,omitempty"`
	EndedAt   string            `json:"endedAt,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

Session represents a Session

type SessionEvent

type SessionEvent struct {
	Type      string `json:"type,omitempty"`
	EmittedAt string `json:"emittedAt,omitempty"`
	At        int    `json:"at,omitempty"`
	From      int    `json:"from,omitempty"`
	To        int    `json:"to,omitempty"`
}

SessionEvent represents a SessionEvent

type SessionEventList

type SessionEventList struct {
	Data       []SessionEvent `json:"data,omitempty"`
	Pagination *Pagination    `json:"pagination,omitempty"`
}

SessionEventList represents a SessionEventList

type SessionEventOpts

type SessionEventOpts struct {
	CurrentPage int `url:"currentPage,omitempty"`
	PageSize    int `url:"pageSize,omitempty"`
}

SessionEventOpts represents a query string to search on sessions

type SessionLivestreamOpts

type SessionLivestreamOpts struct {
	CurrentPage int    `url:"currentPage,omitempty"`
	PageSize    int    `url:"pageSize,omitempty"`
	Period      string `url:"period,omitempty"`
}

SessionLivestreamOpts represents a query string to search on livestream statistics

type SessionVideoOpts

type SessionVideoOpts struct {
	CurrentPage int               `url:"currentPage,omitempty"`
	PageSize    int               `url:"pageSize,omitempty"`
	Period      string            `url:"period,omitempty"`
	Metadata    map[string]string `url:"-"`
}

SessionVideoOpts represents a query string to search on videos statistics

type Source

type Source struct {
	URI        string           `json:"uri,omitempty"`
	Type       string           `json:"type,omitempty"`
	Livestream *VideoLivestream `json:"livestream,omitempty"`
}

Source represents a Video source

type Statistic

type Statistic struct {
	Session    *Session    `json:"session,omitempty"`
	Location   *Location   `json:"location,omitempty"`
	Referrer   *Referrer   `json:"referrer,omitempty"`
	Device     *Device     `json:"device,omitempty"`
	Os         *Os         `json:"os,omitempty"`
	SessClient *SessClient `json:"client,omitempty"`
}

Statistic represents a Statistic

type StatisticList

type StatisticList struct {
	Data       []Statistic `json:"data,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

StatisticList represents a list of staticics

type StatisticsService

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

StatisticsService communicating with the Statistics endpoints of the api.video API

func (*StatisticsService) GetLivestreamSessions

func (s *StatisticsService) GetLivestreamSessions(livestreamID string, opts *SessionLivestreamOpts) (*StatisticList, error)

GetLivestreamSessions returns a StatisticList containing all sessions for a video

func (*StatisticsService) GetSessionEvents

func (s *StatisticsService) GetSessionEvents(sessionID string, opts *SessionEventOpts) (*SessionEventList, error)

GetSessionEvents returns a StatisticList containing all stats for one session

func (*StatisticsService) GetVideoSessions

func (s *StatisticsService) GetVideoSessions(videoID string, opts *SessionVideoOpts) (*StatisticList, error)

GetVideoSessions returns a StatisticList containing all sessions for a video

type StatisticsServiceI

type StatisticsServiceI interface {
	GetVideoSessions(videoID string, opts *SessionVideoOpts) (*StatisticList, error)
	GetLivestreamSessions(LivestreamID string, opts *SessionLivestreamOpts) (*StatisticList, error)
	GetSessionEvents(SessionID string, opts *SessionEventOpts) (*SessionEventList, error)
}

StatisticsServiceI is an interface representing the Players endpoints of the api.video API See: https://docs.api.video/5.1/players

type Token

type Token struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
	ExpireTime   time.Time
}

Token contains token for connecting to the api.video API

type UploadFileReader

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

func (*UploadFileReader) Init

func (r *UploadFileReader) Init(file io.Reader, filePartWriter io.Writer, formWriter *multipart.Writer)

func (*UploadFileReader) Read

func (r *UploadFileReader) Read(p []byte) (n int, err error)

func (*UploadFileReader) Write

func (r *UploadFileReader) Write(p []byte) (n int, err error)

type UploadToken

type UploadToken struct {
	Token string `json:"token,omitempty"`
}

UploadToken represents an api.video UploadToken

type UploadTokensService

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

UploadTokensService communicating with the Upload Tokens endpoints of the api.video API

func (*UploadTokensService) Generate

func (s *UploadTokensService) Generate() (*UploadToken, error)

Generate returns a new generated UploadToken

type UploadTokensServiceI

type UploadTokensServiceI interface {
	Generate() (*UploadToken, error)
}

UploadTokensServiceI is an interface representing the Upload Tokens endpoints of the api.video API See: https://docs.api.video/5.1/videos-delegated-upload

type Video

type Video struct {
	VideoID     string     `json:"videoId,omitempty"`
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	PublishedAt string     `json:"publishedAt,omitempty"`
	UpdatedAt   string     `json:"updatedAt,omitempty"`
	Tags        []string   `json:"tags,omitempty"`
	Metadata    []Metadata `json:"metadata,omitempty"`
	Source      *Source    `json:"source,omitempty"`
	Assets      *Assets    `json:"assets,omitempty"`
	PlayerID    string     `json:"playerId,omitempty"`
	Public      bool       `json:"public,omitempty"`
	Panoramic   bool       `json:"panoramic,omitempty"`
	Mp4Support  bool       `json:"mp4Support,omitempty"`
}

Video represents an api.video Video

type VideoList

type VideoList struct {
	Data       []Video     `json:"data,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

VideoList represents a list of videos

type VideoLivestream

type VideoLivestream struct {
	LivestreamID string `json:"livestreamId,omitempty"`
	Links        []Link `json:"links,omitempty"`
}

VideoLivestream represents a Video livestream

type VideoOpts

type VideoOpts struct {
	CurrentPage  int               `url:"currentPage,omitempty"`
	PageSize     int               `url:"pageSize,omitempty"`
	SortBy       string            `url:"sortBy,omitempty"`
	SortOrder    string            `url:"sortOrder,omitempty"`
	Title        string            `url:"title,omitempty"`
	Tags         []string          `url:"tags,brackets,omitempty"`
	Description  string            `url:"description,omitempty"`
	LivestreamID string            `url:"livestreamId,omitempty"`
	Metadata     map[string]string `url:"-"`
}

VideoOpts represents a query string to search on videos

type VideoRequest

type VideoRequest struct {
	Title       string     `json:"title,omitempty"`
	Description string     `json:"description,omitempty"`
	Tags        []string   `json:"tags,omitempty"`
	Metadata    []Metadata `json:"metadata,omitempty"`
	Source      string     `json:"source,omitempty"`
	PlayerID    string     `json:"playerId,omitempty"`
	Public      bool       `json:"public,omitempty"`
	Panoramic   bool       `json:"panoramic"`
	Mp4Support  bool       `json:"mp4Support"`
}

VideoRequest represents a request to create / update a Video

type VideoStatus

type VideoStatus struct {
	Ingest   *Ingest   `json:"ingest,omitempty"`
	Encoding *Encoding `json:"encoding,omitempty"`
}

VideoStatus represents the encoding status of one video

type VideosService

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

VideosService communicating with the Videos endpoints of the api.video API

func (*VideosService) Create

func (s *VideosService) Create(createRequest *VideoRequest) (*Video, error)

Create a video container and returns it

func (*VideosService) Delete

func (s *VideosService) Delete(videoID string) error

Delete a video container

func (*VideosService) Get

func (s *VideosService) Get(videoID string) (*Video, error)

Get returns a Video by id

func (*VideosService) List

func (s *VideosService) List(opts *VideoOpts) (*VideoList, error)

List returns a VideoList containing all videos matching VideoOpts

func (*VideosService) PickThumbnail

func (s *VideosService) PickThumbnail(videoID string, timecode string) (*Video, error)

PickThumbnail change the thumbnail of a video with a timecode

func (*VideosService) Status

func (s *VideosService) Status(videoID string) (*VideoStatus, error)

Status returns the status of encoding and ingest of a video

func (*VideosService) Update

func (s *VideosService) Update(videoID string, updateRequest *VideoRequest) (*Video, error)

Update a video container and returns it

func (*VideosService) Upload

func (s *VideosService) Upload(videoID string, filePath string) (*Video, error)

Upload a video in a container. The upload is chuncked if the file size is more than 128MB

func (*VideosService) UploadFromRequest

func (s *VideosService) UploadFromRequest(videoID string, file io.Reader, fileName string, fileSize int64, ctx context.Context) (*Video, error)

func (*VideosService) UploadThumbnail

func (s *VideosService) UploadThumbnail(videoID string, filePath string) (*Video, error)

UploadThumbnail upload the thumbnail of a video

type VideosServiceI

type VideosServiceI interface {
	Get(videoID string) (*Video, error)
	List(opts *VideoOpts) (*VideoList, error)
	Create(createRequest *VideoRequest) (*Video, error)
	Update(videoID string, updateRequest *VideoRequest) (*Video, error)
	Delete(videoID string) error
	Upload(videoID string, filePath string) (*Video, error)
	UploadFromRequest(videoID string, file io.Reader, fileName string, fileSize int64, ctx context.Context) (*Video, error)
	Status(videoID string) (*VideoStatus, error)
	PickThumbnail(videoID string, timecode string) (*Video, error)
	UploadThumbnail(videoID string, filePath string) (*Video, error)
}

VideosServiceI is an interface representing the Videos endpoints of the api.video API See: https://docs.api.video/5.1/videos

Jump to

Keyboard shortcuts

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