mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-07 03:56:42 +01:00
It seems we do it better than the actual Go implementation, which fails to detect that scopes are actually having a string member. However, there still is an issue, as it's as hashmap for us, but just a member for go ... lets see ... https://developers.google.com/discovery/v1/reference/apis#resource shows that we implement it correctly :) !!
127 lines
4.4 KiB
Markdown
127 lines
4.4 KiB
Markdown
<!---
|
|
DO NOT EDIT !
|
|
This file was generated automatically from 'src/mako/README.md.mako'
|
|
DO NOT EDIT !
|
|
-->
|
|
The `youtube3` library allows access to all features of *YouTube*.
|
|
|
|
# Features
|
|
|
|
Handle the following *Resources* with ease ...
|
|
|
|
* activities (*insert* and *list*)
|
|
* channel banners (*insert*)
|
|
* channel sections (*delete*, *insert*, *list* and *update*)
|
|
* channels (*list* and *update*)
|
|
* guide categories (*list*)
|
|
* i18n languages (*list*)
|
|
* i18n regions (*list*)
|
|
* live broadcasts (*bind*, *control*, *delete*, *insert*, *list*, *transition* and *update*)
|
|
* live streams (*delete*, *insert*, *list* and *update*)
|
|
* playlist items (*delete*, *insert*, *list* and *update*)
|
|
* playlists (*delete*, *insert*, *list* and *update*)
|
|
* search (*list*)
|
|
* subscriptions (*delete*, *insert* and *list*)
|
|
* thumbnails (*set*)
|
|
* video categories (*list*)
|
|
* videos (*delete*, *getRating*, *insert*, *list*, *rate* and *update*)
|
|
* watermarks (*set* and *unset*)
|
|
|
|
Everything else about the *YouTube* API can be found at the
|
|
[official documentation site](https://developers.google.com/youtube/v3).
|
|
|
|
# Structure of this Library
|
|
|
|
The API is structured into the following primary items:
|
|
|
|
* **Hub**
|
|
* a central object to maintain state and allow accessing all *Activities*
|
|
* **Resources**
|
|
* primary types that you can apply *Activities* to
|
|
* a collection of properties and *Parts*
|
|
* **Parts**
|
|
* a collection of properties
|
|
* never directly used in *Activities*
|
|
* **Activities**
|
|
* operations to apply to *Resources*
|
|
|
|
Generally speaking, you can invoke *Activities* like this:
|
|
|
|
```Rust,ignore
|
|
let r = hub.resource().activity(...).doit()
|
|
```
|
|
|
|
Or specifically ...
|
|
|
|
```ignore
|
|
let r = hub.live_broadcasts().control(...).doit()
|
|
let r = hub.live_broadcasts().insert(...).doit()
|
|
let r = hub.live_broadcasts().list(...).doit()
|
|
let r = hub.live_broadcasts().transition(...).doit()
|
|
let r = hub.live_broadcasts().update(...).doit()
|
|
let r = hub.live_broadcasts().delete(...).doit()
|
|
let r = hub.live_broadcasts().bind(...).doit()
|
|
```
|
|
|
|
The `resource()` and `activity(...)` calls create [builders][builder-pattern]. The second one dealing with `Activities`
|
|
supports various methods to configure the impending operation (not shown here). It is made such that all required arguments have to be
|
|
specified right away (i.e. `(...)`), whereas all optional ones can be [build up][builder-pattern] as desired.
|
|
The `doit()` method performs the actual communication with the server and returns the respective result.
|
|
|
|
# Usage (*TODO*)
|
|
|
|
## Instantiating the Hub
|
|
|
|
```Rust
|
|
extern crate hyper;
|
|
extern crate "yup-oauth2" as oauth2;
|
|
extern crate "rustc-serialize" as rustc_serialize;
|
|
extern crate youtube3;
|
|
|
|
use std::default::Default;
|
|
use oauth2::{Authenticator, DefaultAuthenticatorDelegate, ApplicationSecret, MemoryStorage};
|
|
# use youtube3::YouTube;
|
|
|
|
// Get an ApplicationSecret instance by some means. It contains the `client_id` and `client_secret`,
|
|
// among other things.
|
|
let secret: ApplicationSecret = Default::default();
|
|
// Instantiate the authenticator. It will choose a suitable authentication flow for you,
|
|
// unless you replace `None` with the desired Flow
|
|
// Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about what's going on
|
|
// You probably want to bring in your own `TokenStorage` to persist tokens and retrieve them from storage.
|
|
let auth = Authenticator::new(&secret, DefaultAuthenticatorDelegate,
|
|
hyper::Client::new(),
|
|
<MemoryStorage as Default>::default(), None);
|
|
let mut hub = YouTube::new(hyper::Client::new(), auth);
|
|
```
|
|
|
|
**TODO** Example calls - there should soon be a generator able to do that with proper inputs
|
|
|
|
## Handling Errors
|
|
|
|
# Some details
|
|
|
|
## About Customization/Callbacks
|
|
|
|
## About parts
|
|
|
|
* Optionals needed for Json, otherwise I'd happily drop them
|
|
* explain that examples use all response parts, even though they are shown for request values
|
|
|
|
## About builder arguments
|
|
|
|
* pods are copy
|
|
* strings are &str
|
|
* request values are borrowed
|
|
* additional parameters using `param()`
|
|
|
|
[builder-pattern]: http://en.wikipedia.org/wiki/Builder_pattern
|
|
[google-go-api]: https://github.com/google/google-api-go-client
|
|
|
|
# License
|
|
The **youtube3** library was generated by Sebastian Thiel, and is placed
|
|
under the *MIT* license.
|
|
You can read the full text at the repository's [license file][repo-license].
|
|
|
|
[repo-license]: https://github.com/Byron/google-apis-rsLICENSE.md
|