Core HTTP layer for the Dropbox API v2.
Builds authenticated Req requests and normalizes responses. RPC-style
endpoints go through post/3, while content endpoints (file bytes) go
through upload_request/5 and download_request/5.
The Dropbox endpoints can be overridden (rarely needed) via:
config :magpie,
base_url: "https://api.dropboxapi.com/2",
upload_url: "https://content.dropboxapi.com/2/"Extra options merged into every request (e.g. plug: {Req.Test, Magpie}
for testing) can be set with config :magpie, req_options: [...].
Summary
Functions
Base URL for RPC endpoints.
Send an RPC request to a Dropbox endpoint, JSON-encoding body when given.
Same as post/3 but against an explicit base URL (used by content endpoints
that speak JSON, such as /files/get_thumbnail_batch).
Upload data (iodata or enumerable) as the raw request body.
Used by content endpoints that take bytes directly instead of a local file.
Upload the file at local path file as the raw request body.
The file is streamed, so large files are not loaded into memory at once.
Base URL for content (upload/download) endpoints.
Types
@type response() :: {:ok, term()} | {:error, Magpie.Error.t()}
@type response_download() :: {:ok, %{body: binary(), headers: list() | map()}} | {:error, Magpie.Error.t()}
Functions
Base URL for RPC endpoints.
@spec download_response(Req.Response.t()) :: response_download()
Send an RPC request to a Dropbox endpoint, JSON-encoding body when given.
Same as post/3 but against an explicit base URL (used by content endpoints
that speak JSON, such as /files/get_thumbnail_batch).
@spec process_response(Req.Response.t()) :: response()
Upload data (iodata or enumerable) as the raw request body.
Used by content endpoints that take bytes directly instead of a local file.
Upload the file at local path file as the raw request body.
The file is streamed, so large files are not loaded into memory at once.
Base URL for content (upload/download) endpoints.