Class: Supabase::Functions::Async::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/supabase/functions/async/client.rb

Overview

Async counterpart to Client.

Inherits the full public surface (invoke, set_auth) and rewires only the Faraday adapter to async-http-faraday so HTTP I/O yields back to the Async reactor instead of blocking the thread.

Call sites must run inside an ‘Async do … end` block; outside one, the adapter still works but loses the concurrency win.

require "supabase/functions/async"
require "async"

functions = Supabase::Functions::Async::Client.new(
  base_url: "https://project.supabase.co/functions/v1",
  headers:  { "Authorization" => "Bearer #{key}" }
)

Async do |task|
  calls = function_names.map do |name|
    task.async { functions.invoke(name, body: { id: 1 }) }
  end
  calls.map(&:wait)
end

Constant Summary

Constants inherited from Client

Client::VALID_METHODS

Instance Attribute Summary

Attributes inherited from Client

#base_url, #headers

Method Summary

Methods inherited from Client

#initialize, #invoke, #set_auth

Constructor Details

This class inherits a constructor from Supabase::Functions::Client