# 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)
}
# Functions
NewClient returns a new api.video API client for production.
NewSandboxClient returns a new api.video API client for sandbox environment.
# Structs
Account represents an api.video Account.
AccountService communicating with the Account endpoints of the api.video API.
Assets represents Video assets.
Caption represents an api.video Caption.
CaptionList represents a list of captions.
CaptionRequest represents a request to update a Caption.
CaptionsService communicating with the Captions endpoints of the api.video API.
Chapter represents an api.video Chapter.
ChapterList represents a list of chapters.
ChaptersService communicating with the Chapters endpoints of the api.video API.
Client type handles communicating with the api.video API.
Device represents a Device.
Encoding represents the encoding status of one video.
EncodingMetadata represents a encoding metadata.
ErrorResponse contains an error from the api.video API.
Ingest represents the ingest status of one video.
Link represents a link.
Livestream represents an api.video Livestream.
LivestreamList represents a list of livestream.
LivestreamOpts represents a query string to search on livestreams.
LivestreamRequest represents a request to create / update a Livestream.
LivestreamsService communicating with the Livestream endpoints of the api.video API.
Location represents a Location.
Metadata represents a Video metadata.
Os represents a Os.
Pagination represents a pagination object.
Player represents an api.video Player.
PlayerAssets represents ths assets of a Player.
PlayerList represents a list of player.
PlayerOpts represents a query string to search on players.
PlayerRequest represents a request to create / update a Player.
PlayersService communicating with the Players endpoints of the api.video API.
Quality represents a quality.
Quota represents a Quota.
ReceivedBytesItem represents a received bytes item.
Referrer represents a Referrer.
SessClient represents a SessClient.
Session represents a Session.
SessionEvent represents a SessionEvent.
SessionEventList represents a SessionEventList.
SessionEventOpts represents a query string to search on sessions.
SessionLivestreamOpts represents a query string to search on livestream statistics.
SessionVideoOpts represents a query string to search on videos statistics.
Source represents a Video source.
Statistic represents a Statistic.
StatisticList represents a list of staticics.
StatisticsService communicating with the Statistics endpoints of the api.video API.
Token contains token for connecting to the api.video API.
No description provided by the author
UploadToken represents an api.video UploadToken.
UploadTokensService communicating with the Upload Tokens endpoints of the api.video API.
Video represents an api.video Video.
VideoList represents a list of videos.
VideoLivestream represents a Video livestream.
VideoOpts represents a query string to search on videos.
VideoRequest represents a request to create / update a Video.
VideosService communicating with the Videos endpoints of the api.video API.
VideoStatus represents the encoding status of one video.
# Interfaces
AccountServiceI is an interface representing the Account endpoints of the api.video API See: https://docs.api.video/5.1/captions.
CaptionsServiceI is an interface representing the Captions endpoints of the api.video API See: https://docs.api.video/5.1/captions.
ChaptersServiceI is an interface representing the Chapters endpoints of the api.video API See: https://docs.api.video/5.1/chapters.
LivestreamsServiceI is an interface representing the Videos endpoints of the api.video API See: https://docs.api.video/5.1/live.
PlayersServiceI is an interface representing the Players endpoints of the api.video API See: https://docs.api.video/5.1/players.
StatisticsServiceI is an interface representing the Players endpoints of the api.video API See: https://docs.api.video/5.1/players.
UploadTokensServiceI is an interface representing the Upload Tokens endpoints of the api.video API See: https://docs.api.video/5.1/videos-delegated-upload.
VideosServiceI is an interface representing the Videos endpoints of the api.video API See: https://docs.api.video/5.1/videos.