GSS. Client
(elixir_google_spreadsheets v1.0.0)
Copy Markdown
Model of Client abstraction This process is a Producer for this GenStage pipeline.
Summary
Functions
Read config settings scoped for GSS client.
Divide request into to partitions :read and :write
Issues an HTTP request with the given method to the given URL using Finch.
Starts a task with request that must be awaited on.
Types
@type event() :: {:request, GenStage.from(), GSS.Client.RequestParams.t()}
@type partition() :: :write | :read
@type response() :: {:ok, Finch.Response.t()} | {:error, Exception.t()}
Functions
Read config settings scoped for GSS client.
Divide request into to partitions :read and :write
@spec request(atom(), binary(), binary() | iodata(), headers(), Keyword.t()) :: {:ok, Finch.Response.t()} | {:error, Exception.t()}
Issues an HTTP request with the given method to the given URL using Finch.
This function is usually used indirectly by helper functions such as get/3, post/4, put/4, etc.
Arguments
method: HTTP method as an atom (e.g.,:get,:head,:post,:put,:delete, etc.).url: Target URL as a binary string.body: Request body as abinary()oriodata().headers: HTTP headers as a list of two-element tuples (e.g.,[{"Accept", "application/json"}]).options: A keyword list of options.:result_timeout– timeout (in milliseconds) for the underlyingGenStage.call/3. This key is consumed by the library and is not forwarded to Finch. When omitted it falls back to the:result_timeoutclient config. May be an integer or:infinity.:pool_timeout,:receive_timeout,:request_timeout– forwarded toFinch.request/3(see theFinchdocumentation for their semantics). Any other keys are ignored by the request worker.
Returns
- On success, returns
{:ok, %Finch.Response{}}. - On failure, returns
{:error, reason}wherereasonis an exception.
Examples
request(:post, "https://my.website.com", "{"foo": 3}", [{"Accept", "application/json"}])
Starts a task with request that must be awaited on.
@spec start_link(any()) :: GenServer.on_start()