export type EnvianceRestServicesCommonTimeZoneInfo = {id?: number | undefined, name?: string | undefined, stdOffset?: number | undefined, dstOffset?: number | undefined, currentOffset?: number | undefined}; export type EnvianceRestServicesCommonAssigneeV2 = {userIdOrName?: string | undefined, groupIdOrName?: string | undefined}; export type EnvianceRestServicesVer2TasksSchedulesRecurrenceIntervalInfoExt = Record; export type EnvianceRestServicesVer2TasksSchedulesDayOfMonthInfoExt = Record; export type EnvianceRestServicesVer2TasksSchedulesTaskScheduleInfo = {recurrenceType?: ('Hourly' | 'Daily' | 'Weekly' | 'Monthly' | 'Yearly' | 'AfterLastCompletion') | undefined, startDate?: string | undefined, endDate?: string | undefined, startTime?: string | undefined, endTime?: string | undefined, recurrenceInterval?: EnvianceRestServicesVer2TasksSchedulesRecurrenceIntervalInfoExt | undefined, dayOfMonth?: EnvianceRestServicesVer2TasksSchedulesDayOfMonthInfoExt | undefined, monthOfYear?: number | undefined, TalLogicVersion?: number | undefined}; export type EnvianceRestServicesVer2TasksNotificationsDueDateCondition = {conditionType?: ('IntervalBefore' | 'IntervalAfter' | 'PastDue') | undefined, intervalType?: ('QuarterHour' | 'Hour' | 'Day' | 'Week' | 'Month' | 'Year') | undefined, intervalValue?: number | undefined}; export type EnvianceRestServicesVer2TasksNotificationsCompletionStatusCondition = {completionPercent?: number | undefined, comparisonLogic?: string | undefined, onlyWhenPastDue?: boolean | undefined}; export type EnvianceRestServicesVer2TasksNotificationsNotificationConditions = {immediately?: boolean | undefined, whenDismissed?: boolean | undefined, byDueDate?: EnvianceRestServicesVer2TasksNotificationsDueDateCondition | undefined, byCompletionStatus?: EnvianceRestServicesVer2TasksNotificationsCompletionStatusCondition | undefined}; export type EnvianceRestServicesVer2TasksNotificationsNotificationRecipients = {toAssignees?: boolean | undefined, toAssignor?: boolean | undefined, users?: Array | undefined, groups?: Array | undefined}; export type EnvianceRestServicesVer2TasksNotificationsTaskNotificationInfo = {conditions?: EnvianceRestServicesVer2TasksNotificationsNotificationConditions | undefined, templateIdOrName?: string | undefined, recipients?: EnvianceRestServicesVer2TasksNotificationsNotificationRecipients | undefined, deliveryMethod?: ('Inbox' | 'Email' | 'InboxAndEmail') | undefined, comments?: string | undefined}; export type EnvianceRestServicesVer2TasksTriggeringDueDateInfo = {value: number, hours: string, period: string}; export type EnvianceRestServicesVer2TasksTriggeringTimeToCreateValue = {past?: boolean | undefined, operation?: string | undefined, value?: number | undefined, hours?: string | undefined, period?: string | undefined, percent?: number | undefined, compare?: string | undefined}; export type EnvianceRestServicesVer2TasksTriggeringTimeToCreateInfo = {category: string, value?: EnvianceRestServicesVer2TasksTriggeringTimeToCreateValue | undefined}; export type EnvianceRestServicesVer2TasksTriggeringWorkflowTriggerInfo = {workflowtypeidorname: string, workflowname?: string | undefined, isusetaskname?: boolean | undefined, calendars?: Array | undefined, duedateflags: Array, duedateamount?: EnvianceRestServicesVer2TasksTriggeringDueDateInfo | undefined, timetocreateoptions: Array, assignee?: Array | undefined}; export type EnvianceRestServicesVer2TasksTriggeringTaskWorkflowInfo = {isautoclosetask?: boolean | undefined, workflows?: Array | undefined}; export type EnvianceRestServicesVer2TasksTaskInfo = {id?: unknown | undefined, name?: string | undefined, description?: string | undefined, createdBy?: string | undefined, createdOn?: string | undefined, dueDate?: string | undefined, timeZone?: EnvianceRestServicesCommonTimeZoneInfo | undefined, templateIdOrName?: string | undefined, assignor?: string | undefined, assignees?: Array | undefined, calendars?: Array | undefined, objects?: Array | undefined, documents?: Array | undefined, schedules?: Array | undefined, notifications?: Array | undefined, workflowtrigger?: EnvianceRestServicesVer2TasksTriggeringTaskWorkflowInfo | undefined, suppressNotificationsBefore?: string | undefined}; export type UpdateTask = {taskInfo?: EnvianceRestServicesVer2TasksTaskInfo | undefined}; export type PatchApiVer2TaskServiceSvcTasksTaskIdArgs = {'EnvApi-Systemid'?: string | undefined, 'EnvApi-Packageid'?: string | undefined, 'EnvApi-Udf-DateTime-Iso-In-CustomFields'?: string | undefined, 'EnvApi-Udf-DateTime-ReadInUserTz'?: string | undefined, 'EnvApi-Udf-Value-Invariant'?: string | undefined, 'EnvApi-Localization-All'?: string | undefined, 'x-client-request-id'?: string | undefined, taskId: string, body: UpdateTask}; export type PatchApiVer2TaskServiceSvcTasksTaskIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * PATCH /ver2/TaskService.svc/tasks/{taskId} */ export const patchApiVer2TaskServiceSvcTasksTaskId = async (args: PatchApiVer2TaskServiceSvcTasksTaskIdArgs, options: PatchApiVer2TaskServiceSvcTasksTaskIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['EnvApi-Systemid'] != null) headers.set("EnvApi-Systemid", String(args['EnvApi-Systemid'])) if (args['EnvApi-Packageid'] != null) headers.set("EnvApi-Packageid", String(args['EnvApi-Packageid'])) if (args['EnvApi-Udf-DateTime-Iso-In-CustomFields'] != null) headers.set("EnvApi-Udf-DateTime-Iso-In-CustomFields", String(args['EnvApi-Udf-DateTime-Iso-In-CustomFields'])) if (args['EnvApi-Udf-DateTime-ReadInUserTz'] != null) headers.set("EnvApi-Udf-DateTime-ReadInUserTz", String(args['EnvApi-Udf-DateTime-ReadInUserTz'])) if (args['EnvApi-Udf-Value-Invariant'] != null) headers.set("EnvApi-Udf-Value-Invariant", String(args['EnvApi-Udf-Value-Invariant'])) if (args['EnvApi-Localization-All'] != null) headers.set("EnvApi-Localization-All", String(args['EnvApi-Localization-All'])) if (args['x-client-request-id'] != null) headers.set("x-client-request-id", String(args['x-client-request-id'])) const url = `${baseUrl.replace(/\/+$/, '')}/ver2/TaskService.svc/tasks/${encodeURIComponent(String(args.taskId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };