diff --git a/cookbook/migrations/0152_automation.py b/cookbook/migrations/0152_automation.py
new file mode 100644
index 000000000..f383f6ab0
--- /dev/null
+++ b/cookbook/migrations/0152_automation.py
@@ -0,0 +1,35 @@
+# Generated by Django 3.2.7 on 2021-09-15 10:12
+
+import cookbook.models
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('cookbook', '0151_auto_20210915_1037'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Automation',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('type', models.CharField(choices=[('FOOD_ALIAS', 'Food Alias'), ('UNIT_ALIAS', 'Unit Alias'), ('KEYWORD_ALIAS', 'Keyword Alias')], max_length=128)),
+ ('name', models.CharField(default='', max_length=128)),
+ ('description', models.TextField(blank=True, null=True)),
+ ('param_1', models.CharField(blank=True, max_length=128, null=True)),
+ ('param_2', models.CharField(blank=True, max_length=128, null=True)),
+ ('param_3', models.CharField(blank=True, max_length=128, null=True)),
+ ('disabled', models.BooleanField(default=False)),
+ ('updated_at', models.DateTimeField(auto_now=True)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
+ ('space', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cookbook.space')),
+ ],
+ bases=(models.Model, cookbook.models.PermissionModelMixin),
+ ),
+ ]
diff --git a/cookbook/models.py b/cookbook/models.py
index 886a0e822..5a29ce4c2 100644
--- a/cookbook/models.py
+++ b/cookbook/models.py
@@ -865,3 +865,27 @@ class UserFile(ExportModelOperationsMixin('user_files'), models.Model, Permissio
self.file.name = f'{uuid.uuid4()}' + pathlib.Path(self.file.name).suffix
self.file_size_kb = round(self.file.size / 1000)
super(UserFile, self).save(*args, **kwargs)
+
+
+class Automation(ExportModelOperationsMixin('automations'), models.Model, PermissionModelMixin):
+ FOOD_ALIAS = 'FOOD_ALIAS'
+ UNIT_ALIAS = 'UNIT_ALIAS'
+ KEYWORD_ALIAS = 'KEYWORD_ALIAS'
+
+ type = models.CharField(max_length=128,
+ choices=((FOOD_ALIAS, _('Food Alias')), (UNIT_ALIAS, _('Unit Alias')), (KEYWORD_ALIAS, _('Keyword Alias')),))
+ name = models.CharField(max_length=128, default='')
+ description = models.TextField(blank=True, null=True)
+
+ param_1 = models.CharField(max_length=128, blank=True, null=True)
+ param_2 = models.CharField(max_length=128, blank=True, null=True)
+ param_3 = models.CharField(max_length=128, blank=True, null=True)
+
+ disabled = models.BooleanField(default=False)
+
+ updated_at = models.DateTimeField(auto_now=True)
+ created_at = models.DateTimeField(auto_now_add=True)
+ created_by = models.ForeignKey(User, on_delete=models.CASCADE)
+
+ objects = ScopedManager(space='space')
+ space = models.ForeignKey(Space, on_delete=models.CASCADE)
diff --git a/cookbook/serializer.py b/cookbook/serializer.py
index 9994e52d1..38692baf3 100644
--- a/cookbook/serializer.py
+++ b/cookbook/serializer.py
@@ -17,7 +17,7 @@ from cookbook.models import (Comment, CookLog, Food, Ingredient, Keyword,
ShareLink, ShoppingList, ShoppingListEntry,
ShoppingListRecipe, Step, Storage, Sync, SyncLog,
Unit, UserPreference, ViewLog, SupermarketCategory, Supermarket,
- SupermarketCategoryRelation, ImportLog, BookmarkletImport, UserFile)
+ SupermarketCategoryRelation, ImportLog, BookmarkletImport, UserFile, Automation)
from cookbook.templatetags.custom_tags import markdown
@@ -683,6 +683,20 @@ class ImportLogSerializer(serializers.ModelSerializer):
read_only_fields = ('created_by',)
+class AutomationSerializer(serializers.ModelSerializer):
+
+ def create(self, validated_data):
+ validated_data['created_by'] = self.context['request'].user
+ validated_data['space'] = self.context['request'].space
+ return super().create(validated_data)
+
+ class Meta:
+ model = Automation
+ fields = (
+ 'id', 'type', 'name', 'description', 'param_1', 'param_2', 'param_3', 'disabled', 'created_by',)
+ read_only_fields = ('created_by',)
+
+
# CORS, REST and Scopes aren't currently working
# Scopes are evaluating before REST has authenticated the user assiging a None space
# I've made the change below to fix the bookmarklet, other serializers likely need a similar/better fix
diff --git a/cookbook/urls.py b/cookbook/urls.py
index b7a01212d..684670354 100644
--- a/cookbook/urls.py
+++ b/cookbook/urls.py
@@ -10,7 +10,7 @@ from cookbook.helper import dal
from .models import (Comment, Food, InviteLink, Keyword, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShoppingList,
- Storage, Supermarket, SupermarketCategory, Sync, SyncLog, Unit, get_model_name)
+ Storage, Supermarket, SupermarketCategory, Sync, SyncLog, Unit, get_model_name, Automation)
from .views import api, data, delete, edit, import_export, lists, new, views, telegram
router = routers.DefaultRouter()
@@ -40,6 +40,7 @@ router.register(r'supermarket-category-relation', api.SupermarketCategoryRelatio
router.register(r'import-log', api.ImportLogViewSet)
router.register(r'bookmarklet-import', api.BookmarkletImportViewSet)
router.register(r'user-file', api.UserFileViewSet)
+router.register(r'automation', api.AutomationViewSet)
urlpatterns = [
path('', views.index, name='index'),
@@ -177,7 +178,7 @@ for m in generic_models:
)
)
-vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory]
+vue_models = [Food, Keyword, Unit, Supermarket, SupermarketCategory, Automation]
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 5aae3fd71..f733553a0 100644
--- a/cookbook/views/api.py
+++ b/cookbook/views/api.py
@@ -44,7 +44,7 @@ from cookbook.models import (CookLog, Food, Ingredient, Keyword, MealPlan,
MealType, Recipe, RecipeBook, ShoppingList,
ShoppingListEntry, ShoppingListRecipe, Step,
Storage, Sync, SyncLog, Unit, UserPreference,
- ViewLog, RecipeBookEntry, Supermarket, ImportLog, BookmarkletImport, SupermarketCategory, UserFile, ShareLink, SupermarketCategoryRelation)
+ ViewLog, RecipeBookEntry, Supermarket, ImportLog, BookmarkletImport, SupermarketCategory, UserFile, ShareLink, SupermarketCategoryRelation, Automation)
from cookbook.provider.dropbox import Dropbox
from cookbook.provider.local import Local
from cookbook.provider.nextcloud import Nextcloud
@@ -62,7 +62,7 @@ from cookbook.serializer import (FoodSerializer, IngredientSerializer,
UserNameSerializer, UserPreferenceSerializer,
ViewLogSerializer, CookLogSerializer, RecipeBookEntrySerializer,
RecipeOverviewSerializer, SupermarketSerializer, ImportLogSerializer,
- BookmarkletImportSerializer, SupermarketCategorySerializer, UserFileSerializer, SupermarketCategoryRelationSerializer)
+ BookmarkletImportSerializer, SupermarketCategorySerializer, UserFileSerializer, SupermarketCategoryRelationSerializer, AutomationSerializer)
class StandardFilterMixin(ViewSetMixin):
@@ -659,6 +659,16 @@ class UserFileViewSet(viewsets.ModelViewSet, StandardFilterMixin):
return super().get_queryset()
+class AutomationViewSet(viewsets.ModelViewSet, StandardFilterMixin):
+ queryset = Automation.objects
+ serializer_class = AutomationSerializer
+ permission_classes = [CustomIsUser]
+
+ def get_queryset(self):
+ self.queryset = self.queryset.filter(space=self.request.space).all()
+ return super().get_queryset()
+
+
# -------------- non django rest api views --------------------
def get_recipe_provider(recipe):
if recipe.storage.method == Storage.DROPBOX:
diff --git a/cookbook/views/lists.py b/cookbook/views/lists.py
index d67e320c1..4ddfb6b1c 100644
--- a/cookbook/views/lists.py
+++ b/cookbook/views/lists.py
@@ -128,7 +128,7 @@ def food(request):
{
"title": _("Foods"),
"config": {
- 'model': "FOOD", # *REQUIRED* name of the model in models.js
+ 'model': "FOOD", # *REQUIRED* name of the model in models.js
'recipe_param': 'foods' # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute
}
}
@@ -145,8 +145,8 @@ def unit(request):
{
"title": _("Units"),
"config": {
- 'model': "UNIT", # *REQUIRED* name of the model in models.js
- 'recipe_param': 'units', # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute
+ 'model': "UNIT", # *REQUIRED* name of the model in models.js
+ 'recipe_param': 'units', # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute
}
}
)
@@ -162,7 +162,7 @@ def supermarket(request):
{
"title": _("Supermarkets"),
"config": {
- 'model': "SUPERMARKET", # *REQUIRED* name of the model in models.js
+ 'model': "SUPERMARKET", # *REQUIRED* name of the model in models.js
}
}
)
@@ -178,7 +178,23 @@ def supermarket_category(request):
{
"title": _("Shopping Categories"),
"config": {
- 'model': "SHOPPING_CATEGORY", # *REQUIRED* name of the model in models.js
+ 'model': "SHOPPING_CATEGORY", # *REQUIRED* name of the model in models.js
+ }
+ }
+ )
+
+
+@group_required('user')
+def automation(request):
+ # recipe-param is the name of the parameters used when filtering recipes by this attribute
+ # model-name is the models.js name of the model, probably ALL-CAPS
+ return render(
+ request,
+ 'generic/model_template.html',
+ {
+ "title": _("Automations"),
+ "config": {
+ 'model': "AUTOMATION", # *REQUIRED* name of the model in models.js
}
}
)
diff --git a/vue/src/components/Modals/ChoiceInput.vue b/vue/src/components/Modals/ChoiceInput.vue
new file mode 100644
index 000000000..5023bc319
--- /dev/null
+++ b/vue/src/components/Modals/ChoiceInput.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vue/src/components/Modals/GenericModalForm.vue b/vue/src/components/Modals/GenericModalForm.vue
index 330bc1eb8..e03d32244 100644
--- a/vue/src/components/Modals/GenericModalForm.vue
+++ b/vue/src/components/Modals/GenericModalForm.vue
@@ -19,6 +19,12 @@
:value="f.value"
:field="f.field"
:placeholder="f.placeholder"/>
+
-
-
-
+
+
+
@@ -25,6 +26,10 @@
{{ Models['SHOPPING_CATEGORY'].name }}
+
+ {{ Models['AUTOMATION'].name }}
+
+
@@ -45,16 +50,16 @@ export default {
name: 'ModelMenu',
mixins: [ResolveUrlMixin],
data() {
- return {
- Models: Models
- }
+ return {
+ Models: Models
+ }
},
mounted() {
},
methods: {
- gotoURL: function(model) {
- return
- }
+ gotoURL: function (model) {
+ return
+ }
}
}
diff --git a/vue/src/locales/en.json b/vue/src/locales/en.json
index 51fae6160..9e4d68619 100644
--- a/vue/src/locales/en.json
+++ b/vue/src/locales/en.json
@@ -63,6 +63,8 @@
"Nutrition": "Nutrition",
"Date": "Date",
"Share": "Share",
+ "Automation": "Automation",
+ "Parameter": "Parameter",
"Export": "Export",
"Copy": "Copy",
"Rating": "Rating",
@@ -120,6 +122,9 @@
"Move_Food": "Move Food",
"New_Food": "New Food",
"Hide_Food": "Hide Food",
+ "Food_Alias": "Food Alias",
+ "Unit_Alias": "Unit Alias",
+ "Keyword_Alias": "Keyword Alias",
"Delete_Food": "Delete Food",
"No_ID": "ID not found, cannot delete.",
"Meal_Plan_Days": "Future meal plans",
@@ -132,6 +137,7 @@
"create_title": "New {type}",
"edit_title": "Edit {type}",
"Name": "Name",
+ "Type": "Type",
"Description": "Description",
"Recipe": "Recipe",
"tree_root": "Root of Tree",
diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js
index 5f380426f..9d252d9e3 100644
--- a/vue/src/utils/models.js
+++ b/vue/src/utils/models.js
@@ -289,6 +289,64 @@ export class Models {
},
}
+ static AUTOMATION = {
+ 'name': i18n.t('Automation'),
+ 'apiName': 'Automation',
+ 'paginated': true,
+ 'create': {
+ 'params': [['name', 'description', 'type', 'param_1', 'param_2', 'param_3']],
+ 'form': {
+ 'name': {
+ 'form_field': true,
+ 'type': 'text',
+ 'field': 'name',
+ 'label': i18n.t('Name'),
+ 'placeholder': ''
+ },
+ 'description': {
+ 'form_field': true,
+ 'type': 'text',
+ 'field': 'description',
+ 'label': i18n.t('Description'),
+ 'placeholder': ''
+ },
+ 'type': {
+ 'form_field': true,
+ 'type': 'choice',
+ 'options': [
+ {value: 'FOOD_ALIAS', text: i18n.t('Food_Alias')},
+ {value: 'UNIT_ALIAS', text: i18n.t('Unit_Alias')},
+ {value: 'KEYWORD_ALIAS', text: i18n.t('Keyword_Alias')},
+ ],
+ 'field': 'type',
+ 'label': i18n.t('Type'),
+ 'placeholder': ''
+ },
+ 'param_1': {
+ 'form_field': true,
+ 'type': 'text',
+ 'field': 'param_1',
+ 'label': i18n.t('Parameter') + ' 1',
+ 'placeholder': ''
+ },
+ 'param_2': {
+ 'form_field': true,
+ 'type': 'text',
+ 'field': 'param_2',
+ 'label': i18n.t('Parameter') + ' 2',
+ 'placeholder': ''
+ },
+ 'param_3': {
+ 'form_field': true,
+ 'type': 'text',
+ 'field': 'param_3',
+ 'label': i18n.t('Parameter') + ' 3',
+ 'placeholder': ''
+ },
+ }
+ },
+ }
+
static RECIPE = {
'name': i18n.t('Recipe'),
'apiName': 'Recipe',
diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts
index 3a2ebb453..e339eafaf 100644
--- a/vue/src/utils/openapi/api.ts
+++ b/vue/src/utils/openapi/api.ts
@@ -21,6 +21,78 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
+/**
+ *
+ * @export
+ * @interface Automation
+ */
+export interface Automation {
+ /**
+ *
+ * @type {number}
+ * @memberof Automation
+ */
+ id?: number;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ type: AutomationTypeEnum;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ name?: string;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ description?: string | null;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ param_1?: string | null;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ param_2?: string | null;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ param_3?: string | null;
+ /**
+ *
+ * @type {boolean}
+ * @memberof Automation
+ */
+ disabled?: boolean;
+ /**
+ *
+ * @type {string}
+ * @memberof Automation
+ */
+ created_by?: string;
+}
+
+/**
+ * @export
+ * @enum {string}
+ */
+export enum AutomationTypeEnum {
+ FoodAlias = 'FOOD_ALIAS',
+ UnitAlias = 'UNIT_ALIAS',
+ KeywordAlias = 'KEYWORD_ALIAS'
+}
+
/**
*
* @export
@@ -211,6 +283,12 @@ export interface FoodSupermarketCategory {
* @memberof FoodSupermarketCategory
*/
name: string;
+ /**
+ *
+ * @type {string}
+ * @memberof FoodSupermarketCategory
+ */
+ description?: string | null;
}
/**
*
@@ -1113,10 +1191,10 @@ export interface RecipeBook {
icon?: string | null;
/**
*
- * @type {Array}
+ * @type {Array}
* @memberof RecipeBook
*/
- shared?: Array;
+ shared: Array;
/**
*
* @type {string}
@@ -1773,6 +1851,12 @@ export interface ShoppingListSupermarket {
* @memberof ShoppingListSupermarket
*/
name: string;
+ /**
+ *
+ * @type {string}
+ * @memberof ShoppingListSupermarket
+ */
+ description?: string | null;
/**
*
* @type {Array}
@@ -1798,6 +1882,12 @@ export interface ShoppingListSupermarketCategory {
* @memberof ShoppingListSupermarketCategory
*/
name: string;
+ /**
+ *
+ * @type {string}
+ * @memberof ShoppingListSupermarketCategory
+ */
+ description?: string | null;
}
/**
*
@@ -2189,6 +2279,12 @@ export interface Supermarket {
* @memberof Supermarket
*/
name: string;
+ /**
+ *
+ * @type {string}
+ * @memberof Supermarket
+ */
+ description?: string | null;
/**
*
* @type {Array}
@@ -2214,6 +2310,12 @@ export interface SupermarketCategory {
* @memberof SupermarketCategory
*/
name: string;
+ /**
+ *
+ * @type {string}
+ * @memberof SupermarketCategory
+ */
+ description?: string | null;
}
/**
*
@@ -2569,6 +2671,39 @@ export interface ViewLog {
*/
export const ApiApiAxiosParamCreator = function (configuration?: Configuration) {
return {
+ /**
+ *
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ createAutomation: async (automation?: Automation, options: any = {}): Promise => {
+ const localVarPath = `/api/automation/`;
+ // 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(automation, localVarRequestOptions, configuration)
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {BookmarkletImport} [bookmarkletImport]
@@ -3383,6 +3518,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ destroyAutomation: async (id: string, options: any = {}): Promise => {
+ // verify required parameter 'id' is not null or undefined
+ assertParamExists('destroyAutomation', 'id', id)
+ const localVarPath = `/api/automation/{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};
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -4217,6 +4385,35 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
+ /**
+ *
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ listAutomations: async (options: any = {}): Promise => {
+ const localVarPath = `/api/automation/`;
+ // 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};
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {*} [options] Override http request option.
@@ -5361,6 +5558,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ partialUpdateAutomation: async (id: string, automation?: Automation, options: any = {}): Promise => {
+ // verify required parameter 'id' is not null or undefined
+ assertParamExists('partialUpdateAutomation', 'id', id)
+ const localVarPath = `/api/automation/{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(automation, localVarRequestOptions, configuration)
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -6271,6 +6505,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ retrieveAutomation: async (id: string, options: any = {}): Promise => {
+ // verify required parameter 'id' is not null or undefined
+ assertParamExists('retrieveAutomation', 'id', id)
+ const localVarPath = `/api/automation/{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};
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -7129,6 +7396,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions,
};
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ updateAutomation: async (id: string, automation?: Automation, options: any = {}): Promise => {
+ // verify required parameter 'id' is not null or undefined
+ assertParamExists('updateAutomation', 'id', id)
+ const localVarPath = `/api/automation/{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(automation, localVarRequestOptions, configuration)
+
+ return {
+ url: toPathString(localVarUrlObj),
+ options: localVarRequestOptions,
+ };
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -8049,6 +8353,16 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ApiApiAxiosParamCreator(configuration)
return {
+ /**
+ *
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async createAutomation(automation?: Automation, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createAutomation(automation, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {BookmarkletImport} [bookmarkletImport]
@@ -8292,6 +8606,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewLog(viewLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async destroyAutomation(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.destroyAutomation(id, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -8543,6 +8867,15 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.imageRecipe(id, image, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ *
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async listAutomations(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {*} [options] Override http request option.
@@ -8874,6 +9207,17 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.moveKeyword(id, parent, keyword, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async partialUpdateAutomation(id: string, automation?: Automation, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateAutomation(id, automation, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -9141,6 +9485,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateViewLog(id, viewLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async retrieveAutomation(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveAutomation(id, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -9401,6 +9755,17 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveViewLog(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ async updateAutomation(id: string, automation?: Automation, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
+ const localVarAxiosArgs = await localVarAxiosParamCreator.updateAutomation(id, automation, options);
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -9678,6 +10043,15 @@ export const ApiApiFp = function(configuration?: Configuration) {
export const ApiApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ApiApiFp(configuration)
return {
+ /**
+ *
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ createAutomation(automation?: Automation, options?: any): AxiosPromise {
+ return localVarFp.createAutomation(automation, options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {BookmarkletImport} [bookmarkletImport]
@@ -9897,6 +10271,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
createViewLog(viewLog?: ViewLog, options?: any): AxiosPromise {
return localVarFp.createViewLog(viewLog, options).then((request) => request(axios, basePath));
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ destroyAutomation(id: string, options?: any): AxiosPromise {
+ return localVarFp.destroyAutomation(id, options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -10123,6 +10506,14 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
imageRecipe(id: string, image?: any, options?: any): AxiosPromise {
return localVarFp.imageRecipe(id, image, options).then((request) => request(axios, basePath));
},
+ /**
+ *
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ listAutomations(options?: any): AxiosPromise> {
+ return localVarFp.listAutomations(options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {*} [options] Override http request option.
@@ -10423,6 +10814,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
moveKeyword(id: string, parent: string, keyword?: Keyword, options?: any): AxiosPromise {
return localVarFp.moveKeyword(id, parent, keyword, options).then((request) => request(axios, basePath));
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ partialUpdateAutomation(id: string, automation?: Automation, options?: any): AxiosPromise {
+ return localVarFp.partialUpdateAutomation(id, automation, options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -10666,6 +11067,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
partialUpdateViewLog(id: string, viewLog?: ViewLog, options?: any): AxiosPromise {
return localVarFp.partialUpdateViewLog(id, viewLog, options).then((request) => request(axios, basePath));
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ retrieveAutomation(id: string, options?: any): AxiosPromise {
+ return localVarFp.retrieveAutomation(id, options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -10900,6 +11310,16 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
retrieveViewLog(id: string, options?: any): AxiosPromise {
return localVarFp.retrieveViewLog(id, options).then((request) => request(axios, basePath));
},
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ */
+ updateAutomation(id: string, automation?: Automation, options?: any): AxiosPromise {
+ return localVarFp.updateAutomation(id, automation, options).then((request) => request(axios, basePath));
+ },
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -11153,6 +11573,17 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
* @extends {BaseAPI}
*/
export class ApiApi extends BaseAPI {
+ /**
+ *
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public createAutomation(automation?: Automation, options?: any) {
+ return ApiApiFp(this.configuration).createAutomation(automation, options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {BookmarkletImport} [bookmarkletImport]
@@ -11420,6 +11851,17 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).createViewLog(viewLog, options).then((request) => request(this.axios, this.basePath));
}
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public destroyAutomation(id: string, options?: any) {
+ return ApiApiFp(this.configuration).destroyAutomation(id, options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -11696,6 +12138,16 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).imageRecipe(id, image, options).then((request) => request(this.axios, this.basePath));
}
+ /**
+ *
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public listAutomations(options?: any) {
+ return ApiApiFp(this.configuration).listAutomations(options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {*} [options] Override http request option.
@@ -12058,6 +12510,18 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).moveKeyword(id, parent, keyword, options).then((request) => request(this.axios, this.basePath));
}
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public partialUpdateAutomation(id: string, automation?: Automation, options?: any) {
+ return ApiApiFp(this.configuration).partialUpdateAutomation(id, automation, options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -12349,6 +12813,17 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).partialUpdateViewLog(id, viewLog, options).then((request) => request(this.axios, this.basePath));
}
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public retrieveAutomation(id: string, options?: any) {
+ return ApiApiFp(this.configuration).retrieveAutomation(id, options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.
@@ -12635,6 +13110,18 @@ export class ApiApi extends BaseAPI {
return ApiApiFp(this.configuration).retrieveViewLog(id, options).then((request) => request(this.axios, this.basePath));
}
+ /**
+ *
+ * @param {string} id A unique integer value identifying this automation.
+ * @param {Automation} [automation]
+ * @param {*} [options] Override http request option.
+ * @throws {RequiredError}
+ * @memberof ApiApi
+ */
+ public updateAutomation(id: string, automation?: Automation, options?: any) {
+ return ApiApiFp(this.configuration).updateAutomation(id, automation, options).then((request) => request(this.axios, this.basePath));
+ }
+
/**
*
* @param {string} id A unique integer value identifying this bookmarklet import.