27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { ApiClient, type ApiClientOptions } from "../infra/client"
|
|
import type { ApiPath, ApiRequestBody } from "../infra/types"
|
|
|
|
export const CONFIGURATION_ROUTES = {
|
|
SALES_TAX_DISCOUNT: "/api/configurations/sales_tax_discount",
|
|
PURCHASE_TAX_DISCOUNT: "/api/configurations/purchase_tax_discount",
|
|
GENERAL_PREFERENCES: "/api/configurations/general_preferences",
|
|
} as const satisfies Record<string, ApiPath>
|
|
|
|
export class ConfigurationsClient extends ApiClient {
|
|
constructor(baseUrl?: string, defaultOptions?: ApiClientOptions) {
|
|
super(baseUrl, defaultOptions)
|
|
}
|
|
|
|
async updateSalesTaxDiscount(payload: ApiRequestBody<typeof CONFIGURATION_ROUTES.SALES_TAX_DISCOUNT, "put">) {
|
|
return this.put(CONFIGURATION_ROUTES.SALES_TAX_DISCOUNT, payload)
|
|
}
|
|
|
|
async updatePurchaseTaxDiscount(payload: ApiRequestBody<typeof CONFIGURATION_ROUTES.PURCHASE_TAX_DISCOUNT, "put">) {
|
|
return this.put(CONFIGURATION_ROUTES.PURCHASE_TAX_DISCOUNT, payload)
|
|
}
|
|
|
|
async updateGeneralPreferences(payload: ApiRequestBody<typeof CONFIGURATION_ROUTES.GENERAL_PREFERENCES, "put">) {
|
|
return this.put(CONFIGURATION_ROUTES.GENERAL_PREFERENCES, payload)
|
|
}
|
|
}
|