Supabase.Fetcher.Behaviour behaviour (supabase_potion v0.6.1)
Defines Supabase HTTP Clients callbacks
Summary
Types
The response handler for streaming responses. It receives the response status, headers, and body as input.
Types
@type on_response() :: (on_response_input() -> :ok | {:ok, term()} | {:error, Supabase.Error.t()})
The response handler for streaming responses. It receives the response status, headers, and body as input.
Note that here only the status and headers are consumed from the stream and so the body reamins unconsumed for custom operations, receiving each chunk of the body as it arrives.
It needs to return either :ok
or {:ok, body}
or {:error, Supabase.Error}
.
@type on_response_input() :: {Supabase.Fetcher.status(), Supabase.Fetcher.headers(), body :: Enumerable.t()}
Callbacks
@callback request(Supabase.Fetcher.Request.t()) :: Supabase.result(Supabase.Fetcher.Response.t())
@callback request_async(Supabase.Fetcher.Request.t()) :: Supabase.result(Supabase.Fetcher.Response.t())
@callback stream(Supabase.Fetcher.Request.t()) :: Supabase.result(Supabase.Fetcher.Response.t())
@callback stream(Supabase.Fetcher.Request.t(), on_response()) :: Supabase.result(Supabase.Fetcher.Response.t())
@callback upload(Supabase.Fetcher.Request.t(), filepath :: Path.t()) :: Supabase.result(Supabase.Fetcher.Response.t())