/* 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 { IngredientFood } from './IngredientFood'; import { IngredientFoodFromJSON, IngredientFoodFromJSONTyped, IngredientFoodToJSON, } from './IngredientFood'; import type { UnitConversionBaseUnit } from './UnitConversionBaseUnit'; import { UnitConversionBaseUnitFromJSON, UnitConversionBaseUnitFromJSONTyped, UnitConversionBaseUnitToJSON, } from './UnitConversionBaseUnit'; /** * * @export * @interface UnitConversion */ export interface UnitConversion { /** * * @type {number} * @memberof UnitConversion */ readonly id?: number; /** * * @type {string} * @memberof UnitConversion */ readonly name?: string; /** * * @type {string} * @memberof UnitConversion */ baseAmount: string; /** * * @type {UnitConversionBaseUnit} * @memberof UnitConversion */ baseUnit: UnitConversionBaseUnit; /** * * @type {string} * @memberof UnitConversion */ convertedAmount: string; /** * * @type {UnitConversionBaseUnit} * @memberof UnitConversion */ convertedUnit: UnitConversionBaseUnit; /** * * @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 && "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': !exists(json, 'id') ? undefined : json['id'], 'name': !exists(json, 'name') ? undefined : json['name'], 'baseAmount': json['base_amount'], 'baseUnit': UnitConversionBaseUnitFromJSON(json['base_unit']), 'convertedAmount': json['converted_amount'], 'convertedUnit': UnitConversionBaseUnitFromJSON(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': UnitConversionBaseUnitToJSON(value.baseUnit), 'converted_amount': value.convertedAmount, 'converted_unit': UnitConversionBaseUnitToJSON(value.convertedUnit), 'food': IngredientFoodToJSON(value.food), 'open_data_slug': value.openDataSlug, }; }