// 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 { DestinationType, DestinationTypeDef } from "yuebing-model"; import * as a from "~/utils/services/api"; export const destinationService = { searchDestination, findDestination, createDestination, updateDestination, deleteDestination, }; function searchDestination(query?: MobilettoOrmFindApiOpts): Promise { return $fetch("/api/model/destination", a.authPostJson(query)).then(a.handleJsonResponse); } function findDestination( id: string, serverErrors: Ref, ): Promise { return $fetch(`/api/model/destination/${id}`, a.authGet()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function createDestination( destination: DestinationType, serverErrors: Ref, ): Promise { const id = DestinationTypeDef.id(destination); return $fetch(`/api/model/destination/${id}`, a.authPutJson(destination)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function updateDestination( destination: DestinationType, serverErrors: Ref, ): Promise { const id = DestinationTypeDef.id(destination); return $fetch(`/api/model/destination/${id}`, a.authPatchJson(destination)) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; } function deleteDestination( id: string, serverErrors: Ref, purge?: boolean ): Promise { return $fetch(`/api/model/destination/${id}/${purge ? `?purge=${purge}` : ""}`, a.authDelete()) .then(a.handleJsonResponse) .catch(a.handleErrors(serverErrors)) as Promise; }