export type ObjectStatus = 'Active' | 'Inactive'; export type RetroPayrunJob = {id?: number | undefined, status?: ObjectStatus | undefined, created?: string | undefined, updated?: string | undefined, scheduleDate: string, resultTags?: (Array | null) | undefined}; export type RetroPayMode = 'ValueChange' | 'None'; export type PayrunJobResult = 'Full' | 'Incremental'; export type PayrunJobStatus = 'Draft' | 'Release' | 'Process' | 'Complete' | 'Forecast' | 'Abort' | 'Cancel'; export type LogLevel = 'Verbose' | 'Debug' | 'Information' | 'Warning' | 'Error' | 'Fatal'; export type PayrunJobInvocation = {id?: number | undefined, status?: ObjectStatus | undefined, created?: string | undefined, updated?: string | undefined, payrunName: string, userIdentifier: string, payrunJobId?: number | undefined, parentJobId?: (number | null) | undefined, name: string, owner?: (string | null) | undefined, retroJobs?: (Array | null) | undefined, tags?: (Array | null) | undefined, forecast?: (string | null) | undefined, retroPayMode?: RetroPayMode | undefined, jobResult?: PayrunJobResult | undefined, jobStatus?: PayrunJobStatus | undefined, completedJobStatus?: PayrunJobStatus | undefined, periodStart: string, evaluationDate?: (string | null) | undefined, payDate?: (string | null) | undefined, reason: string, storeEmptyResults?: boolean | undefined, logLevel?: LogLevel | undefined, employeeIdentifiers?: (Array | null) | undefined, attributes?: ({[key: string]: unknown} | null) | undefined}; export type CreateApiApiTenantsTenantIdPayrunsJobsArgs = {tenantId: number, body: PayrunJobInvocation}; export type CreateApiApiTenantsTenantIdPayrunsJobsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /api/tenants/{tenantId}/payruns/jobs */ export const createApiApiTenantsTenantIdPayrunsJobs = async (args: CreateApiApiTenantsTenantIdPayrunsJobsArgs, options: CreateApiApiTenantsTenantIdPayrunsJobsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/tenants/${encodeURIComponent(String(args.tenantId))}/payruns/jobs${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 };