// 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 { AccountType, AccountTypeDef } from "yuebing-model"; import * as a from "~/utils/services/api"; export const accountService = { searchAccount, findAccount, createAccount, updateAccount, deleteAccount, }; function searchAccount(query?: MobilettoOrmFindApiOpts): Promise { return $fetch("/api/model/account", a.authPostJson(query)).then(a.handleJsonResponse); } function findAccount( id: string, serverErrors: Ref, ): Promise { return $fetch(`/api/model/account/${id}`, a.authGet()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function createAccount( account: AccountType, serverErrors: Ref, ): Promise { const id = AccountTypeDef.id(account); return $fetch(`/api/model/account/${id}`, a.authPutJson(account)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function updateAccount( account: AccountType, serverErrors: Ref, ): Promise { const id = AccountTypeDef.id(account); return $fetch(`/api/model/account/${id}`, a.authPatchJson(account)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function deleteAccount( id: string, serverErrors: Ref, purge?: boolean ): Promise { return $fetch(`/api/model/account/${id}/${purge ? `?purge=${purge}` : ""}`, a.authDelete()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; }