Files
recipes/vue3/src/openapi/models/Recipe.ts
2024-02-29 20:08:37 +01:00

283 lines
7.5 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* 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 { exists, mapValues } from '../runtime';
import type { Keyword } from './Keyword';
import {
KeywordFromJSON,
KeywordFromJSONTyped,
KeywordToJSON,
} from './Keyword';
import type { NutritionInformation } from './NutritionInformation';
import {
NutritionInformationFromJSON,
NutritionInformationFromJSONTyped,
NutritionInformationToJSON,
} from './NutritionInformation';
import type { Property } from './Property';
import {
PropertyFromJSON,
PropertyFromJSONTyped,
PropertyToJSON,
} from './Property';
import type { Step } from './Step';
import {
StepFromJSON,
StepFromJSONTyped,
StepToJSON,
} from './Step';
import type { User } from './User';
import {
UserFromJSON,
UserFromJSONTyped,
UserToJSON,
} from './User';
/**
* Adds nested create feature
* @export
* @interface Recipe
*/
export interface Recipe {
/**
*
* @type {number}
* @memberof Recipe
*/
readonly id: number;
/**
*
* @type {string}
* @memberof Recipe
*/
name: string;
/**
*
* @type {string}
* @memberof Recipe
*/
description?: string | null;
/**
*
* @type {string}
* @memberof Recipe
*/
readonly image: string | null;
/**
*
* @type {Array<Keyword>}
* @memberof Recipe
*/
keywords?: Array<Keyword>;
/**
*
* @type {Array<Step>}
* @memberof Recipe
*/
steps: Array<Step>;
/**
*
* @type {number}
* @memberof Recipe
*/
workingTime?: number;
/**
*
* @type {number}
* @memberof Recipe
*/
waitingTime?: number;
/**
*
* @type {number}
* @memberof Recipe
*/
readonly createdBy: number;
/**
*
* @type {Date}
* @memberof Recipe
*/
readonly createdAt: Date;
/**
*
* @type {Date}
* @memberof Recipe
*/
readonly updatedAt: Date;
/**
*
* @type {string}
* @memberof Recipe
*/
sourceUrl?: string | null;
/**
*
* @type {boolean}
* @memberof Recipe
*/
internal?: boolean;
/**
*
* @type {boolean}
* @memberof Recipe
*/
showIngredientOverview?: boolean;
/**
*
* @type {NutritionInformation}
* @memberof Recipe
*/
nutrition?: NutritionInformation | null;
/**
*
* @type {Array<Property>}
* @memberof Recipe
*/
properties?: Array<Property>;
/**
*
* @type {string}
* @memberof Recipe
*/
readonly foodProperties: string;
/**
*
* @type {number}
* @memberof Recipe
*/
servings?: number;
/**
*
* @type {string}
* @memberof Recipe
*/
filePath?: string;
/**
*
* @type {string}
* @memberof Recipe
*/
servingsText?: string;
/**
*
* @type {string}
* @memberof Recipe
*/
readonly rating: string | null;
/**
*
* @type {Date}
* @memberof Recipe
*/
readonly lastCooked: Date | null;
/**
*
* @type {boolean}
* @memberof Recipe
*/
_private?: boolean;
/**
*
* @type {Array<User>}
* @memberof Recipe
*/
shared?: Array<User>;
}
/**
* Check if a given object implements the Recipe interface.
*/
export function instanceOfRecipe(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "image" in value;
isInstance = isInstance && "steps" in value;
isInstance = isInstance && "createdBy" in value;
isInstance = isInstance && "createdAt" in value;
isInstance = isInstance && "updatedAt" in value;
isInstance = isInstance && "foodProperties" in value;
isInstance = isInstance && "rating" in value;
isInstance = isInstance && "lastCooked" in value;
return isInstance;
}
export function RecipeFromJSON(json: any): Recipe {
return RecipeFromJSONTyped(json, false);
}
export function RecipeFromJSONTyped(json: any, ignoreDiscriminator: boolean): Recipe {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': json['id'],
'name': json['name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'image': json['image'],
'keywords': !exists(json, 'keywords') ? undefined : ((json['keywords'] as Array<any>).map(KeywordFromJSON)),
'steps': ((json['steps'] as Array<any>).map(StepFromJSON)),
'workingTime': !exists(json, 'working_time') ? undefined : json['working_time'],
'waitingTime': !exists(json, 'waiting_time') ? undefined : json['waiting_time'],
'createdBy': json['created_by'],
'createdAt': (new Date(json['created_at'])),
'updatedAt': (new Date(json['updated_at'])),
'sourceUrl': !exists(json, 'source_url') ? undefined : json['source_url'],
'internal': !exists(json, 'internal') ? undefined : json['internal'],
'showIngredientOverview': !exists(json, 'show_ingredient_overview') ? undefined : json['show_ingredient_overview'],
'nutrition': !exists(json, 'nutrition') ? undefined : NutritionInformationFromJSON(json['nutrition']),
'properties': !exists(json, 'properties') ? undefined : ((json['properties'] as Array<any>).map(PropertyFromJSON)),
'foodProperties': json['food_properties'],
'servings': !exists(json, 'servings') ? undefined : json['servings'],
'filePath': !exists(json, 'file_path') ? undefined : json['file_path'],
'servingsText': !exists(json, 'servings_text') ? undefined : json['servings_text'],
'rating': json['rating'],
'lastCooked': (json['last_cooked'] === null ? null : new Date(json['last_cooked'])),
'_private': !exists(json, 'private') ? undefined : json['private'],
'shared': !exists(json, 'shared') ? undefined : ((json['shared'] as Array<any>).map(UserFromJSON)),
};
}
export function RecipeToJSON(value?: Recipe | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'description': value.description,
'keywords': value.keywords === undefined ? undefined : ((value.keywords as Array<any>).map(KeywordToJSON)),
'steps': ((value.steps as Array<any>).map(StepToJSON)),
'working_time': value.workingTime,
'waiting_time': value.waitingTime,
'source_url': value.sourceUrl,
'internal': value.internal,
'show_ingredient_overview': value.showIngredientOverview,
'nutrition': NutritionInformationToJSON(value.nutrition),
'properties': value.properties === undefined ? undefined : ((value.properties as Array<any>).map(PropertyToJSON)),
'servings': value.servings,
'file_path': value.filePath,
'servings_text': value.servingsText,
'private': value._private,
'shared': value.shared === undefined ? undefined : ((value.shared as Array<any>).map(UserToJSON)),
};
}