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

175 lines
4.5 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 { FoodPropertiesFoodUnit } from './FoodPropertiesFoodUnit';
import {
FoodPropertiesFoodUnitFromJSON,
FoodPropertiesFoodUnitFromJSONTyped,
FoodPropertiesFoodUnitToJSON,
} from './FoodPropertiesFoodUnit';
import type { IngredientFood } from './IngredientFood';
import {
IngredientFoodFromJSON,
IngredientFoodFromJSONTyped,
IngredientFoodToJSON,
} from './IngredientFood';
/**
*
* @export
* @interface Ingredient
*/
export interface Ingredient {
/**
*
* @type {number}
* @memberof Ingredient
*/
readonly id?: number;
/**
*
* @type {IngredientFood}
* @memberof Ingredient
*/
food: IngredientFood | null;
/**
*
* @type {FoodPropertiesFoodUnit}
* @memberof Ingredient
*/
unit: FoodPropertiesFoodUnit | null;
/**
*
* @type {string}
* @memberof Ingredient
*/
amount: string;
/**
*
* @type {string}
* @memberof Ingredient
*/
readonly conversions?: string;
/**
*
* @type {string}
* @memberof Ingredient
*/
note?: string | null;
/**
*
* @type {number}
* @memberof Ingredient
*/
order?: number;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
isHeader?: boolean;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
noAmount?: boolean;
/**
*
* @type {string}
* @memberof Ingredient
*/
originalText?: string | null;
/**
*
* @type {string}
* @memberof Ingredient
*/
readonly usedInRecipes?: string;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
alwaysUsePluralUnit?: boolean;
/**
*
* @type {boolean}
* @memberof Ingredient
*/
alwaysUsePluralFood?: boolean;
}
/**
* Check if a given object implements the Ingredient interface.
*/
export function instanceOfIngredient(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "food" in value;
isInstance = isInstance && "unit" in value;
isInstance = isInstance && "amount" in value;
return isInstance;
}
export function IngredientFromJSON(json: any): Ingredient {
return IngredientFromJSONTyped(json, false);
}
export function IngredientFromJSONTyped(json: any, ignoreDiscriminator: boolean): Ingredient {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'food': IngredientFoodFromJSON(json['food']),
'unit': FoodPropertiesFoodUnitFromJSON(json['unit']),
'amount': json['amount'],
'conversions': !exists(json, 'conversions') ? undefined : json['conversions'],
'note': !exists(json, 'note') ? undefined : json['note'],
'order': !exists(json, 'order') ? undefined : json['order'],
'isHeader': !exists(json, 'is_header') ? undefined : json['is_header'],
'noAmount': !exists(json, 'no_amount') ? undefined : json['no_amount'],
'originalText': !exists(json, 'original_text') ? undefined : json['original_text'],
'usedInRecipes': !exists(json, 'used_in_recipes') ? undefined : json['used_in_recipes'],
'alwaysUsePluralUnit': !exists(json, 'always_use_plural_unit') ? undefined : json['always_use_plural_unit'],
'alwaysUsePluralFood': !exists(json, 'always_use_plural_food') ? undefined : json['always_use_plural_food'],
};
}
export function IngredientToJSON(value?: Ingredient | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'food': IngredientFoodToJSON(value.food),
'unit': FoodPropertiesFoodUnitToJSON(value.unit),
'amount': value.amount,
'note': value.note,
'order': value.order,
'is_header': value.isHeader,
'no_amount': value.noAmount,
'original_text': value.originalText,
'always_use_plural_unit': value.alwaysUsePluralUnit,
'always_use_plural_food': value.alwaysUsePluralFood,
};
}