newRecipe method
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:
- $newRecipe_Request for the request send by this method.
- $newRecipe_Serializer for a converter to parse the
Response
from an executed request.
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);
}