#client #media #api #manager

bin+lib mm_client

Library for interfacing with PBS Media Manager API

3 releases (breaking)

✓ Uses Rust 2018 edition

0.11.0 Mar 7, 2019
0.10.0 Aug 15, 2017
0.9.0 May 20, 2017

#100 in Multimedia

25 downloads per month

Apache-2.0

48KB
1K SLoC

mm_client

Latest Version Documentation CircleCI

The mm_client crate is a very small library for communicating with the PBS Media Manager API easier. It provides a client for querying against either the production API or the staging API.


Installation

mm_client = "0.10.0"

Optional features

  • "cli" - Builds a sample cli binary that uses the client

Licensing

mm_api_notify is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.


lib.rs:

mm_client

The mm_client crate is a very small library for communicating with the PBS Media Manager API easier. It provides a Client for querying against either the production API or the staging API.

The main goals of the crate are to:

  • Provide authentication handling
  • Manage API url construction
  • Handle API error responses
  • Make few assumptions about how responses will be used

Currently all requests made by a Client are synchronous.

Creating a Client

Client provides two constructors, one for the accessing the production API and one for the staging API. Both constructors take an API key and secret as arguments. It is recommended to create a single Client that is then passed around for making requests.

Note that constructing a client may fail.

use mm_client::Client;

let client = Client::new("API_KEY", "API_SECRET").unwrap();

Fetching a single object

Requesting a single object can be performed by using the get method

use mm_client::Client;
use mm_client::Endpoints;

let client = Client::new("API_KEY", "API_SECRET").unwrap();
let response = client.get(Endpoints::Asset, "asset-id", None);

The response string can then be handed off a JSON parser for further use.

Fetching a list of objects

Requesting a list of objects can be performed by using the list method

use mm_client::Client;
use mm_client::Endpoints;

let client = Client::new("API_KEY", "API_SECRET").unwrap();
let params = vec![("since", "2017-02-12T00:00:00Z")];
let response = client.list(Endpoints::Show, params);

Here a request is made for all of the show objects that have been updated since the supplied date. Similar to the get method, the response string is available to pass to a JSON parser

Dependencies

~6MB
~120K SLoC