export type GetApiV1CompanyWebhooksIdArgs = {id: number, 'X-Time-Zone'?: string | undefined, 'X-Metric-Units'?: boolean | undefined, 'X-User-Id'?: number | undefined}; export type GetApiV1CompanyWebhooksIdOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch a webhook using its ID * * GET /v1/company_webhooks/{id} */ export const getApiV1CompanyWebhooksId = async (args: GetApiV1CompanyWebhooksIdArgs, options?: GetApiV1CompanyWebhooksIdOptions) => { const {baseUrl = "https://api.gomotive.com", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args['X-Time-Zone'] != null) headers.set("X-Time-Zone", String(args['X-Time-Zone'])) if (args['X-Metric-Units'] != null) headers.set("X-Metric-Units", String(args['X-Metric-Units'])) if (args['X-User-Id'] != null) headers.set("X-User-Id", String(args['X-User-Id'])) if (sec0 !== undefined) headers.set("x-api-key", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/v1/company_webhooks/${encodeURIComponent(String(args.id))}${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 (await res.json()) as unknown };