threeqgo

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 13 Imported by: 0

README

threeq-go

A 3Q Golang Client. This is a lightweight (no dependencies) 3Q API v2 Go/Golang client.

3Q SDN API Documentation: https://sdn.3qsdn.com/api/doc 3Q SDN Open API Spec: https://sdn.3qsdn.com/api/doc.json

Installation

Run go get github.com/RayFinney/threeq-go to install the client.

Endpoints implemeted

  • 01.00 Welcome
  • 01.01 ApiKey
  • 02.00 Projects
  • 02.01 Project - Custom Metadata Definitions
  • 02.02 Project - FileEncoders
  • 02.03 Project - FileEncoderPipeline
  • 03.00 Channels
  • 03.01 Channel - Picture
  • 03.02 Channel - Metadata
  • 03.03 Channel - Ingest
  • 03.03 Channel - Input (Deprecated)
  • 03.04 Channel - Output
  • 03.05 Channel - Embed
  • 03.06 Channel - Transcoder
  • 03.07 Channel - Distribution
  • 03.08 Channel - Timeshift2VoD
  • 03.09 Channel - Recorder
  • 03.10 Channel - Purge Timeshift
  • 04.00 Files
  • 04.01 File - Metadata
  • 04.02 File - Metadata - Categories
  • 04.03 File - Metadata - Videotype
  • 04.04 File - Playout
  • 04.05 File - Output
  • 04.06 File - Picture
  • 04.07 File - SubTitle
  • 04.08 File - Most viewed
  • 04.09 File - Merge files
  • 04.10 File - Video intelligence Output
  • 04.11 File - Encoding Progress
  • 04.12 File - Metadata by ProgrammId
  • 04.13 File - Text2Speech
  • 04.14 File - Release Status
  • 05.00 Categories
  • 06.00 Podcasts
  • 06.01 Podcast-Episodes
  • 07.00 Reporting - Project
  • 07.01 Reporting - File
  • 07.02 Reporting - User
  • 07.03 Reporting - Country, Device
  • 08.00 Playlists
  • 09.00 Analytics - Dashboard
  • 09.01 Analytics - Audience
  • 09.02 Analytics - Audience Video
  • 09.03 Analytics - Devices
  • 09.04 Analytics - Locations
  • 09.05 Analytics - Ads
  • 09.06 Analytics - UserToken overview
  • 10.00 Services - Configuration
  • 10.01 Services - User-Playlists
  • 11.00 Usage
  • 11.01 Usage by Project
  • 11.02 Usage - Bandwidth
  • 12.00 Alerts / Webhooks

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StreamTypeVideoOnDemand, StreamTypeLivestream int64 = 1, 2

Functions

func EscapeQuotes added in v0.2.0

func EscapeQuotes(s string) string

Types

type AiconixJobType added in v0.2.0

type AiconixJobType struct {
	ID             int64  `json:"Id"`
	AIFunction     string `json:"AIFunction"`     // blockdetection, keywords, labeldetection, objecttracking, shotdetection, speechtotext, contentmoderation, emotion, facedetection, facialattributes, iabcategories, landmarks, ocr, persontracking
	AIResultType   string `json:"AIResultType"`   // rawresult, bestresult
	SourceLanguage string `json:"SourceLanguage"` // ISO-639-2/b (three-letter codes) Language Code
	TranslateTo    string `json:"TranslateTo"`    // ISO-639-2/b (three-letter codes) Language Code
}

type Category

type Category struct {
	ID       int64  `json:"Id"`
	Label    string `json:"Label"`
	CustomId string `json:"CustomId"`
	ThumbURI string `json:"ThumbURI"`
}

type Channel

type Channel struct {
	ID            int64           `json:"Id"`
	ChannelStatus []ChannelStatus `json:"ChannelStatus"`
	Project       Project         `json:"Project"`
}

type ChannelStatus

type ChannelStatus struct {
	IsOnline     bool   `json:"IsOnline"`
	IsPrimary    bool   `json:"IsPrimary"`
	Origin       string `json:"Origin"`
	VideoFormat  string `json:"VideoFormat"`
	VideoBitRate int64  `json:"VideoBitRate"`
	VideoWidth   int64  `json:"VideoWidth"`
	VideoHeight  int64  `json:"VideoHeight"`
	AudioFormat  string `json:"AudioFormat"`
	AudioBitRate int64  `json:"AudioBitRate"`
}

type ChannelsResponse

type ChannelsResponse struct {
	Channels []Channel `json:"Channels"`
}

type EncodingProgress

type EncodingProgress struct {
	ID               int64   `json:"Id"`
	Format           string  `json:"Format"`
	FPS              float64 `json:"FPS"`
	RealTime         int64   `json:"RealTime"`
	EncodingProgress int64   `json:"EncodingProgress"`
	UploadProgress   int64   `json:"UploadProgress"`
	HasErrors        bool    `json:"HasErrors"`
	IsFinished       bool    `json:"IsFinished"`
	IsStored         bool    `json:"IsStored"`
}

type File

type File struct {
	ID               int64          `json:"Id"`
	Name             string         `json:"Name"`
	IsFinished       bool           `json:"IsFinished"`
	IsEncoding       bool           `json:"IsEncoding"`
	UseEncoding      bool           `json:"UseEncoding"`
	EncodingPriority int64          `json:"EncodingPriority"`
	HasErrors        bool           `json:"HasErrors"`
	ErrorMessage     string         `json:"ErrorMessage"`
	Properties       FileProperties `json:"Properties"`
	MetaData         MetaData       `json:"MetaData"`
	Playouts         []struct {
		Playout Playout `json:"Playout"`
	} `json:"Playouts"`
	CreatedAt    time.Time `json:"CreatedAt"`
	LastUpdateAt time.Time `json:"LastUpdateAt"`
}

type FileCreate

type FileCreate struct {
}

type FileEncoderSettingsUpdate added in v0.2.0

type FileEncoderSettingsUpdate struct {
	UseEncoding             bool     `json:"UseEncoding"`
	UseCMAF                 bool     `json:"UseCMAF"`
	UsePremiumEncoding      bool     `json:"UsePremiumEncoding"`
	UsePreProcessing        bool     `json:"UsePreProcessing"`
	UseAIServices           bool     `json:"UseAIServices"`
	GenerateSubtitles       bool     `json:"GenerateSubtitles"`
	SourceLanguage          string   `json:"SourceLanguage,omitempty"`
	SubtitleTranslation     []string `json:"SubtitleTranslation,omitempty"`
	UseDeinterlace          bool     `json:"UseDeinterlace"`
	UseTwoPass              bool     `json:"UseTwoPass"`
	UseBPFrames             bool     `json:"UseBPFrames"`
	UseCropping             bool     `json:"UseCropping"`
	CroppingParameters      string   `json:"CroppingParameters,omitempty"`
	NormalizeAudio          bool     `json:"NormalizeAudio"`
	UseFirstAudioTrack      bool     `json:"UseFirstAudioTrack"`
	UseAllAudioTracks       bool     `json:"UseAllAudioTracks"`
	PackageAudioOnlyVariant bool     `json:"PackageAudioOnlyVariant"`
	PackageForDRM           bool     `json:"PackageForDRM"`
	WatermarkPosition       string   `json:"WatermarkPosition"` // top-left, top-right, bottom-left, bottom-right
	UseWatermark            bool     `json:"UseWatermark"`
}

type FileEncodingSetting added in v0.2.0

type FileEncodingSetting struct {
	UseEncoding             bool             `json:"UseEncoding"`
	UsePremiumEncoding      bool             `json:"UsePremiumEncoding"`
	UsePreProcessing        bool             `json:"UsePreProcessing"`
	UseAIServices           bool             `json:"UseAIServices"`
	ISOLanguageCode         string           `json:"ISOLanguageCode"`
	GenerateSubtitles       bool             `json:"GenerateSubtitles"`
	UseDeinterlace          bool             `json:"UseDeinterlace"`
	UseTwoPass              bool             `json:"UseTwoPass"`
	UseCMAF                 bool             `json:"UseCMAF"`
	UseBPFrames             bool             `json:"UseBPFrames"`
	PackageAudioOnlyVariant bool             `json:"PackageAudioOnlyVariant"`
	PackageForDRM           bool             `json:"PackageForDRM"`
	UseWatermark            bool             `json:"UseWatermark"`
	WatermarkURI            string           `json:"WatermarkURI"`
	WatermarkPosition       string           `json:"WatermarkPosition"` // top-left, top-right, bottom-left, bottom-right
	UseCropping             bool             `json:"UseCropping"`
	CroppingParameters      string           `json:"CroppingParameters"`
	NormalizeAudio          bool             `json:"NormalizeAudio"`
	UseFirstAudioTrack      bool             `json:"UseFirstAudioTrack"`
	UseAllAudioTracks       bool             `json:"UseAllAudioTracks"`
	FileFormats             []FileFormat     `json:"FileFormats"`
	AIFunctions             []AiconixJobType `json:"AIFunctions"`
}

type FileFormat added in v0.2.0

type FileFormat struct {
	FileFormatID    int64   `json:"FileFormatId"`
	Label           string  `json:"Label"`
	MIMEType        string  `json:"MIME-Type"`
	VideoCodec      string  `json:"VideoCodec"`
	VideoHeight     int64   `json:"VideoHeight"`
	VideoBitRate    int64   `json:"VideoBitRate"`
	VideoProfile    string  `json:"VideoProfile"`
	VideoFPS        float64 `json:"VideoFPS"`
	AudioBitRate    int64   `json:"AudioBitRate"`
	AudioSampleRate int64   `json:"AudioSampleRate"`
	AudioChannels   int64   `json:"AudioChannels"`
}

type FileFormatSettings added in v0.2.0

type FileFormatSettings struct {
	FileFormatSettings []FileFormat `json:"FileFormatSettings"`
}

type FileFormatUpdate added in v0.2.0

type FileFormatUpdate struct {
	VideoBitRate    int64   `json:"VideoBitRate"`
	VideoProfile    string  `json:"VideoProfile"`
	VideoFPS        float64 `json:"VideoFPS"`
	AudioBitRate    int64   `json:"AudioBitRate"`
	AudioSampleRate int64   `json:"AudioSampleRate"`
	AudioChannels   int64   `json:"AudioChannels"`
}

type FileProperties

type FileProperties struct {
	Length          float64 `json:"Length"`
	Size            string  `json:"Size"`
	VideoFormat     string  `json:"VideoFormat"`
	VideoBitRate    int64   `json:"VideoBitRate"`
	VideoWidth      int64   `json:"VideoWidth"`
	VideoHeight     int64   `json:"VideoHeight"`
	VideoFPS        float64 `json:"VideoFPS"`
	AudioFormat     string  `json:"AudioFormat"`
	AudioBitRate    int64   `json:"AudioBitRate"`
	AudioSampleRate int64   `json:"AudioSampleRate"`
	AudioChannels   int64   `json:"AudioChannels"`
}

type FileSearchOptions

type FileSearchOptions struct {
	IncludeDeleted    bool
	IncludeMetadata   bool
	IncludePlayouts   bool
	IncludeProperties bool
	ReleaseStatus     string
	OrderBy           string
	Sort              string
	Period            string
	CategoryId        int64
	VideoTypeId       int64
	Offset            int64
	Limit             int64
}

type FileUpdate

type FileUpdate struct {
}

type FilesResponse

type FilesResponse struct {
	Files []File `json:"Files"`
}

type IABCategory

type IABCategory struct {
	ID    int64  `json:"Id"`
	Label string `json:"Label"`
	TABId string `json:"TABId"`
}

type MetaData

type MetaData struct {
	StandardFilePicture    StandardFilePicture `json:"StandardFilePicture"`
	Title                  string              `json:"Title"`
	Description            string              `json:"Description"`
	DisplayTitle           string              `json:"DisplayTitle"`
	DisplayTitleSecondLine string              `json:"DisplayTitleSecondLine"`
	Tags                   string              `json:"Tags"`
	Genre                  string              `json:"Genre"`
	Studio                 string              `json:"Studio"`
	IsPublicAt             time.Time           `json:"IsPublicAt"`
	IsPublicUntil          time.Time           `json:"IsPublicUntil"`
	Category               []Category          `json:"Category"`
	IABCategory            []IABCategory       `json:"IABCategory"`
	Share                  []Share             `json:"Share"`
	Series                 string              `json:"Series"`
	ProductionCountry      string              `json:"ProductionCountry"`
	NativeLanguage         string              `json:"NativeLanguage"`
	ProgramID              string              `json:"ProgramId"`
	Source                 string              `json:"Source"`
	Licensor               string              `json:"Licensor"`
	LicenseArea            string              `json:"LicenseArea"`
	RelationShip           string              `json:"RelationShip"`
	Rating                 float64             `json:"Rating"`
	Latitude               float64             `json:"Latitude"`
	Longitude              float64             `json:"Longitude"`
	VideoType              []VideoType         `json:"VideoType"`
	OriginalFileName       string              `json:"OriginalFileName"`
	Deeplink               string              `json:"Deeplink"`
	MetaPictureURI         string              `json:"MetaPictureURI"`
	CustomMetadata         map[string]string
}

type Playout added in v0.1.0

type Playout struct {
	ID    string `json:"Id"`
	Label string `json:"Label"`
}

type Project

type Project struct {
	ID            int64      `json:"Id"`
	StreamType    StreamType `json:"StreamType"`
	Cluster       string     `json:"Cluster"`
	Category      []Category `json:"Category"`
	Label         string     `json:"Label"`
	SecurityKey   string     `json:"SecurityKey"`
	TokenSecurity bool       `json:"TokenSecurity"`
	ThumbURI      string     `json:"ThumbURI"`
	CreatedAt     time.Time  `json:"CreatedAt"`
	LastUpdatedAt time.Time  `json:"LastUpdatedAt"`
	Expires       bool       `json:"Expires"`
	ExpiresAt     time.Time  `json:"ExpiresAt"`
	UsePlayerV5   bool       `json:"UsePlayerV5"`
	BottalkApiKey string     `json:"BottalkApiKey"`
	UsePubdate    bool       `json:"UsePubdate"`
}

type ProjectCreate

type ProjectCreate struct {
	Label        string `json:"Label"`
	StreamTypeId int64  `json:"StreamTypeId"` // 1 = Video Platform	| 2 = Video Livestream
}

type ProjectCreateResponse

type ProjectCreateResponse struct {
	ProjectId int64 `json:"ProjectId"`
	ChannelId int64 `json:"ChannelId"`
}

type ProjectUpdate

type ProjectUpdate struct {
	Label         string `json:"Label"`
	TokenSecurity bool   `json:"TokenSecurity"`
	UsePlayerV5   bool   `json:"UsePlayerV5"`
}

type ProjectsResponse

type ProjectsResponse struct {
	Projects []Project `json:"Projects"`
}

type Recorder

type Recorder struct {
	ID                   int64      `json:"Id"`
	Title                string     `json:"Title"`
	Description          string     `json:"Description"`
	Channel              Channel    `json:"Channel"`
	Project              Project    `json:"Project"`
	DstProject           Project    `json:"DstProject"`
	IsRecording          bool       `json:"IsRecording"`
	AutoRecording        bool       `json:"AutoRecording"`
	UseRecordingInterval bool       `json:"UseRecordingInterval"`
	RecordingInterval    int64      `json:"RecordingInterval"`
	RecordStartTime      time.Time  `json:"RecordStartTime"`
	SecondsRecorded      int64      `json:"SecondsRecorded"`
	Category             []Category `json:"Category"`
	IsStarting           bool       `json:"IsStarting"`
	IsStopping           bool       `json:"IsStopping"`
	CreatedAt            time.Time  `json:"CreatedAt"`
	LastUpdatedAt        time.Time  `json:"LastUpdatedAt"`
}

type RecorderCreate

type RecorderCreate struct {
	Title                string `json:"Title"`
	Description          string `json:"Description"`
	AutoRecording        bool   `json:"AutoRecording"`
	UseRecordingInterval bool   `json:"UseRecordingInterval"`
	RecordingInterval    int64  `json:"RecordingInterval"`
}

type RecorderUpdate

type RecorderUpdate struct {
	Title                string `json:"Title"`
	Description          string `json:"Description"`
	AutoRecording        bool   `json:"AutoRecording"`
	UseRecordingInterval bool   `json:"UseRecordingInterval"`
	RecordingInterval    int64  `json:"RecordingInterval"`
}

type RecordersResponse

type RecordersResponse struct {
	ChannelRecorders []Recorder `json:"ChannelRecorders"`
}

type Share

type Share struct {
	ID          int64  `json:"Id"`
	Label       string `json:"Label"`
	Description string `json:"Description"`
	Author      string `json:"Author"`
	AccessKey   string `json:"AccessKey"`
	ThumbURI    string `json:"ThumbURI"`
}

type StandardFilePicture

type StandardFilePicture struct {
	FilePictureId int64  `json:"FilePictureId"`
	URI           string `json:"URI"`
	ThumbURI      string `json:"ThumbURI"`
	SrcPictureURI string `json:"SrcPictureURI"`
	IsStandard    bool   `json:"IsStandard"`
}

type StreamType

type StreamType struct {
	ID    int64  `json:"Id"`
	Label string `json:"Label"`
}

type ThreeQGo

type ThreeQGo interface {

	// Welcome will test authentication
	Welcome() error
	SetAPIKey(apiKey string)

	// GetAPIKeyByUser use your username and password to get the apiKey
	GetAPIKeyByUser(username, password string) (string, error)

	// GetProjects returns a collection of available projects
	GetProjects() ([]Project, error)
	// CreateProject creates a new project
	CreateProject(project ProjectCreate) (ProjectCreateResponse, error)
	// GetProject return Project
	GetProject(id int64) (Project, error)
	// UpdateProject changes project properties
	UpdateProject(id int64, project ProjectUpdate) (Project, error)
	// DeleteProject delete a Project by id
	DeleteProject(id int64) error
	// GetProjectChannels return Channel(s) of Project if livestream project
	GetProjectChannels(id int64) ([]Channel, error)

	// GetFileEncoderSettings return the global settings of FileEncoding in a Video on Demand project
	GetFileEncoderSettings(projectID int64) (FileEncodingSetting, error)
	// UpdateFileEncoderSettings set the global settings for FileEncoding in a Video on Demand project
	UpdateFileEncoderSettings(projectID int64, settings FileEncoderSettingsUpdate) (FileEncodingSetting, error)
	// SetWatermarkPicture set a image as watermark
	SetWatermarkPicture(projectID int64, filename, contentType string, watermark io.Reader) error
	// GetFileFormatSettings return all global FileFormatSettings of a Video on Demand project
	GetFileFormatSettings(projectID int64) (FileFormatSettings, error)
	// GetFileFormat return a FileFormat of a Video on Demand project
	GetFileFormat(projectID int64, fileFormatID int64) (FileFormat, error)
	// UpdateFileFormat Set a FileFormat setting of a Video on Demand project
	UpdateFileFormat(projectID int64, fileFormatID int64, fileFormat FileFormatUpdate) (FileFormat, error)
	// AddFileFormat add (link) FileFormat to the FileEncoderSettings
	AddFileFormat(projectID int64, fileFormatID int64) (FileEncodingSetting, error)
	// RemoveFileFormat removes (unlink) FileFormat from the FileEncoderSettings
	RemoveFileFormat(projectID int64, fileFormatID int64) (FileEncodingSetting, error)

	// GetChannels return a collection of available channels
	GetChannels() ([]Channel, error)
	// GetChannel return a Channel by id
	GetChannel(id int64) (Channel, error)

	// GetChannelRecorders return enabled channel recorder
	GetChannelRecorders() ([]Recorder, error)
	// GetChannelRecorder return a Recorder by id
	GetChannelRecorder(channelID, recorderID int64) (Recorder, error)
	// UpdateChannelRecorder Edit a Recorder
	UpdateChannelRecorder(channelID, recorderID int64, recorder RecorderUpdate) (Recorder, error)
	// DeleteChannelRecorder delete a Recorder by id
	DeleteChannelRecorder(channelID, recorderID int64) error
	// CreateChannelRecorder create a new Recorder
	CreateChannelRecorder(channelID, dstProjectID int64, recorder RecorderCreate) (Recorder, error)
	// ChannelRecorderAddCategory add(link) a Category to the Recorder
	ChannelRecorderAddCategory(channelID, recorderID, categoryID int64) (Recorder, error)
	// ChannelRecorderRemoveCategory remove(unlink) a Category from the Recorder
	ChannelRecorderRemoveCategory(channelID, recorderID, categoryID int64) (Recorder, error)

	// GetFiles returns a collection of File in Project
	GetFiles(projectID int64, queryParams FileSearchOptions) ([]File, error)
	// GetFile return a File by id in Project
	GetFile(projectID, fileID int64) (File, error)

	// GetEncodingProgress return the EncodingProgress of file processing
	GetEncodingProgress(projectID, fileID int64) (EncodingProgress, error)
}

func NewClient

func NewClient(httpClient *http.Client) ThreeQGo

NewClient creates a new Client, apiKey and httpClient are optional.

type VideoType

type VideoType struct {
	ID    int64  `json:"Id"`
	Label string `json:"Label"`
}

Jump to

Keyboard shortcuts

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