storyblocksgoclient

package module
v0.0.0-...-c5aced1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

README

StoryBlocksGoClient

A Go client library for interacting with the StoryBlocks API. Provides easy-to-use functions for searching and downloading video assets from the StoryBlocks platform. Includes support for authentication and parameter validation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	PrivateKey string
	PublicKey  string
}

type DownloadResponse

type DownloadResponse struct {
	Mov struct {
		Ten080P string `json:"_1080p"`
	} `json:"MOV"`
	Mp4 struct {
		Ten80P   string `json:"_1080p"`
		Seven20P string `json:"_720p"`
	} `json:"MP4"`
}

type EndpointConfig

type EndpointConfig struct {
	Name     string
	Endpoint string
	Method   string
}

type RequestParams

type RequestParams interface {
	VideoSearchToMap() map[string]interface{}
	VideoDownloadToMap() map[string]interface{}
}

type Storyblocks

type Storyblocks struct {
	Prefix      string
	Credentials Credentials
	User_ID     string
	Project_ID  string
	// contains filtered or unexported fields
}

func NewStoryBlocks

func NewStoryBlocks(credentials Credentials, endpoints []EndpointConfig) *Storyblocks

func (*Storyblocks) Auth

func (api *Storyblocks) Auth(endpoint string) map[string]string

func (*Storyblocks) DownloadVideo

func (api *Storyblocks) DownloadVideo(params VideoDownloadParams) (DownloadResponse, error)

func (*Storyblocks) Request

func (api *Storyblocks) Request(endpointFn func(map[string]interface{}) (string, url.Values), method string, params map[string]interface{}) (map[string]interface{}, error)

func (*Storyblocks) VideoSearch

func (api *Storyblocks) VideoSearch(params map[string]interface{}) (map[string]interface{}, error)

type VideoDownloadParams

type VideoDownloadParams struct {
	APIKey      string `validate:"required"`
	Expires     string `validate:"required"`
	HMAC        string `validate:"required"`
	ProjectID   string `validate:"required"`
	UserID      string `validate:"required"`
	StockItemID int    `validate:"required"`
}

func (VideoDownloadParams) VideoDownloadToMap

func (params VideoDownloadParams) VideoDownloadToMap() map[string]interface{}

type VideoSearchParams

type VideoSearchParams struct {
	APIKey              string  `json:"APIKEY" validate:"required"`
	Expires             string  `json:"EXPIRES" validate:"required"`
	HMAC                string  `json:"HMAC" validate:"required"`
	ProjectID           string  `json:"project_id" validate:"required"`
	UserID              string  `json:"user_id" validate:"required"`
	Keywords            *string `json:"keywords"` // Optional fields can be pointers
	ContentType         *string `json:"content_type"`
	Quality             *string `json:"quality"`
	MinDuration         *int    `json:"min_duration"`
	MaxDuration         *int    `json:"max_duration"`
	HasTalentReleased   *bool   `json:"has_talent_released"`
	HasPropertyReleased *bool   `json:"has_property_released"`
	HasAlpha            *bool   `json:"has_alpha"`
	IsEditorial         *bool   `json:"is_editorial"`
	Categories          *string `json:"categories"`
	Page                *int    `json:"page"`
	ResultsPerPage      *int    `json:"results_per_page"`
	SortBy              *string `json:"sort_by"`
	SortOrder           *string `json:"sort_order"`
	RequiredKeywords    *string `json:"required_keywords"`
	FilteredKeywords    *string `json:"filtered_keywords"`
	Translate           *bool   `json:"translate"`
	SourceLanguage      *string `json:"source_language"`
	SafeSearch          *bool   `json:"safe_search"`
	LibraryIDs          *string `json:"library_ids"`
	ExcludeLibraryIDs   *string `json:"exclude_library_ids"`
	ContentScores       *bool   `json:"content_scores"`
	FrameRates          *string `json:"frame_rates"`
	Extended            *string `json:"extended"`
	IsVR360             *bool   `json:"is_vr_360"`
}

func (VideoSearchParams) VideoSearchToMap

func (params VideoSearchParams) VideoSearchToMap() map[string]interface{}

type VideoSearchResponse

type VideoSearchResponse struct {
	Status       string
	Message      string
	TotalResults int `json:"total_results"`
	Results      []struct {
		ID           int    `json:"id"`
		Title        string `json:"title"`
		Type         string `json:"type"`
		ThumbnailURL string `json:"thumbnail_url"`
		PreviewUrls  struct {
			Ten80P   string `json:"_180p"`
			Three60P string `json:"_360p"`
			Four80P  string `json:"_480p"`
			Seven20P string `json:"_720p"`
		} `json:"preview_urls"`
		Duration int  `json:"duration"`
		IsNew    bool `json:"is_new"`
	} `json:"results"`
}

Jump to

Keyboard shortcuts

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