60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
|
|
import {
|
|
type NtftalkVar,
|
|
type NtftalkVarPageList,
|
|
type NtftalkVarSavePayload,
|
|
type NtftalkVarSearchParams,
|
|
type NtftalkVarService,
|
|
type NtftalkVarUpdatePayload,
|
|
} from "../model/ntftalk-var-interface";
|
|
|
|
class NtftalkVarApiService implements NtftalkVarService {
|
|
async getNtftalkVarPage(
|
|
params: NtftalkVarSearchParams,
|
|
): Promise<NtftalkVarPageList> {
|
|
const response = await client.get<NtftalkVarPageList>(
|
|
`${ENDPOINT.NTFTALK_SERVICE.NTFTALK_VAR}`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async getNtftalkVar(varCd: string): Promise<NtftalkVar> {
|
|
const response = await client.get<NtftalkVar>(
|
|
`${ENDPOINT.NTFTALK_SERVICE.NTFTALK_VAR}/${encodeURIComponent(varCd)}`,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async saveNtftalkVar(
|
|
payload: NtftalkVarSavePayload[],
|
|
): Promise<NtftalkVar[]> {
|
|
const response = await client.post<NtftalkVar[]>(
|
|
`${ENDPOINT.NTFTALK_SERVICE.NTFTALK_VAR}`,
|
|
payload,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async updateNtftalkVar(
|
|
varCd: string,
|
|
payload: NtftalkVarUpdatePayload,
|
|
): Promise<NtftalkVar> {
|
|
const response = await client.put<NtftalkVar>(
|
|
`${ENDPOINT.NTFTALK_SERVICE.NTFTALK_VAR}/${encodeURIComponent(varCd)}`,
|
|
payload,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
async deleteNtftalkVar(varCd: string): Promise<void> {
|
|
await client.delete(
|
|
`${ENDPOINT.NTFTALK_SERVICE.NTFTALK_VAR}/${encodeURIComponent(varCd)}`,
|
|
);
|
|
}
|
|
}
|
|
|
|
export const NtftalkVarApi = new NtftalkVarApiService();
|