View Source Intercom.API (intercom_elixir v3.0.0)
Provides direct access to the Intercom API if other modules in this package don't provide the functionality you need.
See https://developers.intercom.com/intercom-api-reference/reference
Link to this section Summary
Functions
Call an Intercom API endpoint.
Link to this section Types
@type metadata() :: %{ :response => map(), :rate_limit => %{ limit: integer() | nil, reset: %DateTime{ calendar: term(), day: term(), hour: term(), microsecond: term(), minute: term(), month: term(), second: term(), std_offset: term(), time_zone: term(), utc_offset: term(), year: term(), zone_abbr: term() } | nil, remaining: integer() | nil }, optional(:pagination) => metadata_pagination(), optional(:errors) => [map()] }
@type response() :: single_success() | multiple_success() | error()
Link to this section Functions
@spec call_endpoint(:get, String.t(), nil, [opts()]) :: response()
@spec call_endpoint(:post, String.t(), map() | nil, [opts()]) :: response()
Call an Intercom API endpoint.
Arguments:
method
: The HTTP request method.path
: The request path, e.g"users/1234"
.body
: The body of the request. Optional.opts
: Will be added either to the query part of the url (get) or the body of the request (post). Optional.per_page
: Results per page if result is a list, has to be between 1 and 150.starting_after
: Hash returned by the intercom API to get next page of results.
Returns {:ok, data, metadata}
or {:error, error_code, metadata}
.