// DO NOT EDIT THIS FILE. AUTO-GENERATED BY mobiletto-orm-typedef-gen import { Ref } from "vue"; import { MobilettoOrmObject, MobilettoOrmPurgeResults } from "mobiletto-orm-typedef"; import { MobilettoOrmValidationErrors } from "mobiletto-orm"; import { LibraryType, LibraryTypeDef } from "yuebing-model"; import * as a from "~/utils/services/api"; export const libraryService = { searchLibrary, findLibrary, createLibrary, updateLibrary, deleteLibrary, }; function searchLibrary(query?: MobilettoOrmFindApiOpts): Promise { return $fetch("/api/model/library", a.authPostJson(query)).then(a.handleJsonResponse); } function findLibrary( id: string, serverErrors: Ref, ): Promise { return $fetch(`/api/model/library/${id}`, a.authGet()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function createLibrary( library: LibraryType, serverErrors: Ref, ): Promise { const id = LibraryTypeDef.id(library); return $fetch(`/api/model/library/${id}`, a.authPutJson(library)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function updateLibrary( library: LibraryType, serverErrors: Ref, ): Promise { const id = LibraryTypeDef.id(library); return $fetch(`/api/model/library/${id}`, a.authPatchJson(library)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function deleteLibrary( id: string, serverErrors: Ref, purge?: boolean ): Promise { return $fetch(`/api/model/library/${id}/${purge ? `?purge=${purge}` : ""}`, a.authDelete()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; }