Skip to content

Latest commit

 

History

History
373 lines (257 loc) · 11.5 KB

RecipesApi.md

File metadata and controls

373 lines (257 loc) · 11.5 KB

nc_cookbook_api.api.RecipesApi

Load the API package

import 'package:nc_cookbook_api/api.dart';

All URIs are relative to http://localhost:8000/apps/cookbook

Method HTTP request Description
callImport POST /api/v1/import Import a recipe using schema.org metadata from a website
deleteRecipe DELETE /api/v1/recipes/{id} Delete an existing recipe
getImage GET /api/v1/recipes/{id}/image Get the main image of a recipe. If no image is stored a fallback image is delivered.
listRecipes GET /api/v1/recipes Get all recipes in the database
newRecipe POST /api/v1/recipes Create a new recipe
recipeDetails GET /api/v1/recipes/{id} Get a single recipe from the server
search GET /api/v1/search/{query} Search for recipes for keywords, tags and categories with the named search string
updateRecipe PUT /api/v1/recipes/{id} Update a recipe

callImport

Recipe callImport(url)

Import a recipe using schema.org metadata from a website

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final Url url = ; // Url | 

try {
    final response = api.callImport(url);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->callImport: $e\n');
}

Parameters

Name Type Description Notes
url Url

Return type

Recipe

Authorization

app_password

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

deleteRecipe

String deleteRecipe(id)

Delete an existing recipe

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final String id = id_example; // String | The id of the recipe

try {
    final response = api.deleteRecipe(id);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->deleteRecipe: $e\n');
}

Parameters

Name Type Description Notes
id String The id of the recipe

Return type

String

Authorization

app_password

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getImage

Uint8List getImage(id, size)

Get the main image of a recipe. If no image is stored a fallback image is delivered.

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final String id = id_example; // String | The id of the recipe to obtain the image for.
final String size = size_example; // String | The size of the requested image * `full`    - Full resolution image (size full res) * `thumb`   - thumbnail of the image (size 250px) * `thumb16` - icon of the image (size 16px) by default the full size image will be returned 

try {
    final response = api.getImage(id, size);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->getImage: $e\n');
}

Parameters

Name Type Description Notes
id String The id of the recipe to obtain the image for.
size String The size of the requested image * full - Full resolution image (size full res) * thumb - thumbnail of the image (size 250px) * thumb16 - icon of the image (size 16px) by default the full size image will be returned [optional]

Return type

Uint8List

Authorization

app_password

HTTP request headers

  • Content-Type: Not defined
  • Accept: image/jpeg, image/svg+xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listRecipes

BuiltList listRecipes()

Get all recipes in the database

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();

try {
    final response = api.listRecipes();
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->listRecipes: $e\n');
}

Parameters

This endpoint does not need any parameter.

Return type

BuiltList<RecipeStub>

Authorization

app_password

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

newRecipe

int newRecipe(recipe)

Create a new recipe

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final Recipe recipe = ; // Recipe | A JSON representation of the recipe to be saved.  See also the structure at https://schema.org/Recipe 

try {
    final response = api.newRecipe(recipe);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->newRecipe: $e\n');
}

Parameters

Name Type Description Notes
recipe Recipe A JSON representation of the recipe to be saved. See also the structure at https://schema.org/Recipe

Return type

int

Authorization

app_password

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

recipeDetails

Recipe recipeDetails(id)

Get a single recipe from the server

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final String id = id_example; // String | The id of the recipe

try {
    final response = api.recipeDetails(id);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->recipeDetails: $e\n');
}

Parameters

Name Type Description Notes
id String The id of the recipe

Return type

Recipe

Authorization

app_password

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

search

BuiltList search(query)

Search for recipes for keywords, tags and categories with the named search string

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final String query = query_example; // String | The search string, urlencoded, separated with spaces and/or commas

try {
    final response = api.search(query);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->search: $e\n');
}

Parameters

Name Type Description Notes
query String The search string, urlencoded, separated with spaces and/or commas

Return type

BuiltList<RecipeStub>

Authorization

app_password

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

updateRecipe

int updateRecipe(id, recipe)

Update a recipe

Example

import 'package:nc_cookbook_api/api.dart';
// TODO Configure HTTP basic authorization: app_password
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').username = 'YOUR_USERNAME'
//defaultApiClient.getAuthentication<HttpBasicAuth>('app_password').password = 'YOUR_PASSWORD';

final api = NcCookbookApi().getRecipesApi();
final String id = id_example; // String | The id of the recipe
final Recipe recipe = ; // Recipe | 

try {
    final response = api.updateRecipe(id, recipe);
    print(response);
} catch on DioError (e) {
    print('Exception when calling RecipesApi->updateRecipe: $e\n');
}

Parameters

Name Type Description Notes
id String The id of the recipe
recipe Recipe

Return type

int

Authorization

app_password

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]