View Source ExBackblaze.Tokens (ex_backblaze v0.1.0)

Used to authorize use of 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.

Endpoints:

  • b2_authorize_account
  • b2_get_download_authorization
  • b2_get_upload_part_url
  • b2_get_upload_url

Link to this section Summary

Functions

POST /b2_get_download_authorization

POST /b2_get_upload_part_url

POST /b2_get_upload_url

Link to this section Functions

Link to this function

authorize(application_key_id, application_key)

View Source
@spec authorize(binary(), binary()) :: {:ok, ExBackblaze.Tokens.Token.t()}

GET /b2_authorize_account

Returns a token which includes apiUrl and authorizationToken which should be used with all subsequent requests

required-params

Required Params

  • application_key_id
  • application_key

examples

Examples

iex> ExBackblaze.Tokens.authorize("keyid", "key")
{:ok, %Token{}}
Link to this function

get_download_authorization(headers, body)

View Source
@spec get_download_authorization(keyword(), keyword()) ::
  {:ok, ExBackblaze.Tokens.DownloadToken.t()}

POST /b2_get_download_authorization

see-docs

See docs:

https://www.backblaze.com/b2/docs/b2_get_download_authorization.html

examples

Examples

iex> ExBackblaze.Tokens.authorize([Authorization: "authtoken"], [bucketId: "bucketid", fileNamePrefix: "public", validDurationInSeconds: "1000"])
{:ok, %Token{}}
Link to this function

get_upload_part_url(token, headers, body)

View Source
@spec get_upload_part_url(ExBackblaze.Tokens.Token.t(), keyword(), keyword()) ::
  {:ok, ExBackblace.Tokens.UploadToken.t()}

POST /b2_get_upload_part_url

required-params

Required Params

  • %Token{}

see-docs

See docs:

https://www.backblaze.com/b2/docs/b2_get_upload_part_url.html

Link to this function

get_upload_url(token, headers, body)

View Source
@spec get_upload_url(ExBackblaze.Tokens.Token.t(), keyword(), keyword()) ::
  {:ok, ExBackblace.Tokens.UploadToken.t()}

POST /b2_get_upload_url

required-params

Required Params

  • %Token{}

see-docs

See docs:

https://www.backblaze.com/b2/docs/b2_get_upload_url.html