View Source GoogleAI.Http (google_ai v0.1.1)
HTTP utilities for GoogleAI APIs.
Summary
Functions
Dispatch a GET request with the given client
.
Dispatch a POST request for the given model
and action
.
Types
@type response(body_type) :: {:ok, body_type} | {:error, Exception.t()}
The structure of data returned from the post function.
Functions
@spec get(client :: Req.Request.t()) :: response()
Dispatch a GET request with the given client
.
Arguments
:client
- AReq.Request
configured to dispatch as a GET request.
Returns
A tuple indicating success or failure and containing the request body.
@spec post(model :: GoogleAI.Model.t(), action :: String.t(), json :: map()) :: response()
Dispatch a POST request for the given model
and action
.
Arguments
:model
- AGoogleAI.Model
to use for the request.:action
- The action to dispatch for the model.:json
- The JSON body to send with the request.
Returns
A tuple indicating success or failure and containing the request body.