pili

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 14, 2015 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

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

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 Sign

func Sign(secret, data []byte) (token string)

func URI_DelStream

func URI_DelStream(id string) string

func URI_GetStream

func URI_GetStream(id string) string

func URI_GetStreamSegments

func URI_GetStreamSegments(id string, options map[string]interface{}) (httpurl string)

func URI_ListStreams

func URI_ListStreams(hub string, options map[string]interface{}) (httpurl string)

func URI_NewStream

func URI_NewStream() string

func URI_SetStream

func URI_SetStream(id string) string

func UserAgent

func UserAgent() string

Types

type API_Client

type API_Client struct {
	Conn RPC_Client
}

func NewClient

func NewClient(mac *Mac) API_Client

func (API_Client) CreateStream

func (app API_Client) CreateStream(hub, title, publishKey, publishSecurity string) (ret Stream, err error)

func (API_Client) DelStream

func (app API_Client) DelStream(id string) (ret interface{}, err error)

func (API_Client) GetStream

func (app API_Client) GetStream(id string) (ret Stream, err error)

func (API_Client) GetStreamSegments

func (app API_Client) GetStreamSegments(id string, startTime, endTime int64) (ret StreamSegmentList, err error)

func (API_Client) ListStreams

func (app API_Client) ListStreams(hub, marker string, limit int64) (ret StreamList, err error)

func (API_Client) SetStream

func (app API_Client) SetStream(id, publishKey, publishSecurity string) (ret Stream, 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 PlayPolicy

type PlayPolicy struct {
	RtmpPlayHost string // required, replace with your customized domain
	HlsPlayHost  string // required, replace with your customized domain
	StreamId     string // required, format: <zone>.<hub>.<title>
}

func (PlayPolicy) HlsLiveUrl

func (p PlayPolicy) HlsLiveUrl(preset string) (url string)

func (PlayPolicy) HlsPlaybackUrl

func (p PlayPolicy) HlsPlaybackUrl(start, end int64, preset string) (url string)

func (PlayPolicy) RtmpLiveUrl

func (p PlayPolicy) RtmpLiveUrl(preset string) (url string)

type PublishPolicy

type PublishPolicy struct {
	RtmpPublishHost       string // required, replace with your customized domain
	StreamId              string // required, format: <zone>.<hub>.<title>
	StreamPublishKey      string // required, a secret key for signing the <publishToken>
	StreamPublishSecurity string // required, can be "dynamic" or "static"
	Nonce                 int64  // optional, for "dynamic" only, default is time.Now().UnixNano()
}

func (PublishPolicy) NonceVal

func (p PublishPolicy) NonceVal() (nonce int64)

func (PublishPolicy) Token

func (p PublishPolicy) Token() (token string)

func (PublishPolicy) Url

func (p PublishPolicy) Url() (url 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"`
	Hub             string    `json:"hub"`
	CreatedAt       time.Time `json:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt"`
	Title           string    `json:"title"`
	PublishKey      string    `json:"publishKey"`
	PublishSecurity string    `json:"publishSecurity"`
}

type StreamList

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

type StreamSegment

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

type StreamSegmentList

type StreamSegmentList struct {
	Segments []*StreamSegment `json:"segments"`
}

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