newRecipe method

Future<DynamiteResponse<int, void>> newRecipe({
  1. required Recipe $body,
})

Create a new recipe.

Returns a Future containing a DynamiteResponse with the status code, deserialized body and headers. Throws a DynamiteApiException if the API call does not return an expected status code.

Request body: $body A JSON representation of the recipe to be saved.

See also the structure at https://schema.org/Recipe

Status codes:

  • 200: Successfully created new recipe
  • 409: A recipe with the name was already found on the server. No recipe is created.
  • 422: There was no name in the request given for the recipe. Cannot save the recipe.

See:

Implementation

Future<_i1.DynamiteResponse<int, void>> newRecipe({required Recipe $body}) async {
  final _request = $newRecipe_Request(
    $body: $body,
  );
  final _streamedResponse = await _rootClient.httpClient.send(_request);
  final _response = await _i3.Response.fromStream(_streamedResponse);

  final _serializer = $newRecipe_Serializer();
  return _i1.ResponseConverter<int, void>(_serializer).convert(_response);
}