export type GeoPoint = {lat: string, lon: string}; export type Location = {geopoint?: GeoPoint | undefined, radius?: number | undefined, unit?: ('m' | 'mi' | 'km' | 'ft') | undefined, saved_location_id?: string | undefined}; export type Industry = 'accommodation' | 'cpg' | 'tourism' | 'marketing' | 'parking' | 'restaurants' | 'retail' | 'transportation' | 'other'; export type Interval = 'day' | 'week'; export type Weekday = 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | 'sunday'; export type CurrencyCode = 'USD' | 'EUR' | 'GBP' | 'AUD' | 'CAD'; export type DemandType = {industry?: Industry | undefined, interval?: Interval | undefined, week_start_day?: Weekday | undefined, unit_descriptor?: string | undefined, currency_code?: CurrencyCode | undefined, unit_currency_multiplier?: number | undefined}; export type RankType = 'phq' | 'local'; export type RankLevel = {min: number, max?: number | undefined}; export type RankLevels = {phq?: RankLevel | undefined, local?: RankLevel | undefined}; export type Rank = {type: RankType, levels?: RankLevels | undefined}; export type PutAnalysisRequest = {name: string, location: Location, demand_type?: DemandType | undefined, external_id?: string | undefined, label?: Array | undefined, rank?: Rank | undefined}; export type UpdateApiV1BeamAnalysesAnalysisIdArgs = {analysis_id: string, body: PutAnalysisRequest}; export type UpdateApiV1BeamAnalysesAnalysisIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update an Analysis * * PUT /v1/beam/analyses/{analysis_id} */ export const updateApiV1BeamAnalysesAnalysisId = async (args: UpdateApiV1BeamAnalysesAnalysisIdArgs, options?: UpdateApiV1BeamAnalysesAnalysisIdOptions) => { const {baseUrl = "https://api.predicthq.com", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/beam/analyses/${encodeURIComponent(String(args.analysis_id))}${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 };