Files
recipes/models/Step.ts

176 lines
4.3 KiB
TypeScript

/* 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 { exists, mapValues } from '../runtime';
import type { Ingredient } from './Ingredient';
import {
IngredientFromJSON,
IngredientFromJSONTyped,
IngredientToJSON,
} from './Ingredient';
import type { PatchedSpaceImage } from './PatchedSpaceImage';
import {
PatchedSpaceImageFromJSON,
PatchedSpaceImageFromJSONTyped,
PatchedSpaceImageToJSON,
} from './PatchedSpaceImage';
/**
* Adds nested create feature
* @export
* @interface Step
*/
export interface Step {
/**
*
* @type {number}
* @memberof Step
*/
readonly id: number;
/**
*
* @type {string}
* @memberof Step
*/
name?: string;
/**
*
* @type {string}
* @memberof Step
*/
instruction?: string;
/**
*
* @type {Array<Ingredient>}
* @memberof Step
*/
ingredients: Array<Ingredient>;
/**
*
* @type {string}
* @memberof Step
*/
readonly instructionsMarkdown: string;
/**
*
* @type {number}
* @memberof Step
*/
time?: number;
/**
*
* @type {number}
* @memberof Step
*/
order?: number;
/**
*
* @type {boolean}
* @memberof Step
*/
showAsHeader?: boolean;
/**
*
* @type {PatchedSpaceImage}
* @memberof Step
*/
file?: PatchedSpaceImage | null;
/**
*
* @type {number}
* @memberof Step
*/
stepRecipe?: number | null;
/**
*
* @type {any}
* @memberof Step
*/
readonly stepRecipeData: any | null;
/**
*
* @type {number}
* @memberof Step
*/
readonly numrecipe: number;
/**
*
* @type {boolean}
* @memberof Step
*/
showIngredientsTable?: boolean;
}
/**
* Check if a given object implements the Step interface.
*/
export function instanceOfStep(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "id" in value;
isInstance = isInstance && "ingredients" in value;
isInstance = isInstance && "instructionsMarkdown" in value;
isInstance = isInstance && "stepRecipeData" in value;
isInstance = isInstance && "numrecipe" in value;
return isInstance;
}
export function StepFromJSON(json: any): Step {
return StepFromJSONTyped(json, false);
}
export function StepFromJSONTyped(json: any, ignoreDiscriminator: boolean): Step {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': json['id'],
'name': !exists(json, 'name') ? undefined : json['name'],
'instruction': !exists(json, 'instruction') ? undefined : json['instruction'],
'ingredients': ((json['ingredients'] as Array<any>).map(IngredientFromJSON)),
'instructionsMarkdown': json['instructions_markdown'],
'time': !exists(json, 'time') ? undefined : json['time'],
'order': !exists(json, 'order') ? undefined : json['order'],
'showAsHeader': !exists(json, 'show_as_header') ? undefined : json['show_as_header'],
'file': !exists(json, 'file') ? undefined : PatchedSpaceImageFromJSON(json['file']),
'stepRecipe': !exists(json, 'step_recipe') ? undefined : json['step_recipe'],
'stepRecipeData': json['step_recipe_data'],
'numrecipe': json['numrecipe'],
'showIngredientsTable': !exists(json, 'show_ingredients_table') ? undefined : json['show_ingredients_table'],
};
}
export function StepToJSON(value?: Step | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'instruction': value.instruction,
'ingredients': ((value.ingredients as Array<any>).map(IngredientToJSON)),
'time': value.time,
'order': value.order,
'show_as_header': value.showAsHeader,
'file': PatchedSpaceImageToJSON(value.file),
'step_recipe': value.stepRecipe,
'show_ingredients_table': value.showIngredientsTable,
};
}