Skip to content

arroyoj/nextcloud_cookbook_dart_api

 
 

Repository files navigation

nc_cookbook_api (EXPERIMENTAL)

This repo contains a computer generated lib for the nextcloud cookbook app. It is an intermediate lib until the great nextcloud dart library is ready to support both the cookbook api and some other serialisation candy we need.


This is the public API definition of the cookbook app for the nextcloud server.

The total API is separated into two parts:

  • There is the public API part that can be used from 3rd party apps and scripts.
  • There is the internal API that is used only by the web app of the cookbook app. This is described here.

The internal part is intended only to be used by the internal web app. It uses session based authentication and thus requires a requesttoken to protect against CSRF attacks. The generation and updating of these tokens is not part of the app but the regular browser capabilities and the nextcloud web frontend is used here instead.

In contrast, the External APIs are intended for use by external services. These endpoints require the user credentials to be present in every request. Thus, no session is created and no cookies or similar needs to be handled. Technically, there is a CORS preflight possible but it is not required for the function of the endpoints.

Further contact can be found on the matrix.org server in the room #nextcloud-cookbook:matrix.org for general questions. Additionally, there is #nextcloud-cookbook-integration:matrix.org for questions related to the API and third party integration. Further information on the different versions can be found in the API overview page.

This Dart package is automatically generated by the OpenAPI Generator project:

  • API version: 0.1.0
  • Build package: org.openapitools.codegen.languages.DartDioClientCodegen

Requirements

Installation & Usage

pub.dev

To use the package from pub.dev, please include the following in pubspec.yaml

dependencies:
  nc_cookbook_api: 0.1.0

Github

If this Dart package is published to Github, please include the following in pubspec.yaml

dependencies:
  nc_cookbook_api:
    git:
      url: https://github.com/GIT_USER_ID/GIT_REPO_ID.git
      #ref: main

Local development

To use the package from your local drive, please include the following in pubspec.yaml

dependencies:
  nc_cookbook_api:
    path: /path/to/nc_cookbook_api

Getting Started

Please follow the installation procedure and then run the following:

import 'package:nc_cookbook_api/nc_cookbook_api.dart';


final api = NcCookbookApi().getCategoriesApi();

try {
    final response = await api.listCategories();
    print(response);
} catch on DioError (e) {
    print("Exception when calling CategoriesApi->listCategories: $e\n");
}

Documentation for API Endpoints

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

Class Method HTTP request Description
CategoriesApi listCategories GET /api/v1/categories Get all known categories
CategoriesApi recipesInCategory GET /api/v1/category/{category} Get all recipes of a certain category
CategoriesApi renameCategory PUT /api/v1/category/{category} Rename a category
MiscApi getConfig GET /api/v1/config Get the current configuration of the app
MiscApi reindex POST /api/v1/reindex Trigger a rescan of all recipes into the caching database
MiscApi setConfig POST /api/v1/config Set the configuration for the current user
MiscApi version GET /api/version Get the version of the API endpoint
RecipesApi callImport POST /api/v1/import Import a recipe using schema.org metadata from a website
RecipesApi deleteRecipe DELETE /api/v1/recipes/{id} Delete an existing recipe
RecipesApi getImage GET /api/v1/recipes/{id}/image Get the main image of a recipe. If no image is stored a fallback image is delivered.
RecipesApi listRecipes GET /api/v1/recipes Get all recipes in the database
RecipesApi newRecipe POST /api/v1/recipes Create a new recipe
RecipesApi recipeDetails GET /api/v1/recipes/{id} Get a single recipe from the server
RecipesApi search GET /api/v1/search/{query} Search for recipes for keywords, tags and categories with the named search string
RecipesApi updateRecipe PUT /api/v1/recipes/{id} Update a recipe
TagsApi listKeywords GET /api/v1/keywords Get all known keywords
TagsApi recipesWithKeyword GET /api/v1/tags/{keywords} Get all recipes associated with certain keywords

Documentation For Models

Documentation For Authorization

app_password

  • Type: HTTP basic authentication

Author

About

Generated dart api for the nextcloud cookbook app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 99.7%
  • Shell 0.3%