export type EnterpriseExportRunInterval = 'SIX_HOURS' | 'TWELVE_HOURS' | 'DAILY' | 'WEEKLY'; export type PublicScoreExecutionConfig = {runInterval: EnterpriseExportRunInterval, enabled: boolean, collectionIds: Array, targetIds: Array, perspectiveIds: Array, includeComponents: boolean}; export type CreateApiPublicV1EnterpriseExportScoresConfigArgs = {body: PublicScoreExecutionConfig}; export type CreateApiPublicV1EnterpriseExportScoresConfigOptions = {baseUrl?: string | undefined, TokenAuthentication?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create or Update Export Configuration * * POST /public/v1/enterprise-export/scores/config */ export const createApiPublicV1EnterpriseExportScoresConfig = async (args: CreateApiPublicV1EnterpriseExportScoresConfigArgs, options?: CreateApiPublicV1EnterpriseExportScoresConfigOptions) => { const {baseUrl = "https://api.prewave.com", fetch: fetchFn = fetch, TokenAuthentication} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (TokenAuthentication !== undefined) headers.set("X-Auth-Token", TokenAuthentication) const url = `${baseUrl.replace(/\/+$/, '')}/public/v1/enterprise-export/scores/config${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 };