mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
139 lines
3.3 KiB
TypeScript
139 lines
3.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 { IngredientFood } from './IngredientFood';
|
|
import {
|
|
IngredientFoodFromJSON,
|
|
IngredientFoodFromJSONTyped,
|
|
IngredientFoodToJSON,
|
|
} from './IngredientFood';
|
|
import type { Unit } from './Unit';
|
|
import {
|
|
UnitFromJSON,
|
|
UnitFromJSONTyped,
|
|
UnitToJSON,
|
|
} from './Unit';
|
|
|
|
/**
|
|
* Adds nested create feature
|
|
* @export
|
|
* @interface UnitConversion
|
|
*/
|
|
export interface UnitConversion {
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof UnitConversion
|
|
*/
|
|
readonly id: number;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof UnitConversion
|
|
*/
|
|
readonly name: string;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof UnitConversion
|
|
*/
|
|
baseAmount: number;
|
|
/**
|
|
*
|
|
* @type {Unit}
|
|
* @memberof UnitConversion
|
|
*/
|
|
baseUnit: Unit;
|
|
/**
|
|
*
|
|
* @type {number}
|
|
* @memberof UnitConversion
|
|
*/
|
|
convertedAmount: number;
|
|
/**
|
|
*
|
|
* @type {Unit}
|
|
* @memberof UnitConversion
|
|
*/
|
|
convertedUnit: Unit;
|
|
/**
|
|
*
|
|
* @type {IngredientFood}
|
|
* @memberof UnitConversion
|
|
*/
|
|
food?: IngredientFood | null;
|
|
/**
|
|
*
|
|
* @type {string}
|
|
* @memberof UnitConversion
|
|
*/
|
|
openDataSlug?: string | null;
|
|
}
|
|
|
|
/**
|
|
* Check if a given object implements the UnitConversion interface.
|
|
*/
|
|
export function instanceOfUnitConversion(value: object): boolean {
|
|
let isInstance = true;
|
|
isInstance = isInstance && "id" in value;
|
|
isInstance = isInstance && "name" in value;
|
|
isInstance = isInstance && "baseAmount" in value;
|
|
isInstance = isInstance && "baseUnit" in value;
|
|
isInstance = isInstance && "convertedAmount" in value;
|
|
isInstance = isInstance && "convertedUnit" in value;
|
|
|
|
return isInstance;
|
|
}
|
|
|
|
export function UnitConversionFromJSON(json: any): UnitConversion {
|
|
return UnitConversionFromJSONTyped(json, false);
|
|
}
|
|
|
|
export function UnitConversionFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnitConversion {
|
|
if ((json === undefined) || (json === null)) {
|
|
return json;
|
|
}
|
|
return {
|
|
|
|
'id': json['id'],
|
|
'name': json['name'],
|
|
'baseAmount': json['base_amount'],
|
|
'baseUnit': UnitFromJSON(json['base_unit']),
|
|
'convertedAmount': json['converted_amount'],
|
|
'convertedUnit': UnitFromJSON(json['converted_unit']),
|
|
'food': !exists(json, 'food') ? undefined : IngredientFoodFromJSON(json['food']),
|
|
'openDataSlug': !exists(json, 'open_data_slug') ? undefined : json['open_data_slug'],
|
|
};
|
|
}
|
|
|
|
export function UnitConversionToJSON(value?: UnitConversion | null): any {
|
|
if (value === undefined) {
|
|
return undefined;
|
|
}
|
|
if (value === null) {
|
|
return null;
|
|
}
|
|
return {
|
|
|
|
'base_amount': value.baseAmount,
|
|
'base_unit': UnitToJSON(value.baseUnit),
|
|
'converted_amount': value.convertedAmount,
|
|
'converted_unit': UnitToJSON(value.convertedUnit),
|
|
'food': IngredientFoodToJSON(value.food),
|
|
'open_data_slug': value.openDataSlug,
|
|
};
|
|
}
|
|
|