export type GetApiV1SequencesSequenceIdSettingsArgs = {sequenceId: string, code?: number | undefined}; export type GetApiV1SequencesSequenceIdSettingsOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get sequence settings (optionally filter by code) * * GET /v1/sequences/{sequenceId}/settings */ export const getApiV1SequencesSequenceIdSettings = async (args: GetApiV1SequencesSequenceIdSettingsArgs, options: GetApiV1SequencesSequenceIdSettingsOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.code != null) query.append("code", String(args.code)) if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/sequences/${encodeURIComponent(String(args.sequenceId))}/settings${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 undefined };