pili

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SDK_VERSION         = "1.5.2"
	SDK_USER_AGENT      = "pili-sdk-go"
	DEFAULT_API_VERSION = "v1"
	DEFAULT_API_HOST    = "pili.qiniuapi.com"
	ORIGIN              = "ORIGIN"
)

Variables

View Source
var (
	API_HOST  string
	USE_HTTPS bool
)

Functions

func ResponseError

func ResponseError(resp *http.Response) (err error)

func UserAgent

func UserAgent() string

Types

type Credentials added in v1.5.0

type Credentials struct {
	AccessKey string
	SecretKey string
}

func NewCredentials added in v1.5.0

func NewCredentials(accessKey, secretKey string) *Credentials

func (*Credentials) MACToken added in v1.5.0

func (c *Credentials) MACToken(req *http.Request) (token string, err error)

type ErrorInfo

type ErrorInfo struct {
	Message string           `json:"message"`
	ErrCode int              `json:"error"`
	Details map[string]error `json:"details,omitempty"`
	Code    int              `json:"code"`
}

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

type Hub added in v1.5.0

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

func NewHub added in v1.5.0

func NewHub(creds *Credentials, hubName string) Hub

func (Hub) CreateStream added in v1.5.0

func (c Hub) CreateStream(args OptionalArguments) (stream Stream, err error)

func (Hub) GetStream added in v1.5.0

func (c Hub) GetStream(id string) (stream Stream, err error)

func (Hub) ListStreams added in v1.5.0

func (c Hub) ListStreams(args OptionalArguments) (ret StreamList, err error)

type OptionalArguments added in v1.2.0

type OptionalArguments struct {
	Title           string
	PublishKey      string
	PublishSecurity string
	Disabled        bool
	Hub             string
	Idonly          string
	Status          string
	Marker          string
	Limit           uint
	Start           int64
	End             int64
	Time            int64
	NotifyUrl       string
	UserPipeline    string
}

type RPC added in v1.5.0

type RPC struct {
	*http.Client
}

func NewRPC added in v1.5.0

func NewRPC(creds *Credentials) *RPC

func (RPC) Del added in v1.5.0

func (r RPC) Del(url string) (resp *http.Response, err error)

func (RPC) DelCall added in v1.5.0

func (r RPC) DelCall(ret interface{}, url string) (err error)

func (RPC) Do added in v1.5.0

func (r RPC) Do(req *http.Request) (resp *http.Response, err error)

func (RPC) Get added in v1.5.0

func (r RPC) Get(url string) (resp *http.Response, err error)

func (RPC) GetCall added in v1.5.0

func (r RPC) GetCall(ret interface{}, url string) (err error)

func (RPC) Post added in v1.5.0

func (r RPC) Post(url string, data interface{}) (resp *http.Response, err error)

func (RPC) PostCall added in v1.5.0

func (r RPC) PostCall(ret interface{}, url string, params interface{}) (err error)

func (RPC) RequestWith added in v1.5.0

func (r RPC) RequestWith(
	method string,
	url string,
	bodyType string,
	body io.Reader,
	bodyLength int) (resp *http.Response, err error)

type Stream

type Stream struct {
	Id              string    `json:"id"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	Title           string    `json:"title"`
	Hub             string    `json:"hub"`
	Disabled        bool      `json:"disabled"`
	PublishKey      string    `json:"publishKey"`
	PublishSecurity string    `json:"publishSecurity"`
	Profiles        []string  `json:"profiles,omitempty"`
	Hosts           struct {
		Publish  map[string]string `json:"publish,omitempty"`
		Live     map[string]string `json:"live,omitempty"`
		Playback map[string]string `json:"playback,omitempty"`
	} `json:"hosts,omitempty"`
	// contains filtered or unexported fields
}

func (Stream) Delete added in v1.2.0

func (s Stream) Delete() (ret interface{}, err error)

func (Stream) Disable added in v1.2.0

func (s Stream) Disable() (stream Stream, err error)

func (Stream) Enable added in v1.2.0

func (s Stream) Enable() (stream Stream, err error)

func (Stream) HlsLiveUrls added in v1.2.0

func (s Stream) HlsLiveUrls() (urls map[string]string, err error)

func (Stream) HlsPlaybackUrls added in v1.2.0

func (s Stream) HlsPlaybackUrls(start, end int64) (urls map[string]string, err error)

func (Stream) HttpFlvLiveUrls added in v1.5.0

func (s Stream) HttpFlvLiveUrls() (urls map[string]string, err error)

func (Stream) Refresh added in v1.2.0

func (s Stream) Refresh() (stream Stream, err error)

func (Stream) RtmpLiveUrls added in v1.2.0

func (s Stream) RtmpLiveUrls() (urls map[string]string, err error)

func (Stream) RtmpPublishUrl added in v1.1.0

func (s Stream) RtmpPublishUrl() (url string)

Publish URL -------------------------------------------------------------------------------

func (Stream) SaveAs added in v1.3.0

func (s Stream) SaveAs(name, format string, start, end int64, args OptionalArguments) (ret StreamSaveAsResponse, err error)

func (Stream) Segments added in v1.2.0

func (s Stream) Segments(args OptionalArguments) (ret StreamSegmentList, err error)

func (Stream) Snapshot added in v1.5.0

func (s Stream) Snapshot(name, format string, args OptionalArguments) (ret StreamSnapshotResponse, err error)

func (Stream) Status added in v1.2.0

func (s Stream) Status() (ret StreamStatus, err error)

func (Stream) ToJSONString added in v1.2.0

func (s Stream) ToJSONString() (jsonBlob string, err error)

func (Stream) Update added in v1.2.0

func (s Stream) Update() (stream Stream, err error)

type StreamId added in v1.5.1

type StreamId struct {
	Id string `json:"id"`
}

type StreamIdList added in v1.5.1

type StreamIdList struct {
	Marker string      `json:"marker"`
	Items  []*StreamId `json:"items"`
}

type StreamList

type StreamList struct {
	Marker string    `json:"marker"`
	Items  []*Stream `json:"items"`
	End    bool      `json:"end"`
}

type StreamSaveAsResponse added in v1.3.0

type StreamSaveAsResponse struct {
	Url          string `json:"url"`
	TargetUrl    string `json:"targetUrl"`
	PersistentId string `json:"persistentId"`
}

type StreamSegment

type StreamSegment struct {
	Start int64 `json:"start"`
	End   int64 `json:"end"`
}

type StreamSegmentList

type StreamSegmentList struct {
	Start    int64            `json:"start"`
	End      int64            `json:"end"`
	Duration int64            `json:"duration"`
	Segments []*StreamSegment `json:"segments"`
}

type StreamSnapshotResponse added in v1.5.0

type StreamSnapshotResponse struct {
	TargetUrl    string `json:"targetUrl"`
	PersistentId string `json:"persistentId"`
}

type StreamStatus added in v1.1.0

type StreamStatus struct {
	Addr            string  `json:"addr"`
	StartFrom       string  `json:"startFrom"`
	Status          string  `json:"status"`
	BytesPerSecond  float64 `json:"bytesPerSecond"`
	FramesPerSecond struct {
		Audio float64 `json:"audio"`
		Video float64 `json:"video"`
		Data  float64 `json:"data"`
	} `json:"framesPerSecond"`
}

type Transport

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

func NewTransport

func NewTransport(creds *Credentials, transport http.RoundTripper) *Transport

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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