openyouku

package module
v0.0.0-...-8d1fe7c Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CHUNK_SIZE = int64(5 * 1024 * 1024) // 5M 分片
)

Functions

This section is empty.

Types

type OssParam

type OssParam struct {
	Endpoint         string `json:"endpoint"`
	ExpireTime       string `json:"expire_time"`
	OssBucket        string `json:"oss_bucket"`
	OssObject        string `json:"oss_object"`
	SecurityToken    string `json:"security_token"`
	TempAccessID     string `json:"temp_access_id"`
	TempAccessSecret string `json:"temp_access_secret"`
	UploadToken      string `json:"upload_token"`
	Vid              string `json:"vid"`
}

type Request

type Request struct {
	Method string
	// contains filtered or unexported fields
}

type Response

type Response struct {
	Error ResponseError `json:"e"`
	Cost  float64       `json:"cost"`
	Data  interface{}   `json:"data"`
}

type ResponseError

type ResponseError struct {
	Code      int    `json:"code"`
	Provider  string `json:"provider"`
	Desc      string `json:"desc"`
	ErrorCode int    `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

type SDK

type SDK struct {
	ClientID     string
	ClientSecret string
	AccessToken  string
	User         string
	Password     string
}

func (*SDK) Get

func (sdk *SDK) Get(action string, params map[string]string) (*Response, error)

func (*SDK) GetBytes

func (sdk *SDK) GetBytes(action string, params map[string]string) ([]byte, error)

func (*SDK) GetToken

func (sdk *SDK) GetToken(code string) (*TokenResponse, error)

func (*SDK) GetUploader

func (sdk *SDK) GetUploader(name string, content []byte) *Uploader

func (*SDK) GetUploaderWithFile

func (sdk *SDK) GetUploaderWithFile(name string) (*Uploader, error)

func (*SDK) Post

func (sdk *SDK) Post(action string, params map[string]interface{}) *Response

func (*SDK) PostBytes

func (sdk *SDK) PostBytes(action string, params map[string]string) ([]byte, error)

func (*SDK) RefreshToken

func (sdk *SDK) RefreshToken(token string) (*TokenResponse, error)

func (*SDK) SaveVideo

func (sdk *SDK) SaveVideo(video *VideoParam, data *VideoData) (*VideoData, error)

type SysParams

type SysParams struct {
	Action      string `json:"action"`
	ClientID    string `json:"client_id"`
	AccessToken string `json:"access_token"`
	Format      string `json:"format"`
	Timestamp   string `json:"timestamp"`
	Version     string `json:"version"`
	Sign        string `json:"sign"`
}

SysParams API定义的系统级别参数

func (*SysParams) SignParm

func (p *SysParams) SignParm(clientSecret string, param map[string]string) map[string]string

SignParm is a method to sign this request

func (*SysParams) String

func (p *SysParams) String() (string, error)

type TokenResponse

type TokenResponse struct {
	Errno   int     `json:"errno"`
	ErrText string  `json:"errText"`
	Cost    float64 `json:"cost"`
	Token   struct {
		ExpireTime   int    `json:"expireTime"`
		RexpireTime  int    `json:"rexpireTime"`
		StartTime    int64  `json:"startTime"`
		AccessToken  string `json:"accessToken"`
		RefreshToken string `json:"refreshToken"`
		OpenId       string `json:"openId"`
	} `json:"token"`
}

type UploadResponse

type UploadResponse struct {
	Error ResponseError `json:"e"`
	Cost  float64       `json:"cost"`
	Data  []OssParam    `json:"data"`
}

type Uploader

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

func NewUploader

func NewUploader(sdk *SDK, name string, content []byte) *Uploader

func NewUploaderWithFile

func NewUploaderWithFile(sdk *SDK, filename string) (*Uploader, error)

func (*Uploader) Set

func (uploader *Uploader) Set(k, v string)

func (*Uploader) Upload

func (uploader *Uploader) Upload(part bool, custom *OssParam) (*VideoData, error)

func (*Uploader) UploadAndSave

func (uploader *Uploader) UploadAndSave(video *VideoParam, part bool) (*VideoData, error)

type VideoData

type VideoData struct {
	Vid         string `json:"vid"`
	UploadToken string `json:"upload_token"`
	OwOssBucket string `json:"ow_oss_bucket,omitempty"`
	OwOssObject string `json:"ow_oss_object,omitempty"`
}

type VideoParam

type VideoParam struct {
	Title           string `json:"title"`
	Tags            string `json:"tags"`
	Description     string `json:"description,omitempty"`
	Original        string `json:"original,omitempty"`
	CategoryName    string `json:"category_name,omitempty"`
	SubcategoryIds  string `json:"subcategory_ids,omitempty"`
	ThumbnailCustom string `json:"thumbnail_custom,omitempty"`
}

type VideoResponse

type VideoResponse struct {
	Error ResponseError `json:"e"`
	Cost  float64       `json:"cost"`
	Data  []VideoData   `json:"data"`
}

Jump to

Keyboard shortcuts

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