pili

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SDK_VERSION      = "1.3.0"
	API_VERSION      = "v1"
	DEFAULT_API_HOST = "pili.qiniuapi.com"
	ORIGIN           = "ORIGIN"
)

Variables

View Source
var (
	API_HOST  string
	USE_HTTPS bool
)
View Source
var API_BASE_URL = fmt.Sprintf("%s://%s/%s", getHttpScheme(), getApiHost(), API_VERSION)
View Source
var DefaultClient = RPC_Client{http.DefaultClient}

Functions

func ResponseError

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

func UserAgent

func UserAgent() string

Types

type Client added in v1.2.0

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

func NewClient

func NewClient(mac *Mac, hub string) Client

func (Client) CreateStream added in v1.2.0

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

func (Client) GetStream added in v1.2.0

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

func (Client) ListStreams added in v1.2.0

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

type Error

type Error struct {
	Err int    `json:"error"`
	Msg string `json:"message"`
}

type ErrorInfo

type ErrorInfo struct {
	ErrorRet
	Code int
}

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

type ErrorRet

type ErrorRet struct {
	Err     int              `json:"error"`
	Msg     string           `json:"message"`
	Details map[string]Error `json:"details"`
}

type Mac

type Mac struct {
	AccessKey string
	SecretKey string
}

func Creds

func Creds(accessKey, secretKey string) *Mac

func (*Mac) SignRequest

func (mac *Mac) SignRequest(req *http.Request) (token string, err error)

type OptionalArguments added in v1.2.0

type OptionalArguments struct {
	Title           string
	PublishKey      string
	PublishSecurity string
	Disabled        bool
	Marker          string
	Limit           uint
	Start           int64
	End             int64
	NotifyUrl       string
}

type RPC_Client

type RPC_Client struct {
	*http.Client
}

func (RPC_Client) Del

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

func (RPC_Client) DelCall

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

func (RPC_Client) Do

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

func (RPC_Client) Get

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

func (RPC_Client) GetCall

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

func (RPC_Client) Post

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

func (RPC_Client) PostCall

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

func (RPC_Client) RequestWith

func (r RPC_Client) 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"`
		Play    map[string]string `json:"play,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) 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) 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(args OptionalArguments) (stream Stream, err error)

type StreamList

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

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 {
	Segments []*StreamSegment `json:"segments"`
}

type StreamStatus added in v1.1.0

type StreamStatus struct {
	Addr   string `json:"addr"`
	Status string `json:"status"`
}

type Transport

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

func NewTransport

func NewTransport(mac *Mac, 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