ooyalaV2SDK

package module
v0.0.0-...-2a138ec Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2016 License: MIT Imports: 13 Imported by: 0

README

Ooyala-v2-sdk

This Go SDK is simple re-implementation of the Ooyala client class sdks. As with the other sdks, it allows you to do GET, POST, PUT, PATCH and DELETE requests to the API as in the simple example below:

package main

import (
	"fmt"
	"github.com/andyrees/ooyalaV2SDK"
	"log"
)

func createNewApiInstance() *ooyalaV2SDK.OoyalaApi {
	api_secret := "<Your Secret Key>"
	api_key := "<Your API Key>"
	var expires int64 = 15 // set query to expire in 15 seconds

	return ooyalaV2SDK.NewApi(api_key, api_secret, expires)
}

func main() {
	api := createNewApiInstance()
	api.Request_path = "/v2/assets"
	api.Params["include"] = "metadata"         // include metadata
	api.Params["where"] = "asset_type='video'" // filter by asset type

	// get first set of results
	err := api.Get()
	if err != nil {
		log.Fatalln(err.Error())
	}

	fmt.Printf("%+v\n", api.Response)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OoyalaAPI

type OoyalaAPI struct {
	Params          map[string]string
	BaseURL         string
	CacheBaseURL    string
	UsedBaseURL     string
	Secret          string
	Body            string
	HTTPMethod      string
	RequestPath     string
	Response        string
	ResponseHeaders string
	Filter          string
	Signature       string
	FinalURL        string
}

OoyalaAPI implements the Ooyala Api

func NewAPI

func NewAPI(apiKey, apiSecret string, expires int64) *OoyalaAPI

NewAPI Factory function returns a new api instance.

func (*OoyalaAPI) Delete

func (a *OoyalaAPI) Delete() error

Delete a resource

func (*OoyalaAPI) GenerateSignature

func (a *OoyalaAPI) GenerateSignature()

GenerateSignature Generates the signature for a request

func (*OoyalaAPI) Get

func (a *OoyalaAPI) Get() error

Get or view a resource

func (*OoyalaAPI) Patch

func (a *OoyalaAPI) Patch() error

Patch or update an existing resource

func (*OoyalaAPI) Post

func (a *OoyalaAPI) Post() error

Post or create a new resource

func (*OoyalaAPI) Put

func (a *OoyalaAPI) Put() error

Put or replace an existing reource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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