View Source Appwrite.Helpers.Client (appwrite v0.1.4)
Client module for handling requests to Appwrite.
Summary
Functions
Makes an HTTP call using the given method, URL, headers, and parameters.
Handles chunked uploads for large files.
Creates a new client instance with default configuration.
Prepares an HTTP request with the specified method, URL, headers, and parameters.
Sets the API endpoint.
Sets the realtime endpoint.
Sets the JWT.
Sets the locale.
Sets the project ID.
Sets the session.
Types
Functions
call(method, url, headers \\ %{}, params \\ %{}, response_type \\ "json")
View SourceMakes an HTTP call using the given method, URL, headers, and parameters.
Parameters
method
: HTTP method.url
: Target URL.headers
: Map of headers.params
: Parameters for the request.response_type
: Type of response expected (default:"json"
).
Returns
- Response data or raises an
AppwriteException
on error.
chunked_upload(method, url, headers \\ %{}, payload \\ %{}, on_progress \\ nil)
View Source@spec chunked_upload( method(), url(), headers(), params(), (Appwrite.Types.Client.UploadProgress.t() -> any()) ) :: any()
Handles chunked uploads for large files.
Parameters
method
: HTTP method (e.g., "POST").url
: Target URL.headers
: Map of headers.payload
: Original payload with file details.on_progress
: Function to call with progress updates.
Returns
- Response from the final chunk.
Creates a new client instance with default configuration.
Prepares an HTTP request with the specified method, URL, headers, and parameters.
Parameters
method
: HTTP method as a string (e.g., "GET", "POST").url
: Base URL as a string.headers
: Map of headers (default:%{}
).params
: Map of query or body parameters (default:%{}
).
Returns
- Tuple containing the URI and options for the request.
Sets the API endpoint.
Parameters
client
: The current client instance.endpoint
: The API endpoint.
Returns
- Updated client instance.
Sets the realtime endpoint.
Parameters
client
: The current client instance.endpoint_realtime
: The realtime endpoint.
Returns
- Updated client instance.
Sets the JWT.
Parameters
client
: The current client instance.jwt
: The JSON Web Token.
Returns
- Updated client instance.
Sets the locale.
Parameters
client
: The current client instance.locale
: The locale string.
Returns
- Updated client instance.
Sets the project ID.
Parameters
client
: The current client instance.project
: The project ID.
Returns
- Updated client instance.
Sets the session.
Parameters
client
: The current client instance.session
: The session string.
Returns
- Updated client instance.