export type ContractResetDto = {reason?: string | undefined}; export type CreateApiV1OrganizationsOrgIdContractsIdResetArgs = {orgId: string, id: string, body: ContractResetDto}; export type CreateApiV1OrganizationsOrgIdContractsIdResetOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset (delete) a misconfigured contract incl. its absences and balances. Blocked when approved/compensated history exists. Requires a reason; fully audit-logged. * * POST /v1/organizations/{orgId}/contracts/{id}/reset * * Also accepts auth: apiKeyAuth */ export const createApiV1OrganizationsOrgIdContractsIdReset = async (args: CreateApiV1OrganizationsOrgIdContractsIdResetArgs, options?: CreateApiV1OrganizationsOrgIdContractsIdResetOptions) => { const {baseUrl = "https://api.timesheet.io", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/organizations/${encodeURIComponent(String(args.orgId))}/contracts/${encodeURIComponent(String(args.id))}/reset${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };