From 0e8cac7ab9a5a79ce81c0ceee5b70572a80bd1b2 Mon Sep 17 00:00:00 2001 From: smilerz Date: Fri, 23 Feb 2024 08:33:50 -0600 Subject: [PATCH 1/2] paginated steps on GenericModelList paginate CustomFilter api and GenericModelList paginate Automation api and GenericModelList --- cookbook/views/api.py | 2 + vue/src/utils/models.js | 9 +- vue/src/utils/openapi/api.ts | 250 ++++++++++++++++++++++++----------- 3 files changed, 181 insertions(+), 80 deletions(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index 710a8e375..bd38483a2 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -1326,6 +1326,7 @@ class AutomationViewSet(viewsets.ModelViewSet, StandardFilterMixin): queryset = Automation.objects serializer_class = AutomationSerializer permission_classes = [CustomIsUser & CustomTokenHasReadWriteScope] + pagination_class = DefaultPagination def get_queryset(self): self.queryset = self.queryset.filter(space=self.request.space).all() @@ -1354,6 +1355,7 @@ class CustomFilterViewSet(viewsets.ModelViewSet, StandardFilterMixin): queryset = CustomFilter.objects serializer_class = CustomFilterSerializer permission_classes = [CustomIsOwner & CustomTokenHasReadWriteScope] + pagination_class = DefaultPagination def get_queryset(self): self.queryset = self.queryset.filter(Q(created_by=self.request.user) | Q(shared=self.request.user)).filter( diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js index 8953b76cb..87278d9dc 100644 --- a/vue/src/utils/models.js +++ b/vue/src/utils/models.js @@ -518,6 +518,7 @@ export class Models { header_component: { name: "BetaWarning", }, + params: ["page", "pageSize", "options"], }, create: { params: [["name", "description", "type", "param_1", "param_2", "param_3", "order", "disabled"]], @@ -620,7 +621,7 @@ export class Models { }, form_function: "AutomationOrderDefault", }, - }, + } } static UNIT_CONVERSION = { @@ -1032,7 +1033,7 @@ export class Models { static CUSTOM_FILTER = { name: "Custom Filter", apiName: "CustomFilter", - + paginated: true, create: { params: [["name", "search", "shared"]], form: { @@ -1055,6 +1056,9 @@ export class Models { }, }, }, + list: { + params: ["page", "pageSize", "options"], + }, } static USER_NAME = { name: "User", @@ -1228,6 +1232,7 @@ export class Models { static STEP = { name: "Step", apiName: "Step", + paginated: true, list: { params: ["recipe", "query", "page", "pageSize", "options"], }, diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index 45749f4d2..69ace31e4 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -1262,10 +1262,10 @@ export interface InlineResponse200 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse200 */ - results?: Array; + results?: Array; } /** * @@ -1293,10 +1293,10 @@ export interface InlineResponse2001 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2001 */ - results?: Array; + results?: Array; } /** * @@ -1324,10 +1324,10 @@ export interface InlineResponse20010 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse20010 */ - results?: Array; + results?: Array; } /** * @@ -1355,10 +1355,10 @@ export interface InlineResponse20011 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse20011 */ - results?: Array; + results?: Array; } /** * @@ -1386,9 +1386,71 @@ export interface InlineResponse20012 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse20012 */ + results?: Array; +} +/** + * + * @export + * @interface InlineResponse20013 + */ +export interface InlineResponse20013 { + /** + * + * @type {number} + * @memberof InlineResponse20013 + */ + count?: number; + /** + * + * @type {string} + * @memberof InlineResponse20013 + */ + next?: string | null; + /** + * + * @type {string} + * @memberof InlineResponse20013 + */ + previous?: string | null; + /** + * + * @type {Array} + * @memberof InlineResponse20013 + */ + results?: Array; +} +/** + * + * @export + * @interface InlineResponse20014 + */ +export interface InlineResponse20014 { + /** + * + * @type {number} + * @memberof InlineResponse20014 + */ + count?: number; + /** + * + * @type {string} + * @memberof InlineResponse20014 + */ + next?: string | null; + /** + * + * @type {string} + * @memberof InlineResponse20014 + */ + previous?: string | null; + /** + * + * @type {Array} + * @memberof InlineResponse20014 + */ results?: Array; } /** @@ -1417,10 +1479,10 @@ export interface InlineResponse2002 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2002 */ - results?: Array; + results?: Array; } /** * @@ -1448,10 +1510,10 @@ export interface InlineResponse2003 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2003 */ - results?: Array; + results?: Array; } /** * @@ -1479,10 +1541,10 @@ export interface InlineResponse2004 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2004 */ - results?: Array; + results?: Array; } /** * @@ -1510,10 +1572,10 @@ export interface InlineResponse2005 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2005 */ - results?: Array; + results?: Array; } /** * @@ -1541,10 +1603,10 @@ export interface InlineResponse2006 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2006 */ - results?: Array; + results?: Array; } /** * @@ -1572,10 +1634,10 @@ export interface InlineResponse2007 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2007 */ - results?: Array; + results?: Array; } /** * @@ -1603,10 +1665,10 @@ export interface InlineResponse2008 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2008 */ - results?: Array; + results?: Array; } /** * @@ -1634,10 +1696,10 @@ export interface InlineResponse2009 { previous?: string | null; /** * - * @type {Array} + * @type {Array} * @memberof InlineResponse2009 */ - results?: Array; + results?: Array; } /** * @@ -6918,10 +6980,12 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) }, /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listAutomations: async (options: any = {}): Promise => { + listAutomations: async (page?: number, pageSize?: number, 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); @@ -6934,6 +6998,14 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (pageSize !== undefined) { + localVarQueryParameter['page_size'] = pageSize; + } + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); @@ -7015,10 +7087,12 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) }, /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listCustomFilters: async (options: any = {}): Promise => { + listCustomFilters: async (page?: number, pageSize?: number, options: any = {}): Promise => { const localVarPath = `/api/custom-filter/`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); @@ -7031,6 +7105,14 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (page !== undefined) { + localVarQueryParameter['page'] = page; + } + + if (pageSize !== undefined) { + localVarQueryParameter['page_size'] = pageSize; + } + setSearchParams(localVarUrlObj, localVarQueryParameter, options.query); @@ -13313,11 +13395,13 @@ export const ApiApiFp = function(configuration?: Configuration) { }, /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listAutomations(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(options); + async listAutomations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -13336,19 +13420,10 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listCookLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listCookLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listCookLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, - /** - * - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async listCustomFilters(options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { - const localVarAxiosArgs = await localVarAxiosParamCreator.listCustomFilters(options); - return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); - }, /** * * @param {number} [page] A page number within the paginated result set. @@ -13356,7 +13431,18 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listExportLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listCustomFilters(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listCustomFilters(page, pageSize, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listExportLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listExportLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13379,7 +13465,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listFoods(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listFoods(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listFoods(query, root, tree, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13399,7 +13485,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listImportLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listImportLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listImportLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13410,7 +13496,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listIngredients(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listIngredients(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listIngredients(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13433,7 +13519,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listKeywords(query, root, tree, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13528,7 +13614,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, cookedon?: string, createdon?: string, updatedon?: string, viewedon?: string, makenow?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, cookedon?: string, createdon?: string, updatedon?: string, viewedon?: string, makenow?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listRecipes(query, keywords, keywordsOr, keywordsAnd, keywordsOrNot, keywordsAndNot, foods, foodsOr, foodsAnd, foodsOrNot, foodsAndNot, units, rating, books, booksOr, booksAnd, booksOrNot, booksAndNot, internal, random, _new, timescooked, cookedon, createdon, updatedon, viewedon, makenow, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13580,7 +13666,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSteps(recipe, query, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13600,7 +13686,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSupermarketCategoryRelations(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13631,7 +13717,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listSyncLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listSyncLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listSyncLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13662,7 +13748,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listUnits(query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listUnits(query?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listUnits(query, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13692,7 +13778,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listUserSpaces(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listUserSpaces(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listUserSpaces(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -13712,7 +13798,7 @@ export const ApiApiFp = function(configuration?: Configuration) { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listViewLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + async listViewLogs(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.listViewLogs(page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, @@ -15624,11 +15710,13 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: }, /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listAutomations(options?: any): AxiosPromise> { - return localVarFp.listAutomations(options).then((request) => request(axios, basePath)); + listAutomations(page?: number, pageSize?: number, options?: any): AxiosPromise { + return localVarFp.listAutomations(page, pageSize, options).then((request) => request(axios, basePath)); }, /** * @@ -15645,17 +15733,9 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listCookLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listCookLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listCookLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, - /** - * - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - listCustomFilters(options?: any): AxiosPromise> { - return localVarFp.listCustomFilters(options).then((request) => request(axios, basePath)); - }, /** * * @param {number} [page] A page number within the paginated result set. @@ -15663,7 +15743,17 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listExportLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listCustomFilters(page?: number, pageSize?: number, options?: any): AxiosPromise { + return localVarFp.listCustomFilters(page, pageSize, options).then((request) => request(axios, basePath)); + }, + /** + * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listExportLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listExportLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15684,7 +15774,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listFoods(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { + listFoods(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listFoods(query, root, tree, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15702,7 +15792,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listImportLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listImportLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listImportLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15712,7 +15802,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listIngredients(page?: number, pageSize?: number, options?: any): AxiosPromise { + listIngredients(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listIngredients(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15733,7 +15823,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { + listKeywords(query?: string, root?: number, tree?: number, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listKeywords(query, root, tree, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15821,7 +15911,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, cookedon?: string, createdon?: string, updatedon?: string, viewedon?: string, makenow?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listRecipes(query?: string, keywords?: number, keywordsOr?: number, keywordsAnd?: number, keywordsOrNot?: number, keywordsAndNot?: number, foods?: number, foodsOr?: number, foodsAnd?: number, foodsOrNot?: number, foodsAndNot?: number, units?: number, rating?: number, books?: string, booksOr?: number, booksAnd?: number, booksOrNot?: number, booksAndNot?: number, internal?: string, random?: string, _new?: string, timescooked?: number, cookedon?: string, createdon?: string, updatedon?: string, viewedon?: string, makenow?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listRecipes(query, keywords, keywordsOr, keywordsAnd, keywordsOrNot, keywordsAndNot, foods, foodsOr, foodsAnd, foodsOrNot, foodsAndNot, units, rating, books, booksOr, booksAnd, booksOrNot, booksAndNot, internal, random, _new, timescooked, cookedon, createdon, updatedon, viewedon, makenow, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15868,7 +15958,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listSteps(recipe?: number, query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSteps(recipe, query, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15886,7 +15976,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): AxiosPromise { + listSupermarketCategoryRelations(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSupermarketCategoryRelations(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15914,7 +16004,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listSyncLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listSyncLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listSyncLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15942,7 +16032,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listUnits(query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + listUnits(query?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listUnits(query, page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15969,7 +16059,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listUserSpaces(page?: number, pageSize?: number, options?: any): AxiosPromise { + listUserSpaces(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listUserSpaces(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -15987,7 +16077,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listViewLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { + listViewLogs(page?: number, pageSize?: number, options?: any): AxiosPromise { return localVarFp.listViewLogs(page, pageSize, options).then((request) => request(axios, basePath)); }, /** @@ -17921,12 +18011,14 @@ export class ApiApi extends BaseAPI { /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @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)); + public listAutomations(page?: number, pageSize?: number, options?: any) { + return ApiApiFp(this.configuration).listAutomations(page, pageSize, options).then((request) => request(this.axios, this.basePath)); } /** @@ -17953,12 +18045,14 @@ export class ApiApi extends BaseAPI { /** * + * @param {number} [page] A page number within the paginated result set. + * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApiApi */ - public listCustomFilters(options?: any) { - return ApiApiFp(this.configuration).listCustomFilters(options).then((request) => request(this.axios, this.basePath)); + public listCustomFilters(page?: number, pageSize?: number, options?: any) { + return ApiApiFp(this.configuration).listCustomFilters(page, pageSize, options).then((request) => request(this.axios, this.basePath)); } /** From 6224e38138dcde352357c7f90e661bddbde20449 Mon Sep 17 00:00:00 2001 From: smilerz Date: Fri, 23 Feb 2024 13:27:59 -0600 Subject: [PATCH 2/2] add filter for automation type on automation API --- cookbook/views/api.py | 119 +++++++++++++++++++++-------------- vue/src/utils/models.js | 2 +- vue/src/utils/openapi/api.ts | 38 ++++++----- 3 files changed, 97 insertions(+), 62 deletions(-) diff --git a/cookbook/views/api.py b/cookbook/views/api.py index bd38483a2..88d492ecc 100644 --- a/cookbook/views/api.py +++ b/cookbook/views/api.py @@ -30,7 +30,6 @@ from django.http import FileResponse, HttpResponse, JsonResponse from django.shortcuts import get_object_or_404, redirect from django.urls import reverse from django.utils import timezone -from django.utils.timezone import make_aware from django.utils.translation import gettext as _ from django_scopes import scopes_disabled from icalendar import Calendar, Event @@ -58,56 +57,36 @@ from cookbook.helper.HelperFunctions import str2bool from cookbook.helper.image_processing import handle_image from cookbook.helper.ingredient_parser import IngredientParser from cookbook.helper.open_data_importer import OpenDataImporter -from cookbook.helper.permission_helper import (CustomIsAdmin, CustomIsOwner, CustomIsOwnerReadOnly, - CustomIsShared, CustomIsSpaceOwner, CustomIsUser, - CustomRecipePermission, CustomTokenHasReadWriteScope, - CustomTokenHasScope, CustomUserPermission, - IsReadOnlyDRF, above_space_limit, group_required, - has_group_permission, is_space_owner, - switch_user_active_space) +from cookbook.helper.permission_helper import ( + CustomIsAdmin, CustomIsOwner, CustomIsOwnerReadOnly, CustomIsShared, CustomIsSpaceOwner, CustomIsUser, CustomRecipePermission, CustomTokenHasReadWriteScope, + CustomTokenHasScope, CustomUserPermission, IsReadOnlyDRF, above_space_limit, group_required, has_group_permission, is_space_owner, switch_user_active_space, +) from cookbook.helper.recipe_search import RecipeSearch -from cookbook.helper.recipe_url_import import (clean_dict, get_from_youtube_scraper, - get_images_from_soup) +from cookbook.helper.recipe_url_import import clean_dict, get_from_youtube_scraper, get_images_from_soup from cookbook.helper.scrapers.scrapers import text_scraper from cookbook.helper.shopping_helper import RecipeShoppingEditor, shopping_helper -from cookbook.models import (Automation, BookmarkletImport, CookLog, CustomFilter, ExportLog, Food, - FoodInheritField, FoodProperty, ImportLog, Ingredient, InviteLink, - Keyword, MealPlan, MealType, Property, PropertyType, Recipe, - RecipeBook, RecipeBookEntry, ShareLink, ShoppingList, - ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage, - Supermarket, SupermarketCategory, SupermarketCategoryRelation, Sync, - SyncLog, Unit, UnitConversion, UserFile, UserPreference, UserSpace, - ViewLog) +from cookbook.models import ( + Automation, BookmarkletImport, CookLog, CustomFilter, ExportLog, Food, FoodInheritField, FoodProperty, ImportLog, Ingredient, InviteLink, Keyword, MealPlan, MealType, + Property, PropertyType, Recipe, RecipeBook, RecipeBookEntry, ShareLink, ShoppingList, ShoppingListEntry, ShoppingListRecipe, Space, Step, Storage, Supermarket, + SupermarketCategory, SupermarketCategoryRelation, Sync, SyncLog, Unit, UnitConversion, UserFile, UserPreference, UserSpace, ViewLog, +) from cookbook.provider.dropbox import Dropbox from cookbook.provider.local import Local from cookbook.provider.nextcloud import Nextcloud from cookbook.schemas import FilterSchema, QueryParam, QueryParamAutoSchema, TreeSchema -from cookbook.serializer import (AccessTokenSerializer, AutomationSerializer, - AutoMealPlanSerializer, BookmarkletImportListSerializer, - BookmarkletImportSerializer, CookLogSerializer, - CustomFilterSerializer, ExportLogSerializer, - FoodInheritFieldSerializer, FoodSerializer, - FoodShoppingUpdateSerializer, FoodSimpleSerializer, - GroupSerializer, ImportLogSerializer, IngredientSerializer, - IngredientSimpleSerializer, InviteLinkSerializer, - KeywordSerializer, MealPlanSerializer, MealTypeSerializer, - PropertySerializer, PropertyTypeSerializer, - RecipeBookEntrySerializer, RecipeBookSerializer, - RecipeExportSerializer, RecipeFromSourceSerializer, - RecipeImageSerializer, RecipeOverviewSerializer, RecipeSerializer, - RecipeShoppingUpdateSerializer, RecipeSimpleSerializer, - ShoppingListAutoSyncSerializer, ShoppingListEntrySerializer, - ShoppingListRecipeSerializer, ShoppingListSerializer, - SpaceSerializer, StepSerializer, StorageSerializer, - SupermarketCategoryRelationSerializer, - SupermarketCategorySerializer, SupermarketSerializer, - SyncLogSerializer, SyncSerializer, UnitConversionSerializer, - UnitSerializer, UserFileSerializer, UserPreferenceSerializer, - UserSerializer, UserSpaceSerializer, ViewLogSerializer, - ShoppingListEntryBulkSerializer) +from cookbook.serializer import ( + AccessTokenSerializer, AutomationSerializer, AutoMealPlanSerializer, BookmarkletImportListSerializer, BookmarkletImportSerializer, CookLogSerializer, CustomFilterSerializer, + ExportLogSerializer, FoodInheritFieldSerializer, FoodSerializer, FoodShoppingUpdateSerializer, FoodSimpleSerializer, GroupSerializer, ImportLogSerializer, + IngredientSerializer, IngredientSimpleSerializer, InviteLinkSerializer, KeywordSerializer, MealPlanSerializer, MealTypeSerializer, PropertySerializer, PropertyTypeSerializer, + RecipeBookEntrySerializer, RecipeBookSerializer, RecipeExportSerializer, RecipeFromSourceSerializer, RecipeImageSerializer, RecipeOverviewSerializer, RecipeSerializer, + RecipeShoppingUpdateSerializer, RecipeSimpleSerializer, ShoppingListAutoSyncSerializer, ShoppingListEntryBulkSerializer, ShoppingListEntrySerializer, + ShoppingListRecipeSerializer, ShoppingListSerializer, SpaceSerializer, StepSerializer, StorageSerializer, SupermarketCategoryRelationSerializer, SupermarketCategorySerializer, + SupermarketSerializer, SyncLogSerializer, SyncSerializer, UnitConversionSerializer, UnitSerializer, UserFileSerializer, UserPreferenceSerializer, UserSerializer, + UserSpaceSerializer, ViewLogSerializer, +) from cookbook.views.import_export import get_integration from recipes import settings -from recipes.settings import FDC_API_KEY, DRF_THROTTLE_RECIPE_URL_IMPORT +from recipes.settings import DRF_THROTTLE_RECIPE_URL_IMPORT, FDC_API_KEY class StandardFilterMixin(ViewSetMixin): @@ -612,14 +591,19 @@ class FoodViewSet(viewsets.ModelViewSet, TreeMixin): response = requests.get(f'https://api.nal.usda.gov/fdc/v1/food/{food.fdc_id}?api_key={FDC_API_KEY}') if response.status_code == 429: - return JsonResponse({'msg': 'API Key Rate Limit reached/exceeded, see https://api.data.gov/docs/rate-limits/ for more information. Configure your key in Tandoor using environment FDC_API_KEY variable.'}, status=429, + return JsonResponse({'msg': 'API Key Rate Limit reached/exceeded, see https://api.data.gov/docs/rate-limits/ for more information. \ + Configure your key in Tandoor using environment FDC_API_KEY variable.'}, + status=429, json_dumps_params={'indent': 4}) if response.status_code != 200: return JsonResponse({'msg': f'Error while requesting FDC data using url https://api.nal.usda.gov/fdc/v1/food/{food.fdc_id}?api_key=****'}, status=response.status_code, json_dumps_params={'indent': 4}) food.properties_food_amount = 100 - food.properties_food_unit = Unit.objects.get_or_create(base_unit__iexact='g', space=self.request.space, defaults={'name': 'g', 'base_unit': 'g', 'space': self.request.space})[0] + food.properties_food_unit = Unit.objects.get_or_create( + base_unit__iexact='g', + space=self.request.space, + defaults={'name': 'g', 'base_unit': 'g', 'space': self.request.space})[0] food.save() try: @@ -1153,7 +1137,10 @@ class ShoppingListEntryViewSet(viewsets.ModelViewSet): permission_classes = [(CustomIsOwner | CustomIsShared) & CustomTokenHasReadWriteScope] query_params = [ QueryParam(name='id', description=_('Returns the shopping list entry with a primary key of id. Multiple values allowed.'), qtype='integer'), - QueryParam(name='checked', description=_('Filter shopping list entries on checked. [''true'', ''false'', ''both'', ''recent'']
- ''recent'' includes unchecked items and recently completed items.') + QueryParam( + name='checked', + description=_('Filter shopping list entries on checked. [''true'', ''false'', ''both'', ''recent'']
\ + - ''recent'' includes unchecked items and recently completed items.') ), QueryParam(name='supermarket', description=_('Returns the shopping list entries sorted by supermarket category order.'), qtype='integer'), ] @@ -1198,7 +1185,7 @@ class ShoppingListEntryViewSet(viewsets.ModelViewSet): if last_autosync: last_autosync = datetime.datetime.fromtimestamp(int(last_autosync) / 1000, datetime.timezone.utc) self.queryset = self.queryset.filter(updated_at__gte=last_autosync) - except: + except Exception: traceback.print_exc() # TODO once old shopping list is removed this needs updated to sharing users in preferences @@ -1323,12 +1310,52 @@ class UserFileViewSet(viewsets.ModelViewSet, StandardFilterMixin): class AutomationViewSet(viewsets.ModelViewSet, StandardFilterMixin): + """ + list: + optional parameters + + - **automation_type**: Return the Automations matching the automation type. Multiple values allowed. + + *Automation Types:* + - FS: Food Alias + - UA: Unit Alias + - KA: Keyword Alias + - DR: Description Replace + - IR: Instruction Replace + - NU: Never Unit + - TW: Transpose Words + - FR: Food Replace + - UR: Unit Replace + - NR: Name Replace + """ + queryset = Automation.objects serializer_class = AutomationSerializer permission_classes = [CustomIsUser & CustomTokenHasReadWriteScope] pagination_class = DefaultPagination + query_params = [ + QueryParam(name='automation_type', description=_('Return the Automations matching the automation type. Multiple values allowed.'), qtype='string'), + ] + schema = QueryParamAutoSchema() + + auto_type = { + 'FS': 'FOOD_ALIAS', + 'UA': 'UNIT_ALIAS', + 'KA': 'KEYWORD_ALIAS', + 'DR': 'DESCRIPTION_REPLACE', + 'IR': 'INSTRUCTION_REPLACE', + 'NU': 'NEVER_UNIT', + 'TW': 'TRANSPOSE_WORDS', + 'FR': 'FOOD_REPLACE', + 'UR': 'UNIT_REPLACE', + 'NR': 'NAME_REPLACE' + } + def get_queryset(self): + automation_type = self.request.query_params.getlist('automation_type', []) + if automation_type: + self.queryset = self.queryset.filter(type__in=[self.auto_type[x.upper()] for x in automation_type]) self.queryset = self.queryset.filter(space=self.request.space).all() return super().get_queryset() diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js index 87278d9dc..42182baf8 100644 --- a/vue/src/utils/models.js +++ b/vue/src/utils/models.js @@ -518,7 +518,7 @@ export class Models { header_component: { name: "BetaWarning", }, - params: ["page", "pageSize", "options"], + params: ["automation_type", "page", "pageSize", "options"], }, create: { params: [["name", "description", "type", "param_1", "param_2", "param_3", "order", "disabled"]], diff --git a/vue/src/utils/openapi/api.ts b/vue/src/utils/openapi/api.ts index 69ace31e4..a508927da 100644 --- a/vue/src/utils/openapi/api.ts +++ b/vue/src/utils/openapi/api.ts @@ -6979,13 +6979,14 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) }; }, /** - * + * optional parameters - **automation_type**: Return the Automations matching the automation type. Multiple values allowed. *Automation Types:* - FS: Food Alias - UA: Unit Alias - KA: Keyword Alias - DR: Description Replace - IR: Instruction Replace - NU: Never Unit - TW: Transpose Words - FR: Food Replace - UR: Unit Replace - NR: Name Replace + * @param {string} [automationType] Return the Automations matching the automation type. Multiple values allowed. * @param {number} [page] A page number within the paginated result set. * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listAutomations: async (page?: number, pageSize?: number, options: any = {}): Promise => { + listAutomations: async (automationType?: string, page?: number, pageSize?: number, 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); @@ -6998,6 +6999,10 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; + if (automationType !== undefined) { + localVarQueryParameter['automation_type'] = automationType; + } + if (page !== undefined) { localVarQueryParameter['page'] = page; } @@ -7802,7 +7807,7 @@ export const ApiApiAxiosParamCreator = function (configuration?: Configuration) /** * * @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed. - * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. + * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. * @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -13394,14 +13399,15 @@ export const ApiApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** - * + * optional parameters - **automation_type**: Return the Automations matching the automation type. Multiple values allowed. *Automation Types:* - FS: Food Alias - UA: Unit Alias - KA: Keyword Alias - DR: Description Replace - IR: Instruction Replace - NU: Never Unit - TW: Transpose Words - FR: Food Replace - UR: Unit Replace - NR: Name Replace + * @param {string} [automationType] Return the Automations matching the automation type. Multiple values allowed. * @param {number} [page] A page number within the paginated result set. * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - async listAutomations(page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(page, pageSize, options); + async listAutomations(automationType?: string, page?: number, pageSize?: number, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.listAutomations(automationType, page, pageSize, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** @@ -13621,7 +13627,7 @@ export const ApiApiFp = function(configuration?: Configuration) { /** * * @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed. - * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. + * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. * @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -15709,14 +15715,15 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: return localVarFp.listAccessTokens(options).then((request) => request(axios, basePath)); }, /** - * + * optional parameters - **automation_type**: Return the Automations matching the automation type. Multiple values allowed. *Automation Types:* - FS: Food Alias - UA: Unit Alias - KA: Keyword Alias - DR: Description Replace - IR: Instruction Replace - NU: Never Unit - TW: Transpose Words - FR: Food Replace - UR: Unit Replace - NR: Name Replace + * @param {string} [automationType] Return the Automations matching the automation type. Multiple values allowed. * @param {number} [page] A page number within the paginated result set. * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} */ - listAutomations(page?: number, pageSize?: number, options?: any): AxiosPromise { - return localVarFp.listAutomations(page, pageSize, options).then((request) => request(axios, basePath)); + listAutomations(automationType?: string, page?: number, pageSize?: number, options?: any): AxiosPromise { + return localVarFp.listAutomations(automationType, page, pageSize, options).then((request) => request(axios, basePath)); }, /** * @@ -15917,7 +15924,7 @@ export const ApiApiFactory = function (configuration?: Configuration, basePath?: /** * * @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed. - * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. + * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. * @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -18010,15 +18017,16 @@ export class ApiApi extends BaseAPI { } /** - * + * optional parameters - **automation_type**: Return the Automations matching the automation type. Multiple values allowed. *Automation Types:* - FS: Food Alias - UA: Unit Alias - KA: Keyword Alias - DR: Description Replace - IR: Instruction Replace - NU: Never Unit - TW: Transpose Words - FR: Food Replace - UR: Unit Replace - NR: Name Replace + * @param {string} [automationType] Return the Automations matching the automation type. Multiple values allowed. * @param {number} [page] A page number within the paginated result set. * @param {number} [pageSize] Number of results to return per page. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApiApi */ - public listAutomations(page?: number, pageSize?: number, options?: any) { - return ApiApiFp(this.configuration).listAutomations(page, pageSize, options).then((request) => request(this.axios, this.basePath)); + public listAutomations(automationType?: string, page?: number, pageSize?: number, options?: any) { + return ApiApiFp(this.configuration).listAutomations(automationType, page, pageSize, options).then((request) => request(this.axios, this.basePath)); } /** @@ -18256,7 +18264,7 @@ export class ApiApi extends BaseAPI { /** * * @param {number} [id] Returns the shopping list entry with a primary key of id. Multiple values allowed. - * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. + * @param {string} [checked] Filter shopping list entries on checked. [true, false, both, <b>recent</b>]<br> - recent includes unchecked items and recently completed items. * @param {number} [supermarket] Returns the shopping list entries sorted by supermarket category order. * @param {*} [options] Override http request option. * @throws {RequiredError}