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

164 lines
4.9 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 { CustomFilterSharedInner } from './CustomFilterSharedInner';
import {
CustomFilterSharedInnerFromJSON,
CustomFilterSharedInnerFromJSONTyped,
CustomFilterSharedInnerToJSON,
} from './CustomFilterSharedInner';
import type { ShoppingListEntriesInner } from './ShoppingListEntriesInner';
import {
ShoppingListEntriesInnerFromJSON,
ShoppingListEntriesInnerFromJSONTyped,
ShoppingListEntriesInnerToJSON,
} from './ShoppingListEntriesInner';
import type { ShoppingListRecipesInner } from './ShoppingListRecipesInner';
import {
ShoppingListRecipesInnerFromJSON,
ShoppingListRecipesInnerFromJSONTyped,
ShoppingListRecipesInnerToJSON,
} from './ShoppingListRecipesInner';
import type { ShoppingListSupermarket } from './ShoppingListSupermarket';
import {
ShoppingListSupermarketFromJSON,
ShoppingListSupermarketFromJSONTyped,
ShoppingListSupermarketToJSON,
} from './ShoppingListSupermarket';
/**
*
* @export
* @interface ShoppingList
*/
export interface ShoppingList {
/**
*
* @type {number}
* @memberof ShoppingList
*/
readonly id?: number;
/**
*
* @type {string}
* @memberof ShoppingList
*/
uuid?: string;
/**
*
* @type {string}
* @memberof ShoppingList
*/
note?: string | null;
/**
*
* @type {Array<ShoppingListRecipesInner>}
* @memberof ShoppingList
*/
recipes: Array<ShoppingListRecipesInner> | null;
/**
*
* @type {Array<ShoppingListEntriesInner>}
* @memberof ShoppingList
*/
entries: Array<ShoppingListEntriesInner> | null;
/**
*
* @type {Array<CustomFilterSharedInner>}
* @memberof ShoppingList
*/
shared: Array<CustomFilterSharedInner>;
/**
*
* @type {boolean}
* @memberof ShoppingList
*/
finished?: boolean;
/**
*
* @type {ShoppingListSupermarket}
* @memberof ShoppingList
*/
supermarket: ShoppingListSupermarket | null;
/**
*
* @type {string}
* @memberof ShoppingList
*/
readonly createdBy?: string;
/**
*
* @type {Date}
* @memberof ShoppingList
*/
readonly createdAt?: Date;
}
/**
* Check if a given object implements the ShoppingList interface.
*/
export function instanceOfShoppingList(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "recipes" in value;
isInstance = isInstance && "entries" in value;
isInstance = isInstance && "shared" in value;
isInstance = isInstance && "supermarket" in value;
return isInstance;
}
export function ShoppingListFromJSON(json: any): ShoppingList {
return ShoppingListFromJSONTyped(json, false);
}
export function ShoppingListFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShoppingList {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'uuid': !exists(json, 'uuid') ? undefined : json['uuid'],
'note': !exists(json, 'note') ? undefined : json['note'],
'recipes': (json['recipes'] === null ? null : (json['recipes'] as Array<any>).map(ShoppingListRecipesInnerFromJSON)),
'entries': (json['entries'] === null ? null : (json['entries'] as Array<any>).map(ShoppingListEntriesInnerFromJSON)),
'shared': ((json['shared'] as Array<any>).map(CustomFilterSharedInnerFromJSON)),
'finished': !exists(json, 'finished') ? undefined : json['finished'],
'supermarket': ShoppingListSupermarketFromJSON(json['supermarket']),
'createdBy': !exists(json, 'created_by') ? undefined : json['created_by'],
'createdAt': !exists(json, 'created_at') ? undefined : (new Date(json['created_at'])),
};
}
export function ShoppingListToJSON(value?: ShoppingList | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'uuid': value.uuid,
'note': value.note,
'recipes': (value.recipes === null ? null : (value.recipes as Array<any>).map(ShoppingListRecipesInnerToJSON)),
'entries': (value.entries === null ? null : (value.entries as Array<any>).map(ShoppingListEntriesInnerToJSON)),
'shared': ((value.shared as Array<any>).map(CustomFilterSharedInnerToJSON)),
'finished': value.finished,
'supermarket': ShoppingListSupermarketToJSON(value.supermarket),
};
}