export type GetApiV2OpeningHoursGroupsGroupIdOpenPeriodsArgs = {groupId: number, periodStart: string, periodEnd: string}; export type GetApiV2OpeningHoursGroupsGroupIdOpenPeriodsOptions = {baseUrl?: string | undefined, OAuth2ClientCredentials?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get open periods * * GET /v2/opening-hours/groups/{groupId}/open-periods */ export const getApiV2OpeningHoursGroupsGroupIdOpenPeriods = async (args: GetApiV2OpeningHoursGroupsGroupIdOpenPeriodsArgs, options?: GetApiV2OpeningHoursGroupsGroupIdOpenPeriodsOptions) => { const {baseUrl = "https://api.quinyx.com", fetch: fetchFn = fetch, OAuth2ClientCredentials} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.periodStart != null) query.append("periodStart", String(args.periodStart)) if (args.periodEnd != null) query.append("periodEnd", String(args.periodEnd)) if (OAuth2ClientCredentials !== undefined) headers.set('authorization', `Bearer ${OAuth2ClientCredentials}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/opening-hours/groups/${encodeURIComponent(String(args.groupId))}/open-periods${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };