IncidentIo.Client (IncidentIo v0.3.0)

View Source

Creates a HTTP client for interacting with the Incident.io API.

Summary

Functions

Creates a client with no authentication and the default endpoint.

Creates a client with a custom endpoint and no authentication, or with API key authentication and the default endpoint.

Creates a client with API key authentication and a custom endpoint.

Types

auth()

@type auth() :: %{api_key: binary()}

t()

@type t() :: %IncidentIo.Client{auth: auth() | nil, endpoint: binary()}

Functions

new()

@spec new() :: t()

Creates a client with no authentication and the default endpoint.

Example

IncidentIo.Client.new()

new(endpoint)

@spec new(binary()) :: t()
@spec new(map()) :: t()

Creates a client with a custom endpoint and no authentication, or with API key authentication and the default endpoint.

The endpoint must be a binary URL. A trailing / is appended automatically if not present.

Examples

IncidentIo.Client.new("https://api.example.com/")

IncidentIo.Client.new(%{api_key: "your-api-key"})

new(auth, endpoint)

@spec new(map(), binary()) :: t()
@spec new(auth(), binary()) :: t()

Creates a client with API key authentication and a custom endpoint.

The endpoint must be a binary URL. A trailing / is appended automatically if not present.

Example

IncidentIo.Client.new(%{api_key: "your-api-key"}, "https://api.example.com/")