View Source GoogleAI.Http (google_ai v0.1.0)

HTTP utilities for GoogleAI APIs.

Summary

Types

The structure of data returned from the post function.

Functions

Dispatch a GET request with the given client.

Dispatch a POST request for the given model and action.

Types

@type response() :: response(map())
@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 - A Req.Request configured to dispatch as a GET request.

Returns

A tuple indicating success or failure and containing the request body.

Link to this function

post(model, action, json)

View Source
@spec post(model :: GoogleAI.Model.t(), action :: String.t(), json :: map()) ::
  response()

Dispatch a POST request for the given model and action.

Arguments

  • :model - A GoogleAI.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.