callFunction method

Future<Response> callFunction(
  1. String url, {
  2. Map<String, String?>? query,
  3. Map<String, dynamic>? jsonBody,
  4. String httpMethod = 'post',
})

Invokes the serverless function at url.

By default, the serverless function is invoked using an HTTP POST, so both a request body and query variables can be provided.

The HTTP method used for the call can be overridden via httpMethod.

Throws an ApiException if a failure occurs.

Implementation

Future<http.Response> callFunction(
  String url, {
  Map<String, String?>? query,
  Map<String, dynamic>? jsonBody,
  String httpMethod = 'post',
}) async {
  log.finer('Calling function, url=$url');

  return _apiClient.request<http.Response>(
    httpMethod,
    url,
    query: query,
    jsonBody: jsonBody,
    headers: _session.authenticationHeaders,
  );
}