pub struct FunctionsClient { /* private fields */ }Expand description
Client for Supabase Edge Functions at {project}/functions/v1/.
Cloning is cheap: the HTTP connection pool is shared.
Implementations§
Source§impl FunctionsClient
impl FunctionsClient
Sourcepub fn new(project_url: &Url, api_key: &str) -> Result<Self, FunctionsError>
pub fn new(project_url: &Url, api_key: &str) -> Result<Self, FunctionsError>
Creates a client for the project base URL, for example https://abc.supabase.co/.
The client sends apikey on every request. Legacy JWT keys are also sent as
Authorization: Bearer <api_key>; new-format keys (sb_publishable_..., sb_secret_...) are not.
The built-in HTTP client follows redirects only within the same origin (scheme, host, port), up to 10 hops, so credentials never reach another host.
§Errors
Returns an error when the URL cannot hold a path, the key is not a valid header value, or the HTTP client cannot be built.
Sourcepub fn new_with_client(
project_url: &Url,
api_key: &str,
http: Client,
) -> Result<Self, FunctionsError>
pub fn new_with_client( project_url: &Url, api_key: &str, http: Client, ) -> Result<Self, FunctionsError>
Sourcepub fn with_access_token(&self, token: &str) -> Result<Self, FunctionsError>
pub fn with_access_token(&self, token: &str) -> Result<Self, FunctionsError>
Returns a copy of the client that sends Authorization: Bearer <token>.
Use this to call functions as a signed-in user.
§Errors
Returns an error when the token is not a valid header value.
Sourcepub fn invoke(&self, name: &str) -> InvokeBuilder
pub fn invoke(&self, name: &str) -> InvokeBuilder
Starts a request to the function name. The default method is POST.
The name must be non-empty, must not be . or .., and must not contain /, tab,
CR, or LF. The builder reports an
invalid name when you call InvokeBuilder::send.