Module backblaze_b2::raw [] [src]

This module contains five different modules, each with different functions for accessing the b2 api directly.

The various methods for accessing the backblaze api are implemented on an Authorization struct. There are 3 different authorization structs: B2Authorization, UploadAuthorization and DownloadAuthorization.

All access to the library starts with somehow obtaining the appropriate authorization struct. In order to obtain an B2Authorization, one must first obtain a B2Credentials, which contains a b2 user id and api key. Using this struct an authorization token can be obtained in the form of the B2Authorization struct:

extern crate hyper;
extern crate hyper_native_tls;
use hyper::Client;
use hyper::net::HttpsConnector;
use hyper_native_tls::NativeTlsClient;
use backblaze_b2::raw::authorize::B2Credentials;

let ssl = NativeTlsClient::new().unwrap();
let connector = HttpsConnector::new(ssl);
let client = Client::with_connector(connector);

let cred = B2Credentials {
    id: "user id".to_owned(), key: "user key".to_owned()
};
let auth = cred.authorize(&client).unwrap();

This B2Authorization struct can be used to perform various requests to the b2 api, see the documentation on the B2Authorization for documentation regarding each of the possible functions.

Modules

authorize
buckets

This module defines various functions on the B2Authorization type for interacting with the buckets on backblaze.

download

This module defines the struct DownloadAuthorization, which has various methods for downlaoding files from backblaze b2. This struct is usually obtained from a B2Authorization using the methods to_download_authorization and get_download_authorization.

files

This module defines various functions on the B2Authorization type for interacting with the files on backblaze. There are also various structs defined for storing information about files on backblaze.

upload

This module defines the struct UploadAuthorization, which has various methods for uploading files to backblaze b2. This struct is usually obtained from a B2Authorization using the method get_upload_url.