export type FlowDataRetentionPolicy = {delete_trashed?: number | undefined, trash_completed?: number | undefined, trash_failed?: number | undefined, trash_timed_out?: number | undefined}; export type UpdateApiExperimentalFlowFolderDataRetentionPolicyArgs = {body: FlowDataRetentionPolicy}; export type UpdateApiExperimentalFlowFolderDataRetentionPolicyOptions = {baseUrl?: string | undefined, OAuth10?: string | undefined, fetch?: typeof fetch | undefined}; /** * Set the data retention policy * * PUT /experimental/flow/folder/data_retention_policy * * Also accepts auth: OAuth2.0, SessionCookie + XToken */ export const updateApiExperimentalFlowFolderDataRetentionPolicy = async (args: UpdateApiExperimentalFlowFolderDataRetentionPolicyArgs, options?: UpdateApiExperimentalFlowFolderDataRetentionPolicyOptions) => { 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/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 };