basics for automation

This commit is contained in:
vabene1111 2021-09-15 13:07:25 +02:00
parent 71ac73ff2a
commit d6f7aade46
12 changed files with 724 additions and 22 deletions

View File

@ -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),
),
]

View File

@ -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.name = f'{uuid.uuid4()}' + pathlib.Path(self.file.name).suffix
self.file_size_kb = round(self.file.size / 1000) self.file_size_kb = round(self.file.size / 1000)
super(UserFile, self).save(*args, **kwargs) 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)

View File

@ -17,7 +17,7 @@ from cookbook.models import (Comment, CookLog, Food, Ingredient, Keyword,
ShareLink, ShoppingList, ShoppingListEntry, ShareLink, ShoppingList, ShoppingListEntry,
ShoppingListRecipe, Step, Storage, Sync, SyncLog, ShoppingListRecipe, Step, Storage, Sync, SyncLog,
Unit, UserPreference, ViewLog, SupermarketCategory, Supermarket, Unit, UserPreference, ViewLog, SupermarketCategory, Supermarket,
SupermarketCategoryRelation, ImportLog, BookmarkletImport, UserFile) SupermarketCategoryRelation, ImportLog, BookmarkletImport, UserFile, Automation)
from cookbook.templatetags.custom_tags import markdown from cookbook.templatetags.custom_tags import markdown
@ -683,6 +683,20 @@ class ImportLogSerializer(serializers.ModelSerializer):
read_only_fields = ('created_by',) 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 # CORS, REST and Scopes aren't currently working
# Scopes are evaluating before REST has authenticated the user assiging a None space # 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 # I've made the change below to fix the bookmarklet, other serializers likely need a similar/better fix

View File

@ -10,7 +10,7 @@ from cookbook.helper import dal
from .models import (Comment, Food, InviteLink, Keyword, MealPlan, Recipe, from .models import (Comment, Food, InviteLink, Keyword, MealPlan, Recipe,
RecipeBook, RecipeBookEntry, RecipeImport, ShoppingList, 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 from .views import api, data, delete, edit, import_export, lists, new, views, telegram
router = routers.DefaultRouter() 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'import-log', api.ImportLogViewSet)
router.register(r'bookmarklet-import', api.BookmarkletImportViewSet) router.register(r'bookmarklet-import', api.BookmarkletImportViewSet)
router.register(r'user-file', api.UserFileViewSet) router.register(r'user-file', api.UserFileViewSet)
router.register(r'automation', api.AutomationViewSet)
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), 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: for m in vue_models:
py_name = get_model_name(m) py_name = get_model_name(m)
url_name = py_name.replace('_', '-') url_name = py_name.replace('_', '-')

View File

@ -44,7 +44,7 @@ from cookbook.models import (CookLog, Food, Ingredient, Keyword, MealPlan,
MealType, Recipe, RecipeBook, ShoppingList, MealType, Recipe, RecipeBook, ShoppingList,
ShoppingListEntry, ShoppingListRecipe, Step, ShoppingListEntry, ShoppingListRecipe, Step,
Storage, Sync, SyncLog, Unit, UserPreference, 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.dropbox import Dropbox
from cookbook.provider.local import Local from cookbook.provider.local import Local
from cookbook.provider.nextcloud import Nextcloud from cookbook.provider.nextcloud import Nextcloud
@ -62,7 +62,7 @@ from cookbook.serializer import (FoodSerializer, IngredientSerializer,
UserNameSerializer, UserPreferenceSerializer, UserNameSerializer, UserPreferenceSerializer,
ViewLogSerializer, CookLogSerializer, RecipeBookEntrySerializer, ViewLogSerializer, CookLogSerializer, RecipeBookEntrySerializer,
RecipeOverviewSerializer, SupermarketSerializer, ImportLogSerializer, RecipeOverviewSerializer, SupermarketSerializer, ImportLogSerializer,
BookmarkletImportSerializer, SupermarketCategorySerializer, UserFileSerializer, SupermarketCategoryRelationSerializer) BookmarkletImportSerializer, SupermarketCategorySerializer, UserFileSerializer, SupermarketCategoryRelationSerializer, AutomationSerializer)
class StandardFilterMixin(ViewSetMixin): class StandardFilterMixin(ViewSetMixin):
@ -659,6 +659,16 @@ class UserFileViewSet(viewsets.ModelViewSet, StandardFilterMixin):
return super().get_queryset() 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 -------------------- # -------------- non django rest api views --------------------
def get_recipe_provider(recipe): def get_recipe_provider(recipe):
if recipe.storage.method == Storage.DROPBOX: if recipe.storage.method == Storage.DROPBOX:

View File

@ -128,7 +128,7 @@ def food(request):
{ {
"title": _("Foods"), "title": _("Foods"),
"config": { "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 'recipe_param': 'foods' # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute
} }
} }
@ -145,8 +145,8 @@ def unit(request):
{ {
"title": _("Units"), "title": _("Units"),
"config": { "config": {
'model': "UNIT", # *REQUIRED* name of the model in models.js 'model': "UNIT", # *REQUIRED* name of the model in models.js
'recipe_param': 'units', # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute 'recipe_param': 'units', # *OPTIONAL* name of the listRecipes parameter if filtering on this attribute
} }
} }
) )
@ -162,7 +162,7 @@ def supermarket(request):
{ {
"title": _("Supermarkets"), "title": _("Supermarkets"),
"config": { "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"), "title": _("Shopping Categories"),
"config": { "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
} }
} }
) )

View File

@ -0,0 +1,39 @@
<template>
<div>
<b-form-group
v-bind:label="label"
class="mb-3">
<b-form-select v-model="new_value" :placeholder="placeholder" :options="options"></b-form-select>
</b-form-group>
</div>
</template>
<script>
export default {
name: 'ChoiceInput',
props: {
field: {type: String, default: 'You Forgot To Set Field Name'},
label: {type: String, default: 'Text Field'},
value: {type: String, default: ''},
options: [],
placeholder: {type: String, default: 'You Should Add Placeholder Text'},
show_merge: {type: Boolean, default: false},
},
data() {
return {
new_value: undefined,
}
},
mounted() {
this.new_value = this.value
},
watch: {
'new_value': function () {
this.$root.$emit('change', this.field, this.new_value)
},
},
methods: {
}
}
</script>

View File

@ -19,6 +19,12 @@
:value="f.value" :value="f.value"
:field="f.field" :field="f.field"
:placeholder="f.placeholder"/> :placeholder="f.placeholder"/>
<choice-input v-if="f.type=='choice'"
:label="f.label"
:value="f.value"
:field="f.field"
:options="f.options"
:placeholder="f.placeholder"/>
<emoji-input v-if="f.type=='emoji'" <emoji-input v-if="f.type=='emoji'"
:label="f.label" :label="f.label"
:value="f.value" :value="f.value"
@ -45,10 +51,11 @@ import CheckboxInput from "@/components/Modals/CheckboxInput";
import LookupInput from "@/components/Modals/LookupInput"; import LookupInput from "@/components/Modals/LookupInput";
import TextInput from "@/components/Modals/TextInput"; import TextInput from "@/components/Modals/TextInput";
import EmojiInput from "@/components/Modals/EmojiInput"; import EmojiInput from "@/components/Modals/EmojiInput";
import ChoiceInput from "@/components/Modals/ChoiceInput";
export default { export default {
name: 'GenericModalForm', name: 'GenericModalForm',
components: {CheckboxInput, LookupInput, TextInput, EmojiInput}, components: {CheckboxInput, LookupInput, TextInput, EmojiInput, ChoiceInput},
props: { props: {
model: {required: true, type: Object}, model: {required: true, type: Object},
action: {required: true, type: Object}, action: {required: true, type: Object},

View File

@ -1,7 +1,8 @@
<template> <template>
<!-- <b-button variant="link" size="sm" class="text-dark shadow-none"><i class="fas fa-chevron-down"></i></b-button> --> <!-- <b-button variant="link" size="sm" class="text-dark shadow-none"><i class="fas fa-chevron-down"></i></b-button> -->
<span> <span>
<b-dropdown variant="link" toggle-class="text-decoration-none text-dark shadow-none" no-caret style="boundary:window"> <b-dropdown variant="link" toggle-class="text-decoration-none text-dark shadow-none" no-caret
style="boundary:window">
<template #button-content> <template #button-content>
<i class="fas fa-chevron-down"></i> <i class="fas fa-chevron-down"></i>
</template> </template>
@ -25,6 +26,10 @@
<i class="fas fa-cubes fa-fw"></i> {{ Models['SHOPPING_CATEGORY'].name }} <i class="fas fa-cubes fa-fw"></i> {{ Models['SHOPPING_CATEGORY'].name }}
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item :href="resolveDjangoUrl('list_automation')">
<i class="fas fa-cogs fa-fw"></i> {{ Models['AUTOMATION'].name }}
</b-dropdown-item>
</b-dropdown> </b-dropdown>
</span> </span>
</template> </template>
@ -45,16 +50,16 @@ export default {
name: 'ModelMenu', name: 'ModelMenu',
mixins: [ResolveUrlMixin], mixins: [ResolveUrlMixin],
data() { data() {
return { return {
Models: Models Models: Models
} }
}, },
mounted() { mounted() {
}, },
methods: { methods: {
gotoURL: function(model) { gotoURL: function (model) {
return return
} }
} }
} }

View File

@ -63,6 +63,8 @@
"Nutrition": "Nutrition", "Nutrition": "Nutrition",
"Date": "Date", "Date": "Date",
"Share": "Share", "Share": "Share",
"Automation": "Automation",
"Parameter": "Parameter",
"Export": "Export", "Export": "Export",
"Copy": "Copy", "Copy": "Copy",
"Rating": "Rating", "Rating": "Rating",
@ -120,6 +122,9 @@
"Move_Food": "Move Food", "Move_Food": "Move Food",
"New_Food": "New Food", "New_Food": "New Food",
"Hide_Food": "Hide Food", "Hide_Food": "Hide Food",
"Food_Alias": "Food Alias",
"Unit_Alias": "Unit Alias",
"Keyword_Alias": "Keyword Alias",
"Delete_Food": "Delete Food", "Delete_Food": "Delete Food",
"No_ID": "ID not found, cannot delete.", "No_ID": "ID not found, cannot delete.",
"Meal_Plan_Days": "Future meal plans", "Meal_Plan_Days": "Future meal plans",
@ -132,6 +137,7 @@
"create_title": "New {type}", "create_title": "New {type}",
"edit_title": "Edit {type}", "edit_title": "Edit {type}",
"Name": "Name", "Name": "Name",
"Type": "Type",
"Description": "Description", "Description": "Description",
"Recipe": "Recipe", "Recipe": "Recipe",
"tree_root": "Root of Tree", "tree_root": "Root of Tree",

View File

@ -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 = { static RECIPE = {
'name': i18n.t('Recipe'), 'name': i18n.t('Recipe'),
'apiName': 'Recipe', 'apiName': 'Recipe',

View File

@ -21,6 +21,78 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj
// @ts-ignore // @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base'; 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 * @export
@ -211,6 +283,12 @@ export interface FoodSupermarketCategory {
* @memberof FoodSupermarketCategory * @memberof FoodSupermarketCategory
*/ */
name: string; name: string;
/**
*
* @type {string}
* @memberof FoodSupermarketCategory
*/
description?: string | null;
} }
/** /**
* *
@ -1113,10 +1191,10 @@ export interface RecipeBook {
icon?: string | null; icon?: string | null;
/** /**
* *
* @type {Array<number>} * @type {Array<ShoppingListShared>}
* @memberof RecipeBook * @memberof RecipeBook
*/ */
shared?: Array<number>; shared: Array<ShoppingListShared>;
/** /**
* *
* @type {string} * @type {string}
@ -1773,6 +1851,12 @@ export interface ShoppingListSupermarket {
* @memberof ShoppingListSupermarket * @memberof ShoppingListSupermarket
*/ */
name: string; name: string;
/**
*
* @type {string}
* @memberof ShoppingListSupermarket
*/
description?: string | null;
/** /**
* *
* @type {Array<ShoppingListSupermarketCategoryToSupermarket>} * @type {Array<ShoppingListSupermarketCategoryToSupermarket>}
@ -1798,6 +1882,12 @@ export interface ShoppingListSupermarketCategory {
* @memberof ShoppingListSupermarketCategory * @memberof ShoppingListSupermarketCategory
*/ */
name: string; name: string;
/**
*
* @type {string}
* @memberof ShoppingListSupermarketCategory
*/
description?: string | null;
} }
/** /**
* *
@ -2189,6 +2279,12 @@ export interface Supermarket {
* @memberof Supermarket * @memberof Supermarket
*/ */
name: string; name: string;
/**
*
* @type {string}
* @memberof Supermarket
*/
description?: string | null;
/** /**
* *
* @type {Array<ShoppingListSupermarketCategoryToSupermarket>} * @type {Array<ShoppingListSupermarketCategoryToSupermarket>}
@ -2214,6 +2310,12 @@ export interface SupermarketCategory {
* @memberof SupermarketCategory * @memberof SupermarketCategory
*/ */
name: string; name: string;
/**
*
* @type {string}
* @memberof SupermarketCategory
*/
description?: string | null;
} }
/** /**
* *
@ -2569,6 +2671,39 @@ export interface ViewLog {
*/ */
export const ApiApiAxiosParamCreator = function (configuration?: Configuration) { export const ApiApiAxiosParamCreator = function (configuration?: Configuration) {
return { return {
/**
*
* @param {Automation} [automation]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createAutomation: async (automation?: Automation, options: any = {}): Promise<RequestArgs> => {
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] * @param {BookmarkletImport} [bookmarkletImport]
@ -3383,6 +3518,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions, 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<RequestArgs> => {
// 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. * @param {string} id A unique integer value identifying this bookmarklet import.
@ -4217,6 +4385,35 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions, options: localVarRequestOptions,
}; };
}, },
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listAutomations: async (options: any = {}): Promise<RequestArgs> => {
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. * @param {*} [options] Override http request option.
@ -5361,6 +5558,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions, 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<RequestArgs> => {
// 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. * @param {string} id A unique integer value identifying this bookmarklet import.
@ -6271,6 +6505,39 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions, 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<RequestArgs> => {
// 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. * @param {string} id A unique integer value identifying this bookmarklet import.
@ -7129,6 +7396,43 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration)
options: localVarRequestOptions, 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<RequestArgs> => {
// 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. * @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) { export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ApiApiAxiosParamCreator(configuration) const localVarAxiosParamCreator = ApiApiAxiosParamCreator(configuration)
return { return {
/**
*
* @param {Automation} [automation]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createAutomation(automation?: Automation, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Automation>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createAutomation(automation, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/** /**
* *
* @param {BookmarkletImport} [bookmarkletImport] * @param {BookmarkletImport} [bookmarkletImport]
@ -8292,6 +8606,16 @@ export const ApiApiFp = function(configuration?: Configuration) {
const localVarAxiosArgs = await localVarAxiosParamCreator.createViewLog(viewLog, options); const localVarAxiosArgs = await localVarAxiosParamCreator.createViewLog(viewLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); 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<void>> {
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. * @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); const localVarAxiosArgs = await localVarAxiosParamCreator.imageRecipe(id, image, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); 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<Array<Automation>>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/** /**
* *
* @param {*} [options] Override http request option. * @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); const localVarAxiosArgs = await localVarAxiosParamCreator.moveKeyword(id, parent, keyword, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); 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<Automation>> {
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. * @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); const localVarAxiosArgs = await localVarAxiosParamCreator.partialUpdateViewLog(id, viewLog, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); 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<Automation>> {
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. * @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); const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveViewLog(id, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); 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<Automation>> {
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. * @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) { export const ApiApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ApiApiFp(configuration) const localVarFp = ApiApiFp(configuration)
return { return {
/**
*
* @param {Automation} [automation]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createAutomation(automation?: Automation, options?: any): AxiosPromise<Automation> {
return localVarFp.createAutomation(automation, options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {BookmarkletImport} [bookmarkletImport] * @param {BookmarkletImport} [bookmarkletImport]
@ -9897,6 +10271,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
createViewLog(viewLog?: ViewLog, options?: any): AxiosPromise<ViewLog> { createViewLog(viewLog?: ViewLog, options?: any): AxiosPromise<ViewLog> {
return localVarFp.createViewLog(viewLog, options).then((request) => request(axios, basePath)); 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<void> {
return localVarFp.destroyAutomation(id, options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {string} id A unique integer value identifying this bookmarklet import. * @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<RecipeImage> { imageRecipe(id: string, image?: any, options?: any): AxiosPromise<RecipeImage> {
return localVarFp.imageRecipe(id, image, options).then((request) => request(axios, basePath)); return localVarFp.imageRecipe(id, image, options).then((request) => request(axios, basePath));
}, },
/**
*
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listAutomations(options?: any): AxiosPromise<Array<Automation>> {
return localVarFp.listAutomations(options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {*} [options] Override http request option. * @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<Keyword> { moveKeyword(id: string, parent: string, keyword?: Keyword, options?: any): AxiosPromise<Keyword> {
return localVarFp.moveKeyword(id, parent, keyword, options).then((request) => request(axios, basePath)); 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<Automation> {
return localVarFp.partialUpdateAutomation(id, automation, options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {string} id A unique integer value identifying this bookmarklet import. * @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<ViewLog> { partialUpdateViewLog(id: string, viewLog?: ViewLog, options?: any): AxiosPromise<ViewLog> {
return localVarFp.partialUpdateViewLog(id, viewLog, options).then((request) => request(axios, basePath)); 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<Automation> {
return localVarFp.retrieveAutomation(id, options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {string} id A unique integer value identifying this bookmarklet import. * @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<ViewLog> { retrieveViewLog(id: string, options?: any): AxiosPromise<ViewLog> {
return localVarFp.retrieveViewLog(id, options).then((request) => request(axios, basePath)); 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<Automation> {
return localVarFp.updateAutomation(id, automation, options).then((request) => request(axios, basePath));
},
/** /**
* *
* @param {string} id A unique integer value identifying this bookmarklet import. * @param {string} id A unique integer value identifying this bookmarklet import.
@ -11153,6 +11573,17 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?:
* @extends {BaseAPI} * @extends {BaseAPI}
*/ */
export class ApiApi 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] * @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)); 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. * @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)); 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. * @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)); 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. * @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)); 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. * @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)); 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. * @param {string} id A unique integer value identifying this bookmarklet import.