export type FlowDataRetentionPolicy = {delete_trashed?: number | undefined, trash_completed?: number | undefined, trash_failed?: number | undefined, trash_timed_out?: number | undefined}; export type UpdateApiExperimentalFlowFolderFolderIdDataRetentionPolicyArgs = {folder_id: string, body: FlowDataRetentionPolicy}; export type UpdateApiExperimentalFlowFolderFolderIdDataRetentionPolicyOptions = {baseUrl?: string | undefined, OAuth10?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set the data retention policy * * PUT /experimental/flow/folder/{folder_id}/data_retention_policy * * Also accepts auth: OAuth2.0, SessionCookie + XToken */ export const updateApiExperimentalFlowFolderFolderIdDataRetentionPolicy = async (args: UpdateApiExperimentalFlowFolderFolderIdDataRetentionPolicyArgs, options?: UpdateApiExperimentalFlowFolderFolderIdDataRetentionPolicyOptions) => { const {baseUrl = "https://scrive.com", fetch: fetchFn = fetch, OAuth10} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json;charset=utf-8") if (OAuth10 !== undefined) headers.set('authorization', `oauth1 ${OAuth10}`) const url = `${baseUrl.replace(/\/+$/, '')}/experimental/flow/folder/${encodeURIComponent(String(args.folder_id))}/data_retention_policy${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };