28 lines
792 B
TypeScript
28 lines
792 B
TypeScript
import { CrudClient } from "../infra/crud-client"
|
|
import type { ApiClientOptions } from "../infra/client"
|
|
import type { ApiPath } from "../infra/types"
|
|
|
|
export const SERVICE_ROUTES = {
|
|
INDEX: "/api/services",
|
|
BY_ID: "/api/services/{id}",
|
|
IMPORT: "/api/import-services",
|
|
EXPORT: "/api/export-services",
|
|
} as const satisfies Record<string, ApiPath>
|
|
|
|
export class ServicesClient extends CrudClient<
|
|
typeof SERVICE_ROUTES.INDEX,
|
|
typeof SERVICE_ROUTES.BY_ID
|
|
> {
|
|
constructor(baseUrl?: string, defaultOptions?: ApiClientOptions) {
|
|
super(
|
|
baseUrl,
|
|
defaultOptions,
|
|
SERVICE_ROUTES.INDEX,
|
|
SERVICE_ROUTES.BY_ID,
|
|
SERVICE_ROUTES.IMPORT,
|
|
SERVICE_ROUTES.EXPORT,
|
|
"POST",
|
|
)
|
|
}
|
|
}
|