helper

package
v0.0.0-...-07cd16e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYNQ_LEGACY_VERSION = "v1"
	SYNQ_VERSION        = "v2"
)

Variables

View Source
var DEFAULT_CRED_FILE = os.Getenv("HOME") + "/.synq/credentials.json"

Functions

func LoadAsset

func LoadAsset(id string, c common.Cacheable, api synq.ApiV2) (asset synq.Asset, err error)

func LoadRawVideosByAccount

func LoadRawVideosByAccount(accountId, name string, c common.Cacheable, api synq.ApiV2) (videos []json.RawMessage, err error)

fow now, the query will be the account id

func LoadUploadParameters

func LoadUploadParameters(id string, req upload.UploadRequest, c common.Cacheable, api synq.ApiV2) (up upload.UploadParameters, err error)

func LoadVideoV2

func LoadVideoV2(id string, c common.Cacheable, api synq.ApiV2) (video synq.VideoV2, err error)

func LoadVideosByAccount

func LoadVideosByAccount(accountId, name string, c common.Cacheable, api synq.ApiV2) (videos []synq.VideoV2, err error)

fow now, the query will be the account id

func SetupForTestV2

func SetupForTestV2() synq.ApiV2

func SetupSynqApi

func SetupSynqApi(setup ...ApiSetup) (api synq.ApiF)

func SetupSynqV2

func SetupSynqV2() synq.ApiV2

Types

type ApiSet

type ApiSet struct {
	V2    ApiSetting `json:"v2"`
	ApiV2 synq.ApiV2 `json:"-"`
}

func LoadFromFile

func LoadFromFile(file ...string) (*ApiSet, error)

func (*ApiSet) Setup

func (a *ApiSet) Setup()

type ApiSetting

type ApiSetting struct {
	// only api_key is required
	ApiKey        string `json:"api_key"`
	Url           string `json:"api_url,omitempty"`
	Timeout       int    `json:"timeout,omitempty"`
	UploadTimeout int    `json:"upload_timeout,omitempty"`
	User          string `json:"user,omitempty"`
	Password      string `json:"password,omitempty"`
}

func (ApiSetting) Configure

func (a ApiSetting) Configure(api synq.ApiF)

func (ApiSetting) SetupV2

func (a ApiSetting) SetupV2() synq.ApiV2

func (ApiSetting) Valid

func (a ApiSetting) Valid() bool

type ApiSetup

type ApiSetup struct {
	Key     string
	Version string
	Url     string
}

func GetSetupByEnv

func GetSetupByEnv(version string) ApiSetup

Jump to

Keyboard shortcuts

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