mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-01 20:28:46 -05:00
playing with FDC search integration
This commit is contained in:
@@ -17,6 +17,8 @@ models/CustomFilter.ts
|
||||
models/DefaultPageEnum.ts
|
||||
models/DeleteEnum.ts
|
||||
models/ExportLog.ts
|
||||
models/FdcQuery.ts
|
||||
models/FdcQueryFoods.ts
|
||||
models/Food.ts
|
||||
models/FoodInheritField.ts
|
||||
models/FoodShoppingUpdate.ts
|
||||
|
||||
@@ -23,6 +23,7 @@ import type {
|
||||
CookLog,
|
||||
CustomFilter,
|
||||
ExportLog,
|
||||
FdcQuery,
|
||||
Food,
|
||||
FoodInheritField,
|
||||
FoodShoppingUpdate,
|
||||
@@ -165,6 +166,8 @@ import {
|
||||
CustomFilterToJSON,
|
||||
ExportLogFromJSON,
|
||||
ExportLogToJSON,
|
||||
FdcQueryFromJSON,
|
||||
FdcQueryToJSON,
|
||||
FoodFromJSON,
|
||||
FoodToJSON,
|
||||
FoodInheritFieldFromJSON,
|
||||
@@ -609,6 +612,11 @@ export interface ApiExportLogUpdateRequest {
|
||||
exportLog: Omit<ExportLog, 'createdBy'|'createdAt'>;
|
||||
}
|
||||
|
||||
export interface ApiFdcSearchRetrieveRequest {
|
||||
dataType?: Array<string>;
|
||||
query?: string;
|
||||
}
|
||||
|
||||
export interface ApiFoodCreateRequest {
|
||||
food: Omit<Food, 'shopping'|'parent'|'numchild'|'fullName'|'substituteOnhand'>;
|
||||
}
|
||||
@@ -684,7 +692,7 @@ export interface ApiImageToRecipeCreateRequest {
|
||||
image: string;
|
||||
}
|
||||
|
||||
export interface ApiImageToRecipeCreate2Request {
|
||||
export interface ApiImportCreateRequest {
|
||||
image: string;
|
||||
}
|
||||
|
||||
@@ -3462,6 +3470,42 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiFdcSearchRetrieveRaw(requestParameters: ApiFdcSearchRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FdcQuery>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
if (requestParameters['dataType'] != null) {
|
||||
queryParameters['dataType'] = requestParameters['dataType'];
|
||||
}
|
||||
|
||||
if (requestParameters['query'] != null) {
|
||||
queryParameters['query'] = requestParameters['query'];
|
||||
}
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
if (this.configuration && this.configuration.apiKey) {
|
||||
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/fdc-search/`,
|
||||
method: 'GET',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.JSONApiResponse(response, (jsonValue) => FdcQueryFromJSON(jsonValue));
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiFdcSearchRetrieve(requestParameters: ApiFdcSearchRetrieveRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FdcQuery> {
|
||||
const response = await this.apiFdcSearchRetrieveRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* logs request counts to redis cache total/per user/
|
||||
*/
|
||||
@@ -4165,7 +4209,7 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/image-to-recipe`,
|
||||
path: `/api/image-to-recipe/`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
@@ -4184,11 +4228,11 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImageToRecipeCreate2Raw(requestParameters: ApiImageToRecipeCreate2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RecipeFromSourceResponse>> {
|
||||
async apiImportCreateRaw(requestParameters: ApiImportCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RecipeFromSourceResponse>> {
|
||||
if (requestParameters['image'] == null) {
|
||||
throw new runtime.RequiredError(
|
||||
'image',
|
||||
'Required parameter "image" was null or undefined when calling apiImageToRecipeCreate2().'
|
||||
'Required parameter "image" was null or undefined when calling apiImportCreate().'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4219,7 +4263,7 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/image-to-recipe/`,
|
||||
path: `/api/import/`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
@@ -4231,40 +4275,11 @@ export class ApiApi extends runtime.BaseAPI {
|
||||
|
||||
/**
|
||||
*/
|
||||
async apiImageToRecipeCreate2(requestParameters: ApiImageToRecipeCreate2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RecipeFromSourceResponse> {
|
||||
const response = await this.apiImageToRecipeCreate2Raw(requestParameters, initOverrides);
|
||||
async apiImportCreate(requestParameters: ApiImportCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RecipeFromSourceResponse> {
|
||||
const response = await this.apiImportCreateRaw(requestParameters, initOverrides);
|
||||
return await response.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* function to handle files passed by application importer
|
||||
*/
|
||||
async apiImportCreateRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
||||
const queryParameters: any = {};
|
||||
|
||||
const headerParameters: runtime.HTTPHeaders = {};
|
||||
|
||||
if (this.configuration && this.configuration.apiKey) {
|
||||
headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKeyAuth authentication
|
||||
}
|
||||
|
||||
const response = await this.request({
|
||||
path: `/api/import/`,
|
||||
method: 'POST',
|
||||
headers: headerParameters,
|
||||
query: queryParameters,
|
||||
}, initOverrides);
|
||||
|
||||
return new runtime.VoidApiResponse(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* function to handle files passed by application importer
|
||||
*/
|
||||
async apiImportCreate(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
||||
await this.apiImportCreateRaw(initOverrides);
|
||||
}
|
||||
|
||||
/**
|
||||
* logs request counts to redis cache total/per user/
|
||||
*/
|
||||
|
||||
95
vue3/src/openapi/models/FdcQuery.ts
Normal file
95
vue3/src/openapi/models/FdcQuery.ts
Normal file
@@ -0,0 +1,95 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Tandoor
|
||||
* Tandoor API Docs
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
import type { FdcQueryFoods } from './FdcQueryFoods';
|
||||
import {
|
||||
FdcQueryFoodsFromJSON,
|
||||
FdcQueryFoodsFromJSONTyped,
|
||||
FdcQueryFoodsToJSON,
|
||||
} from './FdcQueryFoods';
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface FdcQuery
|
||||
*/
|
||||
export interface FdcQuery {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FdcQuery
|
||||
*/
|
||||
totalHits: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FdcQuery
|
||||
*/
|
||||
currentPage: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FdcQuery
|
||||
*/
|
||||
totalPages: number;
|
||||
/**
|
||||
*
|
||||
* @type {Array<FdcQueryFoods>}
|
||||
* @memberof FdcQuery
|
||||
*/
|
||||
foods: Array<FdcQueryFoods>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the FdcQuery interface.
|
||||
*/
|
||||
export function instanceOfFdcQuery(value: object): value is FdcQuery {
|
||||
if (!('totalHits' in value) || value['totalHits'] === undefined) return false;
|
||||
if (!('currentPage' in value) || value['currentPage'] === undefined) return false;
|
||||
if (!('totalPages' in value) || value['totalPages'] === undefined) return false;
|
||||
if (!('foods' in value) || value['foods'] === undefined) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function FdcQueryFromJSON(json: any): FdcQuery {
|
||||
return FdcQueryFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function FdcQueryFromJSONTyped(json: any, ignoreDiscriminator: boolean): FdcQuery {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'totalHits': json['totalHits'],
|
||||
'currentPage': json['currentPage'],
|
||||
'totalPages': json['totalPages'],
|
||||
'foods': ((json['foods'] as Array<any>).map(FdcQueryFoodsFromJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
export function FdcQueryToJSON(value?: FdcQuery | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'totalHits': value['totalHits'],
|
||||
'currentPage': value['currentPage'],
|
||||
'totalPages': value['totalPages'],
|
||||
'foods': ((value['foods'] as Array<any>).map(FdcQueryFoodsToJSON)),
|
||||
};
|
||||
}
|
||||
|
||||
79
vue3/src/openapi/models/FdcQueryFoods.ts
Normal file
79
vue3/src/openapi/models/FdcQueryFoods.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
/**
|
||||
* Tandoor
|
||||
* Tandoor API Docs
|
||||
*
|
||||
* The version of the OpenAPI document: 0.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
import { mapValues } from '../runtime';
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @interface FdcQueryFoods
|
||||
*/
|
||||
export interface FdcQueryFoods {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof FdcQueryFoods
|
||||
*/
|
||||
fdcId: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FdcQueryFoods
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof FdcQueryFoods
|
||||
*/
|
||||
dataType: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a given object implements the FdcQueryFoods interface.
|
||||
*/
|
||||
export function instanceOfFdcQueryFoods(value: object): value is FdcQueryFoods {
|
||||
if (!('fdcId' in value) || value['fdcId'] === undefined) return false;
|
||||
if (!('description' in value) || value['description'] === undefined) return false;
|
||||
if (!('dataType' in value) || value['dataType'] === undefined) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
export function FdcQueryFoodsFromJSON(json: any): FdcQueryFoods {
|
||||
return FdcQueryFoodsFromJSONTyped(json, false);
|
||||
}
|
||||
|
||||
export function FdcQueryFoodsFromJSONTyped(json: any, ignoreDiscriminator: boolean): FdcQueryFoods {
|
||||
if (json == null) {
|
||||
return json;
|
||||
}
|
||||
return {
|
||||
|
||||
'fdcId': json['fdcId'],
|
||||
'description': json['description'],
|
||||
'dataType': json['dataType'],
|
||||
};
|
||||
}
|
||||
|
||||
export function FdcQueryFoodsToJSON(value?: FdcQueryFoods | null): any {
|
||||
if (value == null) {
|
||||
return value;
|
||||
}
|
||||
return {
|
||||
|
||||
'fdcId': value['fdcId'],
|
||||
'description': value['description'],
|
||||
'dataType': value['dataType'],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export * from './CustomFilter';
|
||||
export * from './DefaultPageEnum';
|
||||
export * from './DeleteEnum';
|
||||
export * from './ExportLog';
|
||||
export * from './FdcQuery';
|
||||
export * from './FdcQueryFoods';
|
||||
export * from './Food';
|
||||
export * from './FoodInheritField';
|
||||
export * from './FoodShoppingUpdate';
|
||||
|
||||
Reference in New Issue
Block a user