export type DeleteApiV2CompanyCompanyIdUsersIdentifierArgs = {'x-api-version'?: string | undefined, 'x-company-guid'?: string | undefined, company_id: number, identifier: number, body: {inactive_reason: string | null, inactive_comments?: (string | null) | undefined, would_rehire?: (boolean | null) | undefined}}; export type DeleteApiV2CompanyCompanyIdUsersIdentifierOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deactivate User * * DELETE /v2/company/{company_id}/users/{identifier} * * Also accepts auth: cookieAuth */ export const deleteApiV2CompanyCompanyIdUsersIdentifier = async (args: DeleteApiV2CompanyCompanyIdUsersIdentifierArgs, options?: DeleteApiV2CompanyCompanyIdUsersIdentifierOptions) => { const {baseUrl = "https://api.7shifts.com", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-version'] != null) headers.set("x-api-version", String(args['x-api-version'])) if (args['x-company-guid'] != null) headers.set("x-company-guid", String(args['x-company-guid'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/company/${encodeURIComponent(String(args.company_id))}/users/${encodeURIComponent(String(args.identifier))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };