postFunctions method
Publishes a serverless function under the caller's org and answers 201 with it.
Publishes a serverless function under the caller's org and answers 201 with it. The name is the key and is claimed once; the names that would shadow a collection route are reserved. runtime and environment are the same field — either spelling is accepted — and default to node. Bounds are clamped rather than refused where a clamp is honest: a timeout above the 900-second ceiling becomes the ceiling instead of silently reverting to the 30-second default, and an omitted memory limit becomes 256Mi. target=fleet runs on the org's own GPU fleet and supports runtime=python only. Requires a validated principal; the function is owned by that principal's org.
Parameters:
- Definition definition (required):
Implementation
Future<FunctionView?> postFunctions(Definition definition,) async {
final response = await postFunctionsWithHttpInfo(definition,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'FunctionView',) as FunctionView;
}
return null;
}