normalizeQuery (apisports/client.ts)

corsair · packages/apisports/client.ts · typescript · Apache-2.0
integration

Makes requests to API-Sports endpoints with error handling.

// Source: https://github.com/corsairdev/corsair | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
import type { ApiRequestOptions, OpenAPIConfig } from 'corsair/http';
import { ApiError, request } from 'corsair/http';

export class ApiSportsAPIError extends Error {
	public readonly status?: number;
	public readonly statusText?: string;
	// API error bodies vary by sport endpoint; unknown forces callers to narrow before use.
	public readonly body?: unknown;
	public readonly retryAfter?: number;

	constructor(
		message: string,
		public readonly code?: number,
		options?: { cause?: Error; body?: unknown },
	) {
		super(message, options);
		this.name = 'ApiSportsAPIError';

		if (opt

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key