Gemini.Client (GeminiEx v0.0.2)

View Source

Main client module that delegates to the appropriate HTTP client implementation.

This module provides a unified interface for making HTTP requests to the Gemini API, abstracting away the specific implementation details of the underlying HTTP client.

Summary

Functions

Make a GET request using the configured authentication.

Make a POST request using the configured authentication.

Make an authenticated HTTP request.

Stream a POST request for Server-Sent Events using configured authentication.

Stream a POST request with specific authentication configuration.

Functions

get(path, opts \\ [])

Make a GET request using the configured authentication.

Parameters

  • path - The API path to request
  • opts - Optional keyword list of request options

Returns

  • {:ok, response} - Successful response
  • {:error, Error.t()} - Error details

post(path, body, opts \\ [])

Make a POST request using the configured authentication.

Parameters

  • path - The API path to request
  • body - The request body (will be JSON encoded)
  • opts - Optional keyword list of request options

Returns

  • {:ok, response} - Successful response
  • {:error, Error.t()} - Error details

request(method, path, body, auth_config, opts \\ [])

Make an authenticated HTTP request.

Parameters

  • method - HTTP method (:get, :post, etc.)
  • path - The API path to request
  • body - The request body (nil for GET requests)
  • auth_config - Authentication configuration
  • opts - Optional keyword list of request options

Returns

  • {:ok, response} - Successful response
  • {:error, Error.t()} - Error details

stream_post(path, body, opts \\ [])

Stream a POST request for Server-Sent Events using configured authentication.

Parameters

  • path - The API path to request
  • body - The request body (will be JSON encoded)
  • opts - Optional keyword list of request options

Returns

  • {:ok, events} - Successful stream response with parsed events
  • {:error, Error.t()} - Error details

stream_post_with_auth(path, body, auth_config, opts \\ [])

Stream a POST request with specific authentication configuration.

Parameters

  • path - The API path to request
  • body - The request body (will be JSON encoded)
  • auth_config - Authentication configuration
  • opts - Optional keyword list of request options

Returns

  • {:ok, events} - Successful stream response with parsed events
  • {:error, Error.t()} - Error details