Files
recipes/vue3/models/RecipeOverview.ts
2024-03-27 08:34:19 -05:00

196 lines
5.3 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* Django Recipes
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document:
*
*
* 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 { MealPlanRecipeKeywordsInner } from './MealPlanRecipeKeywordsInner';
import {
MealPlanRecipeKeywordsInnerFromJSON,
MealPlanRecipeKeywordsInnerFromJSONTyped,
MealPlanRecipeKeywordsInnerToJSON,
} from './MealPlanRecipeKeywordsInner';
/**
*
* @export
* @interface RecipeOverview
*/
export interface RecipeOverview {
/**
*
* @type {number}
* @memberof RecipeOverview
*/
readonly id?: number;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
name: string;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
description?: string | null;
/**
*
* @type {Blob}
* @memberof RecipeOverview
*/
readonly image?: Blob | null;
/**
*
* @type {Array<MealPlanRecipeKeywordsInner>}
* @memberof RecipeOverview
*/
keywords: Array<MealPlanRecipeKeywordsInner>;
/**
*
* @type {number}
* @memberof RecipeOverview
*/
workingTime?: number;
/**
*
* @type {number}
* @memberof RecipeOverview
*/
waitingTime?: number;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
readonly createdBy?: string;
/**
*
* @type {Date}
* @memberof RecipeOverview
*/
readonly createdAt?: Date;
/**
*
* @type {Date}
* @memberof RecipeOverview
*/
readonly updatedAt?: Date;
/**
*
* @type {boolean}
* @memberof RecipeOverview
*/
internal?: boolean;
/**
*
* @type {number}
* @memberof RecipeOverview
*/
servings?: number;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
servingsText?: string;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
rating?: string | null;
/**
*
* @type {Date}
* @memberof RecipeOverview
*/
lastCooked?: Date | null;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
readonly _new?: string;
/**
*
* @type {string}
* @memberof RecipeOverview
*/
readonly recent?: string;
}
/**
* Check if a given object implements the RecipeOverview interface.
*/
export function instanceOfRecipeOverview(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "keywords" in value;
return isInstance;
}
export function RecipeOverviewFromJSON(json: any): RecipeOverview {
return RecipeOverviewFromJSONTyped(json, false);
}
export function RecipeOverviewFromJSONTyped(json: any, ignoreDiscriminator: boolean): RecipeOverview {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'name': json['name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'image': !exists(json, 'image') ? undefined : json['image'],
'keywords': ((json['keywords'] as Array<any>).map(MealPlanRecipeKeywordsInnerFromJSON)),
'workingTime': !exists(json, 'working_time') ? undefined : json['working_time'],
'waitingTime': !exists(json, 'waiting_time') ? undefined : json['waiting_time'],
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
'updatedAt': !exists(json, 'updated_at') ? undefined : (new Date(json['updated_at'])),
'internal': !exists(json, 'internal') ? undefined : json['internal'],
'servings': !exists(json, 'servings') ? undefined : json['servings'],
'servingsText': !exists(json, 'servings_text') ? undefined : json['servings_text'],
'rating': !exists(json, 'rating') ? undefined : json['rating'],
'lastCooked': !exists(json, 'last_cooked') ? undefined : (json['last_cooked'] === null ? null : new Date(json['last_cooked'])),
'_new': !exists(json, 'new') ? undefined : json['new'],
'recent': !exists(json, 'recent') ? undefined : json['recent'],
};
}
export function RecipeOverviewToJSON(value?: RecipeOverview | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'description': value.description,
'keywords': ((value.keywords as Array<any>).map(MealPlanRecipeKeywordsInnerToJSON)),
'working_time': value.workingTime,
'waiting_time': value.waitingTime,
'internal': value.internal,
'servings': value.servings,
'servings_text': value.servingsText,
'rating': value.rating,
'last_cooked': value.lastCooked === undefined ? undefined : (value.lastCooked === null ? null : value.lastCooked.toISOString()),
};
}