@seatmap-fyi/api-client 0.0.0-stage → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ export interface ConfigurationParameters {
2
+ readonly basePath: string;
3
+ readonly fetchApi?: typeof globalThis.fetch;
4
+ readonly credentials?: RequestCredentials;
5
+ readonly contract?: string;
6
+ readonly compressRequests?: boolean;
7
+ readonly mapError?: (cause: unknown) => Promise<Error>;
8
+ }
9
+ export declare class Configuration {
10
+ readonly basePath: string;
11
+ readonly fetchApi: typeof globalThis.fetch;
12
+ readonly credentials: RequestCredentials | undefined;
13
+ readonly contract: string | undefined;
14
+ readonly compressRequests: boolean;
15
+ readonly mapError: ConfigurationParameters["mapError"];
16
+ csrfToken: string | undefined;
17
+ constructor(parameters: ConfigurationParameters);
18
+ }
@@ -0,0 +1,17 @@
1
+ export class Configuration {
2
+ basePath;
3
+ fetchApi;
4
+ credentials;
5
+ contract;
6
+ compressRequests;
7
+ mapError;
8
+ csrfToken;
9
+ constructor(parameters) {
10
+ this.basePath = parameters.basePath;
11
+ this.fetchApi = parameters.fetchApi ?? globalThis.fetch;
12
+ this.credentials = parameters.credentials;
13
+ this.contract = parameters.contract;
14
+ this.compressRequests = parameters.compressRequests ?? false;
15
+ this.mapError = parameters.mapError;
16
+ }
17
+ }
@@ -0,0 +1,5 @@
1
+ export declare class ApiError extends Error {
2
+ readonly status: number;
3
+ readonly response: Response;
4
+ constructor(response: Response);
5
+ }
@@ -0,0 +1,10 @@
1
+ export class ApiError extends Error {
2
+ status;
3
+ response;
4
+ constructor(response) {
5
+ super(`API request failed with HTTP ${response.status}.`);
6
+ this.name = "ApiError";
7
+ this.status = response.status;
8
+ this.response = response;
9
+ }
10
+ }