View Source TxtaiEx.Api (txtai_ex v0.1.1)
Base module for interfacing with a remote txtai service via REST API calls.
Summary
Functions
Executes a GET request to the specified API method with optional query parameters.
Initializes a new API struct with the given URL and token.
Executes a POST request to the specified API method with given parameters.
Functions
Executes a GET request to the specified API method with optional query parameters.
Parameters
- api: The API struct containing configuration for URL and token.
- method: The API method to be called.
- params: A map of query parameters for the GET request.
Returns
- on successful request, where
response
is the JSON-decoded response body. - on failure, with
reason
detailing the error.
Initializes a new API struct with the given URL and token.
Parameters
- url: The base URL of the txtai API.
- token: The authentication token for the txtai API.
Returns
- An %API{} struct populated with the base URL and token.
Executes a POST request to the specified API method with given parameters.
Parameters
- api: The API struct containing configuration for URL and token.
- method: The API method to be called.
- params: A map or list representing the POST request body.
Returns
- on successful request, where
response
is the JSON-decoded response body. - on failure, with
reason
detailing the error.