Skip to content

Instantly share code, notes, and snippets.

@lucas1 lucas1/manifest.pod
Last active Aug 29, 2015

Embed
What would you like to do?
StreamRoot Manifest

NAME

StreamRoot::Manifest - StreamRoot Manifest API

VERSION

Version 0.02

SYNOPSIS

use StreamRoot::Manifest;

my $manifest = StreamRoot::Manifest->new;

# To get your Auth token, you need to autheticate with your account credentials
$manifest->authenticate($username, $password);

# Add a new manifest to your account
my $result = $manifest->AddManifest(
    url => 'http://foo.com/file.mpd', # need to be a valid url pointing to a valid manifest
    ttl => 5 # time to live before becoming inactive, in days
);

DESCRIPTION

StreamRoot Manifest API documentation with full description of API methods https://streamroot.readme.io/docs/api-overview.

new

my $manifest = StreamRoot::Manifest->new;

or

my $manifest = StreamRoot::Manifest->new($token);

The token param is optional, but it is better to avoid to do authentication calls before each request, and keep the auth token in memory instead.

getToken

$manifest->getToken;

Gets the authentication token.

setToken

$manifest->setToken($token);

Sets the auth token, to avoid reauthentications on each request (if you already have a valid token, you can set it with this method)

authentication

$manifest->authenticate($username, $password);

To get your token, you need to do first execute the authenticate method. This method sets the token property, and returns perl hash with StreamRoot response. The username and password are the same you use to sign in to the streamroot portal website.

addManifest

$manifest->addManifest(
    url => 'http://foo.com/file.mpd',
    status => 'active',
    ttl => 5 
);

or

$manifest->addManifest(
    {
        url => 'http://foo.com/file.mpd',
        status => 'active',
        ttl => 5
    },
    {
        url => 'http://bar.com/file.mpd',
        status => 'active',
        ttl => 10
    }
);

This method creates a new manifest in StreamRoot database. Returns perl hash or perl arrayref with StreamRoot response.

Parameters

url - This parameter is required, valid url pointing to a valid manifest.

status - This parameter is optional, current status of the manifest file, defaults to active

ttl - This parameter is optional, time to live in days before becoming inactive, defaults to 5 days

updateManifest

$manifest->updateManifest(
    id => $manifest_id,
    status => 'inactive',
    live => 'true' 
);

or

$manifest->updateManifest(
    {
        id => $manifest_id,
        status => 'inactive',
        live => 'true' 
    },
    {
        id => $manifest_id,
        status => 'inactive',
        live => 'false' 
    }
);

This method updates a manifest, returns perl hash or perl arrayref with StreamRoot response.

Parameters

id - This parameter is required, manifest id will be changed.

status - This parameter is optional, should be 'active' or 'inactive'.

live - This parameter is optional, should be 'true' or 'false'.

removeManifest

$manifest->removeManifest($manifest_id);

or

$manifest->removeManifest($manifest_id_1, $manifest_id_2, $manifest_id_3);

This method deletes the manifest with the given manifest id from the streamroot database, the id parameter is required. Returns perl hash or perl arrayref with StreamRoot response.

showManifest

$manifest->showManifest($manifest_id);

or

$manifest->showManifest($manifest_id_1, $manifest_id_2, $manifest_id_3);

This method returns information on a manifest in StreamRoot, the id parameter is required. Returns perl hash or perl arrayref with StreamRoot response.

showAllManifests

$manifest->showAllManifests($pattern);

This method returns information of all your manifests in StreamRoot, with an optional pattern to match the manifests url (Minimum of 10 characters to match and search on the manifest's URL). Returns perl arrayref with StreamRoot response.

SEE ALSO

https://streamroot.readme.io

AUTHOR

Lucas Tiago de Moraes, <lucastiagodemoraes@gmail.com>

CREDITS

Nikolay Rodionov, <nikolay@streamroot.io>

Team StreamRoot, <contact@streamroot.io>

LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the terms of the the Artistic License (2.0).

You may obtain a copy of the full license at: http://www.perlfoundation.org/artistic_license_2_0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.