postFunctionsByNameInvokeWithHttpInfo method

Future<Response> postFunctionsByNameInvokeWithHttpInfo(
  1. String name,
  2. InvokeReq invokeReq
)

Runs a function and records a REAL invocation.

Runs a function and records a REAL invocation. The answer is the invocation record whatever happened to it: 200 when the org's code ran clean, 502 when it ran and failed, 503 when this deployment has no sandbox to run code in. The record IS the evidence, so it rides the failure rather than being replaced by an error envelope. Billing is two-part and both parts are prepaid-then-metered on the one shared meter: a flat per-invocation request fee, gated BEFORE any sandbox compute runs so an unfunded org gets 402 and nothing executes, and a usage-native GB-seconds compute debit taken after the run. Either is independently free when its fee is zero, so an operator can bill by request alone, by compute alone, or by both — and a zero request fee removes the balance gate with it. A TRANSPORT failure is not charged: the sandbox being unreachable ran no billable compute. Code that ran and exited non-zero IS charged — that is a successful invocation of a failing program, not a billing failure. When the sandbox is not configured on this deployment, a non-fleet function fails closed before anything is recorded — no execution and no fabricated output. Scoped to the caller's org; requires a validated principal.

Note: This method returns the HTTP Response.

Parameters:

Implementation

Future<Response> postFunctionsByNameInvokeWithHttpInfo(String name, InvokeReq invokeReq,) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/functions/{name}/invoke'
    .replaceAll('{name}', name);

  // ignore: prefer_final_locals
  Object? postBody = invokeReq;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  const contentTypes = <String>['application/json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}