import { APICommonResponse, ApiId, HttpMethod, makeParam, request } from "."; import { getUrl } from "./url"; export type Contract = { id: string; name: string; custom?: string; updated_at: string; }; // 契約一覧取得 ----------------------- export type ContractsRequest = { id?: string; name?: string; }; export type ContractsResponse = { data: { records: Contract[]; }; } & APICommonResponse; export const getContracts = async (data: ContractsRequest) => { const res = await request({ url: getUrl(ApiId.CONTRACTS), method: HttpMethod.GET, data: new URLSearchParams(data), }); return res; }; // 契約新規登録 ----------------------- export type ContractCreateRequest = { name: string; custom?: string; }; export const createContract = async (data: ContractCreateRequest) => { const res = await request({ url: getUrl(ApiId.CONTRACT_CREATE), method: HttpMethod.POST, data: makeParam(data), }); return res; };