From 2e013e7b4380957c74a6ee91dcb327ac32f3b7c9 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Fri, 24 Feb 2023 23:17:12 +0100 Subject: [PATCH] add api endpoints and genereic views --- cookbook/serializer.py | 27 + cookbook/urls.py | 6 +- cookbook/views/api.py | 22 +- cookbook/views/lists.py | 30 + vue/src/utils/models.js | 1984 ++++++++++++++++++---------------- vue/src/utils/openapi/api.ts | 905 ++++++++++++++++ 6 files changed, 2031 insertions(+), 943 deletions(-) diff --git a/cookbook/serializer.py b/cookbook/serializer.py index a4fde05d4..f770623c2 100644 --- a/cookbook/serializer.py +++ b/cookbook/serializer.py @@ -724,6 +724,33 @@ class StepRecipeSerializer(WritableNestedModelSerializer): ) +class UnitConversionSerializer(WritableNestedModelSerializer): + base_unit = UnitSerializer() + converted_unit = UnitSerializer() + food = FoodSerializer(allow_null=True) + base_amount = CustomDecimalField() + converted_amount = CustomDecimalField() + + def create(self, validated_data): + validated_data['space'] = self.context['request'].space + validated_data['created_by'] = self.context['request'].user + return super().create(validated_data) + + class Meta: + model = UnitConversion + fields = ('id', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food') + + +class NutritionTypeSerializer(serializers.ModelSerializer): + def create(self, validated_data): + validated_data['space'] = self.context['request'].space + return super().create(validated_data) + + class Meta: + model = NutritionType + fields = ('id', 'name', 'icon', 'unit', 'description') + + class NutritionInformationSerializer(serializers.ModelSerializer): carbohydrates = CustomDecimalField() fats = CustomDecimalField() diff --git a/cookbook/urls.py b/cookbook/urls.py index f614863e5..a2423d504 100644 --- a/cookbook/urls.py +++ b/cookbook/urls.py @@ -12,7 +12,7 @@ from recipes.version import VERSION_NUMBER from .models import (Automation, Comment, CustomFilter, Food, InviteLink, Keyword, MealPlan, Recipe, RecipeBook, RecipeBookEntry, RecipeImport, ShoppingList, Step, Storage, Supermarket, SupermarketCategory, Sync, SyncLog, Unit, UserFile, - get_model_name, UserSpace, Space) + get_model_name, UserSpace, Space, NutritionType, UnitConversion) from .views import api, data, delete, edit, import_export, lists, new, telegram, views from .views.api import CustomAuthToken @@ -34,6 +34,8 @@ router.register(r'meal-type', api.MealTypeViewSet) router.register(r'recipe', api.RecipeViewSet) router.register(r'recipe-book', api.RecipeBookViewSet) router.register(r'recipe-book-entry', api.RecipeBookEntryViewSet) +router.register(r'unit-conversion', api.UnitConversionViewSet) +router.register(r'nutrition-type', api.NutritionTypeViewSet) router.register(r'shopping-list', api.ShoppingListViewSet) router.register(r'shopping-list-entry', api.ShoppingListEntryViewSet) router.register(r'shopping-list-recipe', api.ShoppingListRecipeViewSet) @@ -189,7 +191,7 @@ for m in generic_models: ) ) -vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory, Automation, UserFile, Step, CustomFilter] +vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory, Automation, UserFile, Step, CustomFilter, UnitConversion, NutritionType] for m in vue_models: py_name = get_model_name(m) url_name = py_name.replace('_', '-') diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 97b3e7c1f..f0b7cc347 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -65,7 +65,7 @@ from cookbook.models import (Automation, BookmarkletImport, CookLog, CustomFilte MealType, Recipe, RecipeBook, RecipeBookEntry, ShareLink, ShoppingList, ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage, Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, - SyncLog, Unit, UserFile, UserPreference, UserSpace, ViewLog) + SyncLog, Unit, UserFile, UserPreference, UserSpace, ViewLog, UnitConversion, NutritionType) from cookbook.provider.dropbox import Dropbox from cookbook.provider.local import Local from cookbook.provider.nextcloud import Nextcloud @@ -88,7 +88,7 @@ from cookbook.serializer import (AutomationSerializer, BookmarkletImportListSeri SupermarketCategorySerializer, SupermarketSerializer, SyncLogSerializer, SyncSerializer, UnitSerializer, UserFileSerializer, UserSerializer, UserPreferenceSerializer, - UserSpaceSerializer, ViewLogSerializer, AccessTokenSerializer, FoodSimpleSerializer, RecipeExportSerializer) + UserSpaceSerializer, ViewLogSerializer, AccessTokenSerializer, FoodSimpleSerializer, RecipeExportSerializer, UnitConversionSerializer, NutritionTypeSerializer) from cookbook.views.import_export import get_integration from recipes import settings @@ -921,6 +921,24 @@ class RecipeViewSet(viewsets.ModelViewSet): return Response(self.serializer_class(qs, many=True).data) +class UnitConversionViewSet(viewsets.ModelViewSet): + queryset = UnitConversion.objects + serializer_class = UnitConversionSerializer + permission_classes = [CustomIsUser & CustomTokenHasReadWriteScope] + + def get_queryset(self): + return self.queryset.filter(space=self.request.space) + + +class NutritionTypeViewSet(viewsets.ModelViewSet): + queryset = NutritionType.objects + serializer_class = NutritionTypeSerializer + permission_classes = [CustomIsUser & CustomTokenHasReadWriteScope] + + def get_queryset(self): + return self.queryset.filter(space=self.request.space) + + class ShoppingListRecipeViewSet(viewsets.ModelViewSet): queryset = ShoppingListRecipe.objects serializer_class = ShoppingListRecipeSerializer diff --git a/cookbook/views/lists.py b/cookbook/views/lists.py index 1da69f8fa..10732c9a0 100644 --- a/cookbook/views/lists.py +++ b/cookbook/views/lists.py @@ -228,3 +228,33 @@ def step(request): } } ) + + +@group_required('user') +def unit_conversion(request): + # model-name is the models.js name of the model, probably ALL-CAPS + return render( + request, + 'generic/model_template.html', + { + "title": _("Unit Conversions"), + "config": { + 'model': "UNIT_CONVERSION", # *REQUIRED* name of the model in models.js + } + } + ) + + +@group_required('user') +def nutrition_type(request): + # model-name is the models.js name of the model, probably ALL-CAPS + return render( + request, + 'generic/model_template.html', + { + "title": _("Unit Conversions"), + "config": { + 'model': "NUTRITION_TYPE", # *REQUIRED* name of the model in models.js + } + } + ) diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js index fd4898799..4f1fe3638 100644 --- a/vue/src/utils/models.js +++ b/vue/src/utils/models.js @@ -5,970 +5,1076 @@ // TODO this needs rethought and simplified // maybe a function that returns a single dictionary based on action? export class Models { - // Arrays correspond to ORDERED list of parameters required by ApiApiFactory - // Inner arrays are used to construct a dictionary of key:value pairs - // MODEL configurations will override MODEL_TYPE configurations with will override ACTION configurations + // Arrays correspond to ORDERED list of parameters required by ApiApiFactory + // Inner arrays are used to construct a dictionary of key:value pairs + // MODEL configurations will override MODEL_TYPE configurations with will override ACTION configurations - // MODEL_TYPES - inherited by MODELS, inherits and takes precedence over ACTIONS - static TREE = { - list: { - params: ["query", "root", "tree", "page", "pageSize", "options"], - config: { - root: { - default: { - function: "CONDITIONAL", - check: "query", - operator: "not_exist", - true: 0, - false: undefined, - }, - }, - tree: {default: undefined}, - }, - }, - delete: { - form: { - instruction: { - form_field: true, - type: "instruction", - function: "translate", - phrase: "del_confimation_tree", - params: [ - { - token: "source", - from: "item1", - attribute: "name", - }, - ], - }, - }, - }, - move: { - form: { - target: { - form_field: true, - type: "lookup", - field: "target", - list: "self", - sticky_options: [{id: 0, name: "tree_root"}], - }, - }, - }, - } + // MODEL_TYPES - inherited by MODELS, inherits and takes precedence over ACTIONS + static TREE = { + list: { + params: ["query", "root", "tree", "page", "pageSize", "options"], + config: { + root: { + default: { + function: "CONDITIONAL", + check: "query", + operator: "not_exist", + true: 0, + false: undefined, + }, + }, + tree: {default: undefined}, + }, + }, + delete: { + form: { + instruction: { + form_field: true, + type: "instruction", + function: "translate", + phrase: "del_confimation_tree", + params: [ + { + token: "source", + from: "item1", + attribute: "name", + }, + ], + }, + }, + }, + move: { + form: { + target: { + form_field: true, + type: "lookup", + field: "target", + list: "self", + sticky_options: [{id: 0, name: "tree_root"}], + }, + }, + }, + } - // MODELS - inherits and takes precedence over MODEL_TYPES and ACTIONS - static FOOD = { - name: "Food", // *OPTIONAL* : parameters will be built model -> model_type -> default - apiName: "Food", // *REQUIRED* : the name that is used in api.ts for this model - model_type: this.TREE, // *OPTIONAL* : model specific params for api, if not present will attempt modeltype_create then default_create - paginated: true, - move: true, - merge: true, - shop: true, - onhand: true, - badges: { - linked_recipe: true, - food_onhand: true, - shopping: true, - }, - tags: [{field: "supermarket_category", label: "name", color: "info"}], - // REQUIRED: unordered array of fields that can be set during create - create: { - // if not defined partialUpdate will use the same parameters, prepending 'id' - params: [ - [ - "name", - "plural_name", - "description", - "recipe", - "food_onhand", - "supermarket_category", - "inherit", - "inherit_fields", - "ignore_shopping", - "substitute", - "substitute_siblings", - "substitute_children", - "reset_inherit", - "child_inherit_fields", - ], - ], + // MODELS - inherits and takes precedence over MODEL_TYPES and ACTIONS + static FOOD = { + name: "Food", // *OPTIONAL* : parameters will be built model -> model_type -> default + apiName: "Food", // *REQUIRED* : the name that is used in api.ts for this model + model_type: this.TREE, // *OPTIONAL* : model specific params for api, if not present will attempt modeltype_create then default_create + paginated: true, + move: true, + merge: true, + shop: true, + onhand: true, + badges: { + linked_recipe: true, + food_onhand: true, + shopping: true, + }, + tags: [{field: "supermarket_category", label: "name", color: "info"}], + // REQUIRED: unordered array of fields that can be set during create + create: { + // if not defined partialUpdate will use the same parameters, prepending 'id' + params: [ + [ + "name", + "plural_name", + "description", + "recipe", + "food_onhand", + "supermarket_category", + "inherit", + "inherit_fields", + "ignore_shopping", + "substitute", + "substitute_siblings", + "substitute_children", + "reset_inherit", + "child_inherit_fields", + ], + ], - form: { - show_help: true, - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", // form.label always translated in utils.getForm() - placeholder: "", // form.placeholder always translated - subtitle_field: "full_name", - }, - plural_name: { - form_field: true, - type: "text", - field: "plural_name", - label: "Plural", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", // form.label always translated in utils.getForm() - placeholder: "", - }, - recipe: { - form_field: true, - type: "lookup", - field: "recipe", - list: "RECIPE", - label: "Recipe", // form.label always translated in utils.getForm() - help_text: "food_recipe_help", // form.help_text always translated - }, - onhand: { - form_field: true, - type: "checkbox", - field: "food_onhand", - label: "OnHand", - help_text: "OnHand_help", - }, - ignore_shopping: { - form_field: true, - type: "checkbox", - field: "ignore_shopping", - label: "Ignore_Shopping", - help_text: "ignore_shopping_help", - }, - shopping_category: { - form_field: true, - type: "lookup", - field: "supermarket_category", - list: "SHOPPING_CATEGORY", - label: "Shopping_Category", - allow_create: true, - help_text: "shopping_category_help", // form.help_text always translated - }, - substitute: { - form_field: true, - advanced: true, - type: "lookup", - multiple: true, - field: "substitute", - list: "FOOD", - label: "Substitutes", - allow_create: false, - help_text: "substitute_help", - }, - substitute_siblings: { - form_field: true, - advanced: true, - type: "checkbox", - field: "substitute_siblings", - label: "substitute_siblings", // form.label always translated in utils.getForm() - help_text: "substitute_siblings_help", // form.help_text always translated - condition: {field: "parent", value: true, condition: "field_exists"}, - }, - substitute_children: { - form_field: true, - advanced: true, - type: "checkbox", - field: "substitute_children", - label: "substitute_children", - help_text: "substitute_children_help", - condition: {field: "numchild", value: 0, condition: "gt"}, - }, - inherit_fields: { - form_field: true, - advanced: true, - type: "lookup", - multiple: true, - field: "inherit_fields", - list: "FOOD_INHERIT_FIELDS", - label: "InheritFields", - condition: {field: "food_children_exist", value: true, condition: "preference_equals"}, - help_text: "InheritFields_help", - }, - child_inherit_fields: { - form_field: true, - advanced: true, - type: "lookup", - multiple: true, - field: "child_inherit_fields", - list: "FOOD_INHERIT_FIELDS", - label: "ChildInheritFields", // form.label always translated in utils.getForm() - condition: {field: "numchild", value: 0, condition: "gt"}, - help_text: "ChildInheritFields_help", // form.help_text always translated - }, - reset_inherit: { - form_field: true, - advanced: true, - type: "checkbox", - field: "reset_inherit", - label: "reset_children", - help_text: "reset_children_help", - condition: {field: "numchild", value: 0, condition: "gt"}, - }, - form_function: "FoodCreateDefault", - }, - }, - shopping: { - params: ["id", ["id", "amount", "unit", "_delete"]], - }, - } - static FOOD_INHERIT_FIELDS = { - name: "FoodInherit", - apiName: "FoodInheritField", - } + form: { + show_help: true, + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", // form.label always translated in utils.getForm() + placeholder: "", // form.placeholder always translated + subtitle_field: "full_name", + }, + plural_name: { + form_field: true, + type: "text", + field: "plural_name", + label: "Plural", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", // form.label always translated in utils.getForm() + placeholder: "", + }, + recipe: { + form_field: true, + type: "lookup", + field: "recipe", + list: "RECIPE", + label: "Recipe", // form.label always translated in utils.getForm() + help_text: "food_recipe_help", // form.help_text always translated + }, + onhand: { + form_field: true, + type: "checkbox", + field: "food_onhand", + label: "OnHand", + help_text: "OnHand_help", + }, + ignore_shopping: { + form_field: true, + type: "checkbox", + field: "ignore_shopping", + label: "Ignore_Shopping", + help_text: "ignore_shopping_help", + }, + shopping_category: { + form_field: true, + type: "lookup", + field: "supermarket_category", + list: "SHOPPING_CATEGORY", + label: "Shopping_Category", + allow_create: true, + help_text: "shopping_category_help", // form.help_text always translated + }, + substitute: { + form_field: true, + advanced: true, + type: "lookup", + multiple: true, + field: "substitute", + list: "FOOD", + label: "Substitutes", + allow_create: false, + help_text: "substitute_help", + }, + substitute_siblings: { + form_field: true, + advanced: true, + type: "checkbox", + field: "substitute_siblings", + label: "substitute_siblings", // form.label always translated in utils.getForm() + help_text: "substitute_siblings_help", // form.help_text always translated + condition: {field: "parent", value: true, condition: "field_exists"}, + }, + substitute_children: { + form_field: true, + advanced: true, + type: "checkbox", + field: "substitute_children", + label: "substitute_children", + help_text: "substitute_children_help", + condition: {field: "numchild", value: 0, condition: "gt"}, + }, + inherit_fields: { + form_field: true, + advanced: true, + type: "lookup", + multiple: true, + field: "inherit_fields", + list: "FOOD_INHERIT_FIELDS", + label: "InheritFields", + condition: {field: "food_children_exist", value: true, condition: "preference_equals"}, + help_text: "InheritFields_help", + }, + child_inherit_fields: { + form_field: true, + advanced: true, + type: "lookup", + multiple: true, + field: "child_inherit_fields", + list: "FOOD_INHERIT_FIELDS", + label: "ChildInheritFields", // form.label always translated in utils.getForm() + condition: {field: "numchild", value: 0, condition: "gt"}, + help_text: "ChildInheritFields_help", // form.help_text always translated + }, + reset_inherit: { + form_field: true, + advanced: true, + type: "checkbox", + field: "reset_inherit", + label: "reset_children", + help_text: "reset_children_help", + condition: {field: "numchild", value: 0, condition: "gt"}, + }, + form_function: "FoodCreateDefault", + }, + }, + shopping: { + params: ["id", ["id", "amount", "unit", "_delete"]], + }, + } + static FOOD_INHERIT_FIELDS = { + name: "FoodInherit", + apiName: "FoodInheritField", + } - static KEYWORD = { - name: "Keyword", // *OPTIONAL: parameters will be built model -> model_type -> default - apiName: "Keyword", - model_type: this.TREE, - paginated: true, - move: true, - merge: true, - badges: { - icon: true, - }, - create: { - // if not defined partialUpdate will use the same parameters, prepending 'id' - params: [["name", "description", "icon"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - icon: { - form_field: true, - type: "emoji", - field: "icon", - label: "Icon", - }, - full_name: { - form_field: true, - type: "smalltext", - field: "full_name", - }, - }, - }, - } + static KEYWORD = { + name: "Keyword", // *OPTIONAL: parameters will be built model -> model_type -> default + apiName: "Keyword", + model_type: this.TREE, + paginated: true, + move: true, + merge: true, + badges: { + icon: true, + }, + create: { + // if not defined partialUpdate will use the same parameters, prepending 'id' + params: [["name", "description", "icon"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + icon: { + form_field: true, + type: "emoji", + field: "icon", + label: "Icon", + }, + full_name: { + form_field: true, + type: "smalltext", + field: "full_name", + }, + }, + }, + } - static UNIT = { - name: "Unit", - apiName: "Unit", - paginated: true, - create: { - params: [["name", "plural_name", "description",]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - plural_name: { - form_field: true, - type: "text", - field: "plural_name", - label: "Plural name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - }, - }, - merge: true, - } + static UNIT = { + name: "Unit", + apiName: "Unit", + paginated: true, + create: { + params: [["name", "plural_name", "description",]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + plural_name: { + form_field: true, + type: "text", + field: "plural_name", + label: "Plural name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + }, + }, + merge: true, + } - static SHOPPING_LIST = { - name: "Shopping_list", - apiName: "ShoppingListEntry", - list: { - params: ["id", "checked", "supermarket", "options"], - }, - create: { - params: [["amount", "unit", "food", "checked"]], - form: { - unit: { - form_field: true, - type: "lookup", - field: "unit", - list: "UNIT", - label: "Unit", - allow_create: true, - }, - food: { - form_field: true, - type: "lookup", - field: "food", - list: "FOOD", - label: "Food", // form.label always translated in utils.getForm() - allow_create: true, - }, - }, - }, - } + static SHOPPING_LIST = { + name: "Shopping_list", + apiName: "ShoppingListEntry", + list: { + params: ["id", "checked", "supermarket", "options"], + }, + create: { + params: [["amount", "unit", "food", "checked"]], + form: { + unit: { + form_field: true, + type: "lookup", + field: "unit", + list: "UNIT", + label: "Unit", + allow_create: true, + }, + food: { + form_field: true, + type: "lookup", + field: "food", + list: "FOOD", + label: "Food", // form.label always translated in utils.getForm() + allow_create: true, + }, + }, + }, + } - static RECIPE_BOOK = { - name: "Recipe_Book", - apiName: "RecipeBook", - create: { - params: [["name", "description", "icon", "filter"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - icon: { - form_field: true, - type: "emoji", - field: "icon", - label: "Icon", - }, - filter: { - form_field: true, - type: "lookup", - field: "filter", - label: "Custom Filter", - list: "CUSTOM_FILTER", - }, - }, - }, - } + static RECIPE_BOOK = { + name: "Recipe_Book", + apiName: "RecipeBook", + create: { + params: [["name", "description", "icon", "filter"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + icon: { + form_field: true, + type: "emoji", + field: "icon", + label: "Icon", + }, + filter: { + form_field: true, + type: "lookup", + field: "filter", + label: "Custom Filter", + list: "CUSTOM_FILTER", + }, + }, + }, + } - static SHOPPING_CATEGORY = { - name: "Shopping_Category", - apiName: "SupermarketCategory", - create: { - params: [["name", "description"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", // form.label always translated in utils.getForm() - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - }, - }, - } + static SHOPPING_CATEGORY = { + name: "Shopping_Category", + apiName: "SupermarketCategory", + create: { + params: [["name", "description"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", // form.label always translated in utils.getForm() + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + }, + }, + } - static SHOPPING_CATEGORY_RELATION = { - name: "Shopping_Category_Relation", - apiName: "SupermarketCategoryRelation", - create: { - params: [["category", "supermarket", "order"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - }, - }, - } + static SHOPPING_CATEGORY_RELATION = { + name: "Shopping_Category_Relation", + apiName: "SupermarketCategoryRelation", + create: { + params: [["category", "supermarket", "order"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + }, + }, + } - static SUPERMARKET = { - name: "Supermarket", - apiName: "Supermarket", - ordered_tags: [{field: "category_to_supermarket", label: "category::name", color: "info"}], - create: { - params: [["name", "description", "category_to_supermarket"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - categories: { - form_field: true, - type: "lookup", - list: "SHOPPING_CATEGORY", - list_label: "category::name", - ordered: true, // ordered lookups assume working with relation field - field: "category_to_supermarket", - label: "Categories", // form.label always translated in utils.getForm() - placeholder: "", - }, - }, - config: { - function: "SupermarketWithCategories", - }, - }, - partialUpdate: { - config: { - function: "SupermarketWithCategories", - }, - }, - } + static SUPERMARKET = { + name: "Supermarket", + apiName: "Supermarket", + ordered_tags: [{field: "category_to_supermarket", label: "category::name", color: "info"}], + create: { + params: [["name", "description", "category_to_supermarket"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + categories: { + form_field: true, + type: "lookup", + list: "SHOPPING_CATEGORY", + list_label: "category::name", + ordered: true, // ordered lookups assume working with relation field + field: "category_to_supermarket", + label: "Categories", // form.label always translated in utils.getForm() + placeholder: "", + }, + }, + config: { + function: "SupermarketWithCategories", + }, + }, + partialUpdate: { + config: { + function: "SupermarketWithCategories", + }, + }, + } - static AUTOMATION = { - name: "Automation", - apiName: "Automation", - paginated: true, - list: { - header_component: { - name: "BetaWarning", - }, - }, - create: { - params: [["name", "description", "type", "param_1", "param_2", "param_3", "order", "disabled"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - description: { - form_field: true, - type: "text", - field: "description", - label: "Description", - placeholder: "", - }, - type: { - form_field: true, - type: "choice", - options: [ - {value: "FOOD_ALIAS", text: "Food_Alias"}, - {value: "UNIT_ALIAS", text: "Unit_Alias"}, - {value: "KEYWORD_ALIAS", text: "Keyword_Alias"}, - {value: "DESCRIPTION_REPLACE", text: "Description_Replace"}, - {value: "INSTRUCTION_REPLACE", text: "Instruction_Replace"}, - ], - field: "type", - label: "Type", - placeholder: "", - }, - param_1: { - form_field: true, - type: "text", - field: "param_1", - label: { - function: "translate", - phrase: "parameter_count", - params: [ - { - token: "count", - attribute: "1", - }, - ], - }, - placeholder: "", - }, - param_2: { - form_field: true, - type: "text", - field: "param_2", - label: { - function: "translate", - phrase: "parameter_count", - params: [ - { - token: "count", - attribute: "2", - }, - ], - }, - placeholder: "", - }, - param_3: { - form_field: true, - type: "text", - field: "param_3", - label: { - function: "translate", - phrase: "parameter_count", - params: [ - { - token: "count", - attribute: "3", - }, - ], - }, - placeholder: "", - }, - order: { - form_field: true, - type: "number", - field: "order", - label: "Order", - placeholder: 0, - }, - disabled: { - form_field: true, - type: "checkbox", - field: "disabled", - label: "Disabled", - placeholder: "", - }, - form_function: "AutomationOrderDefault" - }, + static AUTOMATION = { + name: "Automation", + apiName: "Automation", + paginated: true, + list: { + header_component: { + name: "BetaWarning", + }, + }, + create: { + params: [["name", "description", "type", "param_1", "param_2", "param_3", "order", "disabled"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + type: { + form_field: true, + type: "choice", + options: [ + {value: "FOOD_ALIAS", text: "Food_Alias"}, + {value: "UNIT_ALIAS", text: "Unit_Alias"}, + {value: "KEYWORD_ALIAS", text: "Keyword_Alias"}, + {value: "DESCRIPTION_REPLACE", text: "Description_Replace"}, + {value: "INSTRUCTION_REPLACE", text: "Instruction_Replace"}, + ], + field: "type", + label: "Type", + placeholder: "", + }, + param_1: { + form_field: true, + type: "text", + field: "param_1", + label: { + function: "translate", + phrase: "parameter_count", + params: [ + { + token: "count", + attribute: "1", + }, + ], + }, + placeholder: "", + }, + param_2: { + form_field: true, + type: "text", + field: "param_2", + label: { + function: "translate", + phrase: "parameter_count", + params: [ + { + token: "count", + attribute: "2", + }, + ], + }, + placeholder: "", + }, + param_3: { + form_field: true, + type: "text", + field: "param_3", + label: { + function: "translate", + phrase: "parameter_count", + params: [ + { + token: "count", + attribute: "3", + }, + ], + }, + placeholder: "", + }, + order: { + form_field: true, + type: "number", + field: "order", + label: "Order", + placeholder: 0, + }, + disabled: { + form_field: true, + type: "checkbox", + field: "disabled", + label: "Disabled", + placeholder: "", + }, + form_function: "AutomationOrderDefault" + }, - }, - } + }, + } - static RECIPE = { - name: "Recipe", - apiName: "Recipe", - list: { - params: [ - "query", - "keywords", - "keywords_or", - "keywords_and", - "keywords_or_not", - "keywords_and_not", - "foods", - "foods_or", - "foods_and", - "foods_or_not", - "foods_and_not", - "units", - "rating", - "books", - "books_or", - "books_and", - "books_or_not", - "books_and_not", - "internal", - "random", - "_new", - "timescooked", - "cookedon", - "createdon", - "updatedon", - "viewedon", - "makenow", - "page", - "pageSize", - "options", - ], - }, - shopping: { - params: ["id", ["id", "list_recipe", "ingredients", "servings"]], - }, - } + static UNIT_CONVERSION = { + name: "Unit Conversion", + apiName: "UnitConversion", + paginated: false, + list: { + header_component: { + name: "BetaWarning", + }, + }, + create: { + params: [['base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food']], + form: { + // TODO add proper help texts for everything + base_amount: { + form_field: true, + type: "text", + field: "base_amount", + label: "base_amount", + placeholder: "", + }, + base_unit: { + form_field: true, + type: "lookup", + field: "base_unit", + list: "UNIT", + list_label: "name", + label: "Base Unit", + multiple: false, + }, + converted_amount: { + form_field: true, + type: "text", + field: "converted_amount", + label: "base_amount", + placeholder: "", + }, + converted_unit: { + form_field: true, + type: "lookup", + field: "converted_unit", + list: "UNIT", + list_label: "name", + label: "Converted Unit", + multiple: false, + }, + food: { + form_field: true, + type: "lookup", + field: "food", + list: "FOOD", + list_label: "Food", + label: "Food", + multiple: false, + }, - static CUSTOM_FILTER = { - name: "Custom Filter", - apiName: "CustomFilter", + }, - create: { - params: [["name", "search", "shared"]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", // form.label always translated in utils.getForm() - placeholder: "", - }, + }, + } - shared: { - form_field: true, - type: "lookup", - field: "shared", - list: "USER", - list_label: "display_name", - label: "shared_with", - multiple: true, - }, - }, - }, - } - static USER_NAME = { - name: "User", - apiName: "User", - list: { - params: ["filter_list"], - }, - } + static NUTRITION_TYPE = { + name: "Nutrition Type", + apiName: "NutritionType", + paginated: false, + list: { + header_component: { + name: "BetaWarning", + }, + }, + create: { + params: [['name', 'icon', 'unit', 'description']], + form: { - static MEAL_TYPE = { - name: "Meal_Type", - apiName: "MealType", - list: { - params: ["filter_list"], - }, - create: { - params: [["name",]], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - }, - }, - } + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + icon: { + form_field: true, + type: "emoji", + field: "icon", + label: "Icon", + placeholder: "", + }, + unit: { + form_field: true, + type: "text", + field: "unit", + label: "Unit", + placeholder: "", + }, + description: { + form_field: true, + type: "text", + field: "description", + label: "Description", + placeholder: "", + }, + }, - static MEAL_PLAN = { - name: "Meal_Plan", - apiName: "MealPlan", - list: { - params: ["options"], - }, - } + }, + } - static USERFILE = { - name: "File", - apiName: "UserFile", - paginated: false, - list: { - header_component: { - name: "StorageQuota", - }, - }, - create: { - params: ["name", "file"], - form: { - name: { - form_field: true, - type: "text", - field: "name", - label: "Name", - placeholder: "", - }, - file: { - form_field: true, - type: "file", - field: "file", - label: "File", // form.label always translated in utils.getForm() - placeholder: "", - }, - }, - }, - } + static RECIPE = { + name: "Recipe", + apiName: "Recipe", + list: { + params: [ + "query", + "keywords", + "keywords_or", + "keywords_and", + "keywords_or_not", + "keywords_and_not", + "foods", + "foods_or", + "foods_and", + "foods_or_not", + "foods_and_not", + "units", + "rating", + "books", + "books_or", + "books_and", + "books_or_not", + "books_and_not", + "internal", + "random", + "_new", + "timescooked", + "cookedon", + "createdon", + "updatedon", + "viewedon", + "makenow", + "page", + "pageSize", + "options", + ], + }, + shopping: { + params: ["id", ["id", "list_recipe", "ingredients", "servings"]], + }, + } - static INVITE_LINK = { - name: "InviteLink", - apiName: "InviteLink", - paginated: false, - create: { - params: [["email", "group", "valid_until", "reusable"]], - form: { - email: { - form_field: true, - type: "text", - field: "email", - label: "Email", - placeholder: "", - }, - group: { - form_field: true, - type: "lookup", - field: "group", - list: "GROUP", - list_label: "name", - label: "Group", - placeholder: "", - }, - valid_until: { - form_field: true, - type: "date", - field: "valid_until", - label: "Valid Until", - placeholder: "", - }, - reusable: { - form_field: true, - type: "checkbox", - field: "reusable", - label: "Reusable", - help_text: "reusable_help_text", - placeholder: "", - }, - }, - }, - } + static CUSTOM_FILTER = { + name: "Custom Filter", + apiName: "CustomFilter", - static ACCESS_TOKEN = { - name: "AccessToken", - apiName: "AccessToken", - paginated: false, - create: { - params: [["scope", "expires"]], - form: { - scope: { - form_field: true, - type: "text", - field: "scope", - label: "Scope", - placeholder: "", - }, - expires: { - form_field: true, - type: "date", - field: "expires", - label: "expires", - placeholder: "", - }, - }, - }, - } + create: { + params: [["name", "search", "shared"]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", // form.label always translated in utils.getForm() + placeholder: "", + }, - static USER = { - name: "User", - apiName: "User", - paginated: false, - } + shared: { + form_field: true, + type: "lookup", + field: "shared", + list: "USER", + list_label: "display_name", + label: "shared_with", + multiple: true, + }, + }, + }, + } + static USER_NAME = { + name: "User", + apiName: "User", + list: { + params: ["filter_list"], + }, + } - static GROUP = { - name: "Group", - apiName: "Group", - paginated: false, - } + static MEAL_TYPE = { + name: "Meal_Type", + apiName: "MealType", + list: { + params: ["filter_list"], + }, + create: { + params: [["name",]], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + }, + }, + } - static STEP = { - name: "Step", - apiName: "Step", - list: { - params: ["recipe", "query", "page", "pageSize", "options"], - }, - } + static MEAL_PLAN = { + name: "Meal_Plan", + apiName: "MealPlan", + list: { + params: ["options"], + }, + } + + static USERFILE = { + name: "File", + apiName: "UserFile", + paginated: false, + list: { + header_component: { + name: "StorageQuota", + }, + }, + create: { + params: ["name", "file"], + form: { + name: { + form_field: true, + type: "text", + field: "name", + label: "Name", + placeholder: "", + }, + file: { + form_field: true, + type: "file", + field: "file", + label: "File", // form.label always translated in utils.getForm() + placeholder: "", + }, + }, + }, + } + + static INVITE_LINK = { + name: "InviteLink", + apiName: "InviteLink", + paginated: false, + create: { + params: [["email", "group", "valid_until", "reusable"]], + form: { + email: { + form_field: true, + type: "text", + field: "email", + label: "Email", + placeholder: "", + }, + group: { + form_field: true, + type: "lookup", + field: "group", + list: "GROUP", + list_label: "name", + label: "Group", + placeholder: "", + }, + valid_until: { + form_field: true, + type: "date", + field: "valid_until", + label: "Valid Until", + placeholder: "", + }, + reusable: { + form_field: true, + type: "checkbox", + field: "reusable", + label: "Reusable", + help_text: "reusable_help_text", + placeholder: "", + }, + }, + }, + } + + static ACCESS_TOKEN = { + name: "AccessToken", + apiName: "AccessToken", + paginated: false, + create: { + params: [["scope", "expires"]], + form: { + scope: { + form_field: true, + type: "text", + field: "scope", + label: "Scope", + placeholder: "", + }, + expires: { + form_field: true, + type: "date", + field: "expires", + label: "expires", + placeholder: "", + }, + }, + }, + } + + static USER = { + name: "User", + apiName: "User", + paginated: false, + } + + static GROUP = { + name: "Group", + apiName: "Group", + paginated: false, + } + + static STEP = { + name: "Step", + apiName: "Step", + list: { + params: ["recipe", "query", "page", "pageSize", "options"], + }, + } } export class Actions { - static CREATE = { - function: "create", - form: { - title: { - function: "translate", - phrase: "create_title", - params: [ - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - ok_label: {function: "translate", phrase: "Save"}, - }, - } - static UPDATE = { - function: "partialUpdate", - // special case for update only - updated assumes create form is sufficient, but a different title is required. - form_title: { - function: "translate", - phrase: "edit_title", - params: [ - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - } - static DELETE = { - function: "destroy", - params: ["id"], - form: { - title: { - function: "translate", - phrase: "delete_title", - params: [ - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - ok_label: {function: "translate", phrase: "Delete"}, - instruction: { - form_field: true, - type: "instruction", - label: { - function: "translate", - phrase: "delete_confirmation", - params: [ - { - token: "source", - from: "item1", - attribute: "name", - }, - ], - }, - }, - }, - } - static FETCH = { - function: "retrieve", - params: ["id"], - } - static LIST = { - function: "list", - suffix: "s", - params: ["query", "page", "pageSize", "options"], - config: { - query: {default: undefined}, - page: {default: 1}, - pageSize: {default: 25}, - }, - } - static MERGE = { - function: "merge", - params: ["source", "target"], - config: { - source: {type: "string"}, - target: {type: "string"}, - }, - form: { - title: { - function: "translate", - phrase: "merge_title", - params: [ - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - ok_label: {function: "translate", phrase: "Merge"}, - instruction: { - form_field: true, - type: "instruction", - label: { - function: "translate", - phrase: "merge_selection", - params: [ - { - token: "source", - from: "item1", - attribute: "name", - }, - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - }, - target: { - form_field: true, - type: "lookup", - field: "target", - list: "self", - }, - }, - } - static MOVE = { - function: "move", - params: ["source", "target"], - config: { - source: {type: "string"}, - target: {type: "string"}, - }, - form: { - title: { - function: "translate", - phrase: "move_title", - params: [ - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - ok_label: {function: "translate", phrase: "Move"}, - instruction: { - form_field: true, - type: "instruction", - label: { - function: "translate", - phrase: "move_selection", - params: [ - { - token: "source", - from: "item1", - attribute: "name", - }, - { - token: "type", - from: "model", - attribute: "name", - translate: true, - }, - ], - }, - }, - target: { - form_field: true, - type: "lookup", - field: "target", - list: "self", - }, - }, - } - static SHOPPING = { - function: "shopping", - } + static CREATE = { + function: "create", + form: { + title: { + function: "translate", + phrase: "create_title", + params: [ + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + ok_label: {function: "translate", phrase: "Save"}, + }, + } + static UPDATE = { + function: "partialUpdate", + // special case for update only - updated assumes create form is sufficient, but a different title is required. + form_title: { + function: "translate", + phrase: "edit_title", + params: [ + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + } + static DELETE = { + function: "destroy", + params: ["id"], + form: { + title: { + function: "translate", + phrase: "delete_title", + params: [ + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + ok_label: {function: "translate", phrase: "Delete"}, + instruction: { + form_field: true, + type: "instruction", + label: { + function: "translate", + phrase: "delete_confirmation", + params: [ + { + token: "source", + from: "item1", + attribute: "name", + }, + ], + }, + }, + }, + } + static FETCH = { + function: "retrieve", + params: ["id"], + } + static LIST = { + function: "list", + suffix: "s", + params: ["query", "page", "pageSize", "options"], + config: { + query: {default: undefined}, + page: {default: 1}, + pageSize: {default: 25}, + }, + } + static MERGE = { + function: "merge", + params: ["source", "target"], + config: { + source: {type: "string"}, + target: {type: "string"}, + }, + form: { + title: { + function: "translate", + phrase: "merge_title", + params: [ + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + ok_label: {function: "translate", phrase: "Merge"}, + instruction: { + form_field: true, + type: "instruction", + label: { + function: "translate", + phrase: "merge_selection", + params: [ + { + token: "source", + from: "item1", + attribute: "name", + }, + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + }, + target: { + form_field: true, + type: "lookup", + field: "target", + list: "self", + }, + }, + } + static MOVE = { + function: "move", + params: ["source", "target"], + config: { + source: {type: "string"}, + target: {type: "string"}, + }, + form: { + title: { + function: "translate", + phrase: "move_title", + params: [ + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + ok_label: {function: "translate", phrase: "Move"}, + instruction: { + form_field: true, + type: "instruction", + label: { + function: "translate", + phrase: "move_selection", + params: [ + { + token: "source", + from: "item1", + attribute: "name", + }, + { + token: "type", + from: "model", + attribute: "name", + translate: true, + }, + ], + }, + }, + target: { + form_field: true, + type: "lookup", + field: "target", + list: "self", + }, + }, + } + static SHOPPING = { + function: "shopping", + } } diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index 748299141..4b85b6163 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -878,6 +878,18 @@ export interface Ingredient { * @memberof Ingredient */ amount: string; + /** + * + * @type {string} + * @memberof Ingredient + */ + nutritions?: string; + /** + * + * @type {string} + * @memberof Ingredient + */ + conversions?: string; /** * * @type {string} @@ -1903,6 +1915,43 @@ export interface MealType { */ created_by?: string; } +/** + * + * @export + * @interface NutritionType + */ +export interface NutritionType { + /** + * + * @type {number} + * @memberof NutritionType + */ + id?: number; + /** + * + * @type {string} + * @memberof NutritionType + */ + name: string; + /** + * + * @type {string} + * @memberof NutritionType + */ + icon?: string | null; + /** + * + * @type {string} + * @memberof NutritionType + */ + unit?: string | null; + /** + * + * @type {string} + * @memberof NutritionType + */ + description?: string | null; +} /** * * @export @@ -2245,6 +2294,18 @@ export interface RecipeIngredients { * @memberof RecipeIngredients */ amount: string; + /** + * + * @type {string} + * @memberof RecipeIngredients + */ + nutritions?: string; + /** + * + * @type {string} + * @memberof RecipeIngredients + */ + conversions?: string; /** * * @type {string} @@ -3632,6 +3693,80 @@ export interface Unit { */ description?: string | null; } +/** + * + * @export + * @interface UnitConversion + */ +export interface UnitConversion { + /** + * + * @type {number} + * @memberof UnitConversion + */ + id?: number; + /** + * + * @type {string} + * @memberof UnitConversion + */ + base_amount?: string; + /** + * + * @type {UnitConversionBaseUnit} + * @memberof UnitConversion + */ + base_unit: UnitConversionBaseUnit; + /** + * + * @type {string} + * @memberof UnitConversion + */ + converted_amount?: string; + /** + * + * @type {UnitConversionBaseUnit} + * @memberof UnitConversion + */ + converted_unit: UnitConversionBaseUnit; + /** + * + * @type {IngredientFood} + * @memberof UnitConversion + */ + food: IngredientFood | null; +} +/** + * + * @export + * @interface UnitConversionBaseUnit + */ +export interface UnitConversionBaseUnit { + /** + * + * @type {number} + * @memberof UnitConversionBaseUnit + */ + id?: number; + /** + * + * @type {string} + * @memberof UnitConversionBaseUnit + */ + name: string; + /** + * + * @type {string} + * @memberof UnitConversionBaseUnit + */ + plural_name?: string | null; + /** + * + * @type {string} + * @memberof UnitConversionBaseUnit + */ + description?: string | null; +} /** * * @export @@ -4427,6 +4562,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createNutritionType: async (nutritionType?: NutritionType, options: any = {}): Promise => { + const localVarPath = `/api/nutrition-type/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(nutritionType, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {Recipe} [recipe] @@ -4856,6 +5024,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUnitConversion: async (unitConversion?: UnitConversion, options: any = {}): Promise => { + const localVarPath = `/api/unit-conversion/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(unitConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} name @@ -5442,6 +5643,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyNutritionType: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyNutritionType', 'id', id) + const localVarPath = `/api/nutrition-type/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -5871,6 +6105,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyUnitConversion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('destroyUnitConversion', 'id', id) + const localVarPath = `/api/unit-conversion/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6542,6 +6809,35 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listNutritionTypes: async (options: any = {}): Promise => { + const localVarPath = `/api/nutrition-type/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -7153,6 +7449,35 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUnitConversions: async (options: any = {}): Promise => { + const localVarPath = `/api/unit-conversion/`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -8076,6 +8401,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateNutritionType: async (id: string, nutritionType?: NutritionType, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateNutritionType', 'id', id) + const localVarPath = `/api/nutrition-type/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(nutritionType, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -8594,6 +8956,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateUnitConversion: async (id: string, unitConversion?: UnitConversion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('partialUpdateUnitConversion', 'id', id) + const localVarPath = `/api/unit-conversion/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PATCH', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(unitConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this user. @@ -9332,6 +9731,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveNutritionType: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveNutritionType', 'id', id) + const localVarPath = `/api/nutrition-type/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -9827,6 +10259,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveUnitConversion: async (id: string, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('retrieveUnitConversion', 'id', id) + const localVarPath = `/api/unit-conversion/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -10622,6 +11087,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateNutritionType: async (id: string, nutritionType?: NutritionType, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateNutritionType', 'id', id) + const localVarPath = `/api/nutrition-type/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(nutritionType, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -11103,6 +11605,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) options: localVarRequestOptions, }; }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUnitConversion: async (id: string, unitConversion?: UnitConversion, options: any = {}): Promise => { + // verify required parameter 'id' is not null or undefined + assertParamExists('updateUnitConversion', 'id', id) + const localVarPath = `/api/unit-conversion/{id}/` + .replace(`{${"id"}}`, encodeURIComponent(String(id))); + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(unitConversion, localVarRequestOptions, configuration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, /** * * @param {string} id A unique integer value identifying this user file. @@ -11351,6 +11890,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.createMealType(mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createNutritionType(nutritionType?: NutritionType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createNutritionType(nutritionType, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {Recipe} [recipe] @@ -11481,6 +12030,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.createUnit(unit, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createUnitConversion(unitConversion?: UnitConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createUnitConversion(unitConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} name @@ -11656,6 +12215,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.destroyMealType(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyNutritionType(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyNutritionType(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -11786,6 +12355,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.destroyUnit(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async destroyUnitConversion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.destroyUnitConversion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this user file. @@ -11981,6 +12560,15 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.listMealTypes(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listNutritionTypes(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listNutritionTypes(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * optional parameters - **recipe**: id of recipe - only return books for that recipe - **book**: id of book - only return recipes in that book * @param {*} [options] Override http request option. @@ -12148,6 +12736,15 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.listSyncs(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listUnitConversions(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listUnitConversions(options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} [query] Query string matched against unit name. @@ -12419,6 +13016,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateMealType(id, mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateNutritionType(id: string, nutritionType?: NutritionType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateNutritionType(id, nutritionType, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -12573,6 +13181,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateUnit(id, unit, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async partialUpdateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateUnitConversion(id, unitConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this user. @@ -12793,6 +13412,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveMealType(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveNutritionType(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveNutritionType(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -12943,6 +13572,16 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveUnit(id, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async retrieveUnitConversion(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveUnitConversion(id, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this user. @@ -13178,6 +13817,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.updateMealType(id, mealType, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateNutritionType(id: string, nutritionType?: NutritionType, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateNutritionType(id, nutritionType, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -13321,6 +13971,17 @@ export const ApiApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.updateUnit(id, unit, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async updateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.updateUnitConversion(id, unitConversion, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {string} id A unique integer value identifying this user file. @@ -13475,6 +14136,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: createMealType(mealType?: MealType, options?: any): AxiosPromise { return localVarFp.createMealType(mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createNutritionType(nutritionType?: NutritionType, options?: any): AxiosPromise { + return localVarFp.createNutritionType(nutritionType, options).then((request) => request(axios, basePath)); + }, /** * * @param {Recipe} [recipe] @@ -13592,6 +14262,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: createUnit(unit?: Unit, options?: any): AxiosPromise { return localVarFp.createUnit(unit, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUnitConversion(unitConversion?: UnitConversion, options?: any): AxiosPromise { + return localVarFp.createUnitConversion(unitConversion, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} name @@ -13750,6 +14429,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: destroyMealType(id: string, options?: any): AxiosPromise { return localVarFp.destroyMealType(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyNutritionType(id: string, options?: any): AxiosPromise { + return localVarFp.destroyNutritionType(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -13867,6 +14555,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: destroyUnit(id: string, options?: any): AxiosPromise { return localVarFp.destroyUnit(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + destroyUnitConversion(id: string, options?: any): AxiosPromise { + return localVarFp.destroyUnitConversion(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this user file. @@ -14043,6 +14740,14 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: listMealTypes(options?: any): AxiosPromise> { return localVarFp.listMealTypes(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listNutritionTypes(options?: any): AxiosPromise> { + return localVarFp.listNutritionTypes(options).then((request) => request(axios, basePath)); + }, /** * optional parameters - **recipe**: id of recipe - only return books for that recipe - **book**: id of book - only return recipes in that book * @param {*} [options] Override http request option. @@ -14196,6 +14901,14 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: listSyncs(options?: any): AxiosPromise> { return localVarFp.listSyncs(options).then((request) => request(axios, basePath)); }, + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listUnitConversions(options?: any): AxiosPromise> { + return localVarFp.listUnitConversions(options).then((request) => request(axios, basePath)); + }, /** * * @param {string} [query] Query string matched against unit name. @@ -14442,6 +15155,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: partialUpdateMealType(id: string, mealType?: MealType, options?: any): AxiosPromise { return localVarFp.partialUpdateMealType(id, mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateNutritionType(id: string, nutritionType?: NutritionType, options?: any): AxiosPromise { + return localVarFp.partialUpdateNutritionType(id, nutritionType, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -14582,6 +15305,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: partialUpdateUnit(id: string, unit?: Unit, options?: any): AxiosPromise { return localVarFp.partialUpdateUnit(id, unit, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + partialUpdateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any): AxiosPromise { + return localVarFp.partialUpdateUnitConversion(id, unitConversion, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this user. @@ -14781,6 +15514,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: retrieveMealType(id: string, options?: any): AxiosPromise { return localVarFp.retrieveMealType(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveNutritionType(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveNutritionType(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -14916,6 +15658,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: retrieveUnit(id: string, options?: any): AxiosPromise { return localVarFp.retrieveUnit(id, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + retrieveUnitConversion(id: string, options?: any): AxiosPromise { + return localVarFp.retrieveUnitConversion(id, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this user. @@ -15129,6 +15880,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: updateMealType(id: string, mealType?: MealType, options?: any): AxiosPromise { return localVarFp.updateMealType(id, mealType, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateNutritionType(id: string, nutritionType?: NutritionType, options?: any): AxiosPromise { + return localVarFp.updateNutritionType(id, nutritionType, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this recipe. @@ -15259,6 +16020,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: updateUnit(id: string, unit?: Unit, options?: any): AxiosPromise { return localVarFp.updateUnit(id, unit, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any): AxiosPromise { + return localVarFp.updateUnitConversion(id, unitConversion, options).then((request) => request(axios, basePath)); + }, /** * * @param {string} id A unique integer value identifying this user file. @@ -15437,6 +16208,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).createMealType(mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createNutritionType(nutritionType?: NutritionType, options?: any) { + return ApiApiFp(this.configuration).createNutritionType(nutritionType, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {Recipe} [recipe] @@ -15580,6 +16362,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).createUnit(unit, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public createUnitConversion(unitConversion?: UnitConversion, options?: any) { + return ApiApiFp(this.configuration).createUnitConversion(unitConversion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} name @@ -15772,6 +16565,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).destroyMealType(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyNutritionType(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyNutritionType(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this recipe. @@ -15915,6 +16719,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).destroyUnit(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public destroyUnitConversion(id: string, options?: any) { + return ApiApiFp(this.configuration).destroyUnitConversion(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this user file. @@ -16129,6 +16944,16 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).listMealTypes(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listNutritionTypes(options?: any) { + return ApiApiFp(this.configuration).listNutritionTypes(options).then((request) => request(this.axios, this.basePath)); + } + /** * optional parameters - **recipe**: id of recipe - only return books for that recipe - **book**: id of book - only return recipes in that book * @param {*} [options] Override http request option. @@ -16310,6 +17135,16 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).listSyncs(options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public listUnitConversions(options?: any) { + return ApiApiFp(this.configuration).listUnitConversions(options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} [query] Query string matched against unit name. @@ -16606,6 +17441,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).partialUpdateMealType(id, mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateNutritionType(id: string, nutritionType?: NutritionType, options?: any) { + return ApiApiFp(this.configuration).partialUpdateNutritionType(id, nutritionType, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this recipe. @@ -16774,6 +17621,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).partialUpdateUnit(id, unit, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public partialUpdateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any) { + return ApiApiFp(this.configuration).partialUpdateUnitConversion(id, unitConversion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this user. @@ -17015,6 +17874,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).retrieveMealType(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveNutritionType(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveNutritionType(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this recipe. @@ -17180,6 +18050,17 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).retrieveUnit(id, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public retrieveUnitConversion(id: string, options?: any) { + return ApiApiFp(this.configuration).retrieveUnitConversion(id, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this user. @@ -17437,6 +18318,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).updateMealType(id, mealType, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this nutrition type. + * @param {NutritionType} [nutritionType] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateNutritionType(id: string, nutritionType?: NutritionType, options?: any) { + return ApiApiFp(this.configuration).updateNutritionType(id, nutritionType, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this recipe. @@ -17593,6 +18486,18 @@ export class ApiApi extends BaseAPI { return ApiApiFp(this.configuration).updateUnit(id, unit, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {string} id A unique integer value identifying this unit conversion. + * @param {UnitConversion} [unitConversion] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ApiApi + */ + public updateUnitConversion(id: string, unitConversion?: UnitConversion, options?: any) { + return ApiApiFp(this.configuration).updateUnitConversion(id, unitConversion, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {string} id A unique integer value identifying this user file.