riboflavin v0.0.2 Riboflavin.API

Direct API interface for Backblaze B2

Summary

Functions

Used to log in to the B2 API. Returns an authorization token that can be used for account-level operations, and a URL that should be used as the base URL for subsequent API calls

Creates a new bucket. A bucket belongs to the account used to create it

Deletes the bucket specified. Only buckets that contain no version of any files can be deleted

Downloads one file by providing the name of the bucket and the name of the file

Gets information about one file stored in B2

Gets a URL to use for uploading files

Hides a file so that downloading by name will not find the file, but previous versions of the file are still stored. See File Versions about what it means to hide a file

Lists buckets associated with an account in alphabetical order by bucket ID

Lists the names of all files in a bucket, starting at a given name. TODO: Start File Name

Lists all of the versions of all of the files contained in one bucket, in alphabetical order by file name, and by reverse of data/time uploaded for versions of files with the same name. TODO: Start file name and ID

Uploads one file to B2, returning its unique file ID

Formats and gets to URL and returns Map with response

TODO: Download async to not block on download

Formats and sends post to URL and returns Map with response

Post a file and headers

Generate Sha1 of File

Types

Functions

b2_authorize_account(credentials, api_url)

Specs

b2_authorize_account(cred_t, String.t) :: Map.t

Used to log in to the B2 API. Returns an authorization token that can be used for account-level operations, and a URL that should be used as the base URL for subsequent API calls.

b2_create_bucket(auth_token, api_url, account_id, bucket_name, bucket_type)

Specs

b2_create_bucket(String.t, String.t, String.t, String.t, String.t) :: Map.t

Creates a new bucket. A bucket belongs to the account used to create it.

b2_delete_bucket(auth_token, api_url, account_id, bucket_id)

Specs

b2_delete_bucket(String.t, String.t, String.t, String.t) :: Map.t

Deletes the bucket specified. Only buckets that contain no version of any files can be deleted.

b2_delete_file_version(auth_token, api_url, file_name, file_id)

Specs

b2_delete_file_version(String.t, String.t, String.t, String.t) :: Map.t

Deletes one version of a file from B2.

b2_download_file_by_id(auth_token, api_url, file_id)

Specs

b2_download_file_by_id(String.t, String.t, String.t) :: Map.t

Downloads one file from B2.

b2_download_file_by_name(auth_token, download_url, bucket_name, file_name)

Specs

b2_download_file_by_name(String.t, String.t, String.t, String.t) :: Map.t

Downloads one file by providing the name of the bucket and the name of the file.

b2_get_file_info(auth_token, api_url, file_id)

Specs

b2_get_file_info(String.t, String.t, String.t) :: Map.t

Gets information about one file stored in B2.

b2_get_upload_url(auth_token, api_url, bucket_id)

Specs

b2_get_upload_url(String.t, String.t, String.t) :: Map.t

Gets a URL to use for uploading files.

b2_hide_file(auth_token, api_url, bucket_id, file_name)

Specs

b2_hide_file(String.t, String.t, String.t, String.t) :: Map.t

Hides a file so that downloading by name will not find the file, but previous versions of the file are still stored. See File Versions about what it means to hide a file.

b2_list_buckets(auth_token, api_url, account_id)

Specs

b2_list_buckets(String.t, String.t, String.t) :: Map.t

Lists buckets associated with an account in alphabetical order by bucket ID.

b2_list_file_names(auth_token, api_url, bucket_id, max_file_count \\ 100)

Specs

b2_list_file_names(String.t, String.t, String.t, number) :: Map.t

Lists the names of all files in a bucket, starting at a given name. TODO: Start File Name

b2_list_file_versions(auth_token, api_url, bucket_id, max_file_count \\ 100)

Specs

b2_list_file_versions(String.t, String.t, String.t, number) :: Map.t

Lists all of the versions of all of the files contained in one bucket, in alphabetical order by file name, and by reverse of data/time uploaded for versions of files with the same name. TODO: Start file name and ID

b2_update_bucket(auth_token, api_url, bucket_id, bucket_type)

Specs

b2_update_bucket(String.t, String.t, String.t, String.t) :: Map.t

Update an existing bucket.

b2_upload_file(auth_token, api_url, bucket_id, file_name, headers)

Specs

b2_upload_file(String.t, String.t, String.t, String.t, Map.t) :: Map.t

Uploads one file to B2, returning its unique file ID.

download(url, auth_token)

Formats and gets to URL and returns Map with response.

download_async(url, auth_token \\ "")

TODO: Download async to not block on download.

post(url, auth_token, body)

Formats and sends post to URL and returns Map with response.

post_file(url, headers, file_name)

Post a file and headers

sha1_file(file)

Generate Sha1 of File