@mtnmanager/sdk 0.0.1
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.
- package/README.md +134 -0
- package/dist/apis/PublicApi.d.ts +174 -0
- package/dist/apis/PublicApi.js +218 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +19 -0
- package/dist/esm/apis/PublicApi.d.ts +174 -0
- package/dist/esm/apis/PublicApi.js +214 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.js +3 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/models/HoursInfo.d.ts +50 -0
- package/dist/esm/models/HoursInfo.js +51 -0
- package/dist/esm/models/LiftStatus.d.ts +25 -0
- package/dist/esm/models/LiftStatus.js +43 -0
- package/dist/esm/models/LiftType.d.ts +36 -0
- package/dist/esm/models/LiftType.js +54 -0
- package/dist/esm/models/OperatingHoursResponse.d.ts +46 -0
- package/dist/esm/models/OperatingHoursResponse.js +53 -0
- package/dist/esm/models/PublicLift.d.ts +88 -0
- package/dist/esm/models/PublicLift.js +73 -0
- package/dist/esm/models/PublicResortInfo.d.ts +57 -0
- package/dist/esm/models/PublicResortInfo.js +60 -0
- package/dist/esm/models/PublicResortResponse.d.ts +68 -0
- package/dist/esm/models/PublicResortResponse.js +59 -0
- package/dist/esm/models/PublicResortStatus.d.ts +45 -0
- package/dist/esm/models/PublicResortStatus.js +48 -0
- package/dist/esm/models/PublicRun.d.ts +88 -0
- package/dist/esm/models/PublicRun.js +73 -0
- package/dist/esm/models/PublicSnowReport.d.ts +82 -0
- package/dist/esm/models/PublicSnowReport.js +67 -0
- package/dist/esm/models/PublicSnowResponse.d.ts +33 -0
- package/dist/esm/models/PublicSnowResponse.js +44 -0
- package/dist/esm/models/RegularHoursDescription.d.ts +50 -0
- package/dist/esm/models/RegularHoursDescription.js +55 -0
- package/dist/esm/models/ResortStatusType.d.ts +26 -0
- package/dist/esm/models/ResortStatusType.js +44 -0
- package/dist/esm/models/RunDifficulty.d.ts +28 -0
- package/dist/esm/models/RunDifficulty.js +46 -0
- package/dist/esm/models/RunStatus.d.ts +25 -0
- package/dist/esm/models/RunStatus.js +43 -0
- package/dist/esm/models/SnowMetrics.d.ts +56 -0
- package/dist/esm/models/SnowMetrics.js +59 -0
- package/dist/esm/models/SurfaceCondition.d.ts +29 -0
- package/dist/esm/models/SurfaceCondition.js +47 -0
- package/dist/esm/models/UnitPreference.d.ts +25 -0
- package/dist/esm/models/UnitPreference.js +43 -0
- package/dist/esm/models/index.d.ts +18 -0
- package/dist/esm/models/index.js +20 -0
- package/dist/esm/runtime.d.ts +184 -0
- package/dist/esm/runtime.js +334 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/models/HoursInfo.d.ts +50 -0
- package/dist/models/HoursInfo.js +58 -0
- package/dist/models/LiftStatus.d.ts +25 -0
- package/dist/models/LiftStatus.js +51 -0
- package/dist/models/LiftType.d.ts +36 -0
- package/dist/models/LiftType.js +62 -0
- package/dist/models/OperatingHoursResponse.d.ts +46 -0
- package/dist/models/OperatingHoursResponse.js +60 -0
- package/dist/models/PublicLift.d.ts +88 -0
- package/dist/models/PublicLift.js +80 -0
- package/dist/models/PublicResortInfo.d.ts +57 -0
- package/dist/models/PublicResortInfo.js +67 -0
- package/dist/models/PublicResortResponse.d.ts +68 -0
- package/dist/models/PublicResortResponse.js +66 -0
- package/dist/models/PublicResortStatus.d.ts +45 -0
- package/dist/models/PublicResortStatus.js +55 -0
- package/dist/models/PublicRun.d.ts +88 -0
- package/dist/models/PublicRun.js +80 -0
- package/dist/models/PublicSnowReport.d.ts +82 -0
- package/dist/models/PublicSnowReport.js +74 -0
- package/dist/models/PublicSnowResponse.d.ts +33 -0
- package/dist/models/PublicSnowResponse.js +51 -0
- package/dist/models/RegularHoursDescription.d.ts +50 -0
- package/dist/models/RegularHoursDescription.js +62 -0
- package/dist/models/ResortStatusType.d.ts +26 -0
- package/dist/models/ResortStatusType.js +52 -0
- package/dist/models/RunDifficulty.d.ts +28 -0
- package/dist/models/RunDifficulty.js +54 -0
- package/dist/models/RunStatus.d.ts +25 -0
- package/dist/models/RunStatus.js +51 -0
- package/dist/models/SnowMetrics.d.ts +56 -0
- package/dist/models/SnowMetrics.js +66 -0
- package/dist/models/SurfaceCondition.d.ts +29 -0
- package/dist/models/SurfaceCondition.js +55 -0
- package/dist/models/UnitPreference.d.ts +25 -0
- package/dist/models/UnitPreference.js +51 -0
- package/dist/models/index.d.ts +18 -0
- package/dist/models/index.js +36 -0
- package/dist/runtime.d.ts +184 -0
- package/dist/runtime.js +350 -0
- package/package.json +25 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* MtnManager API
|
|
5
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Check if a given object implements the SnowMetrics interface.
|
|
16
|
+
*/
|
|
17
|
+
export function instanceOfSnowMetrics(value) {
|
|
18
|
+
if (!('last24h' in value) || value['last24h'] === undefined)
|
|
19
|
+
return false;
|
|
20
|
+
if (!('last48h' in value) || value['last48h'] === undefined)
|
|
21
|
+
return false;
|
|
22
|
+
if (!('last7days' in value) || value['last7days'] === undefined)
|
|
23
|
+
return false;
|
|
24
|
+
if (!('overnight' in value) || value['overnight'] === undefined)
|
|
25
|
+
return false;
|
|
26
|
+
if (!('seasonTotal' in value) || value['seasonTotal'] === undefined)
|
|
27
|
+
return false;
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
export function SnowMetricsFromJSON(json) {
|
|
31
|
+
return SnowMetricsFromJSONTyped(json, false);
|
|
32
|
+
}
|
|
33
|
+
export function SnowMetricsFromJSONTyped(json, ignoreDiscriminator) {
|
|
34
|
+
if (json == null) {
|
|
35
|
+
return json;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'last24h': json['last_24h'],
|
|
39
|
+
'last48h': json['last_48h'],
|
|
40
|
+
'last7days': json['last_7days'],
|
|
41
|
+
'overnight': json['overnight'],
|
|
42
|
+
'seasonTotal': json['season_total'],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function SnowMetricsToJSON(json) {
|
|
46
|
+
return SnowMetricsToJSONTyped(json, false);
|
|
47
|
+
}
|
|
48
|
+
export function SnowMetricsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
49
|
+
if (value == null) {
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
'last_24h': value['last24h'],
|
|
54
|
+
'last_48h': value['last48h'],
|
|
55
|
+
'last_7days': value['last7days'],
|
|
56
|
+
'overnight': value['overnight'],
|
|
57
|
+
'season_total': value['seasonTotal'],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MtnManager API
|
|
3
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Surface condition types for snow reports
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
export declare const SurfaceCondition: {
|
|
17
|
+
readonly Powder: "powder";
|
|
18
|
+
readonly PackedPowder: "packed_powder";
|
|
19
|
+
readonly Groomed: "groomed";
|
|
20
|
+
readonly Variable: "variable";
|
|
21
|
+
readonly Icy: "icy";
|
|
22
|
+
readonly SpringConditions: "spring_conditions";
|
|
23
|
+
};
|
|
24
|
+
export type SurfaceCondition = typeof SurfaceCondition[keyof typeof SurfaceCondition];
|
|
25
|
+
export declare function instanceOfSurfaceCondition(value: any): boolean;
|
|
26
|
+
export declare function SurfaceConditionFromJSON(json: any): SurfaceCondition;
|
|
27
|
+
export declare function SurfaceConditionFromJSONTyped(json: any, ignoreDiscriminator: boolean): SurfaceCondition;
|
|
28
|
+
export declare function SurfaceConditionToJSON(value?: SurfaceCondition | null): any;
|
|
29
|
+
export declare function SurfaceConditionToJSONTyped(value: any, ignoreDiscriminator: boolean): SurfaceCondition;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* MtnManager API
|
|
5
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Surface condition types for snow reports
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export const SurfaceCondition = {
|
|
19
|
+
Powder: 'powder',
|
|
20
|
+
PackedPowder: 'packed_powder',
|
|
21
|
+
Groomed: 'groomed',
|
|
22
|
+
Variable: 'variable',
|
|
23
|
+
Icy: 'icy',
|
|
24
|
+
SpringConditions: 'spring_conditions'
|
|
25
|
+
};
|
|
26
|
+
export function instanceOfSurfaceCondition(value) {
|
|
27
|
+
for (const key in SurfaceCondition) {
|
|
28
|
+
if (Object.prototype.hasOwnProperty.call(SurfaceCondition, key)) {
|
|
29
|
+
if (SurfaceCondition[key] === value) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
export function SurfaceConditionFromJSON(json) {
|
|
37
|
+
return SurfaceConditionFromJSONTyped(json, false);
|
|
38
|
+
}
|
|
39
|
+
export function SurfaceConditionFromJSONTyped(json, ignoreDiscriminator) {
|
|
40
|
+
return json;
|
|
41
|
+
}
|
|
42
|
+
export function SurfaceConditionToJSON(value) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
export function SurfaceConditionToJSONTyped(value, ignoreDiscriminator) {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MtnManager API
|
|
3
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Unit preference for measurements
|
|
14
|
+
* @export
|
|
15
|
+
*/
|
|
16
|
+
export declare const UnitPreference: {
|
|
17
|
+
readonly Metric: "metric";
|
|
18
|
+
readonly Imperial: "imperial";
|
|
19
|
+
};
|
|
20
|
+
export type UnitPreference = typeof UnitPreference[keyof typeof UnitPreference];
|
|
21
|
+
export declare function instanceOfUnitPreference(value: any): boolean;
|
|
22
|
+
export declare function UnitPreferenceFromJSON(json: any): UnitPreference;
|
|
23
|
+
export declare function UnitPreferenceFromJSONTyped(json: any, ignoreDiscriminator: boolean): UnitPreference;
|
|
24
|
+
export declare function UnitPreferenceToJSON(value?: UnitPreference | null): any;
|
|
25
|
+
export declare function UnitPreferenceToJSONTyped(value: any, ignoreDiscriminator: boolean): UnitPreference;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* MtnManager API
|
|
5
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Unit preference for measurements
|
|
16
|
+
* @export
|
|
17
|
+
*/
|
|
18
|
+
export const UnitPreference = {
|
|
19
|
+
Metric: 'metric',
|
|
20
|
+
Imperial: 'imperial'
|
|
21
|
+
};
|
|
22
|
+
export function instanceOfUnitPreference(value) {
|
|
23
|
+
for (const key in UnitPreference) {
|
|
24
|
+
if (Object.prototype.hasOwnProperty.call(UnitPreference, key)) {
|
|
25
|
+
if (UnitPreference[key] === value) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
export function UnitPreferenceFromJSON(json) {
|
|
33
|
+
return UnitPreferenceFromJSONTyped(json, false);
|
|
34
|
+
}
|
|
35
|
+
export function UnitPreferenceFromJSONTyped(json, ignoreDiscriminator) {
|
|
36
|
+
return json;
|
|
37
|
+
}
|
|
38
|
+
export function UnitPreferenceToJSON(value) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
export function UnitPreferenceToJSONTyped(value, ignoreDiscriminator) {
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './HoursInfo';
|
|
2
|
+
export * from './LiftStatus';
|
|
3
|
+
export * from './LiftType';
|
|
4
|
+
export * from './OperatingHoursResponse';
|
|
5
|
+
export * from './PublicLift';
|
|
6
|
+
export * from './PublicResortInfo';
|
|
7
|
+
export * from './PublicResortResponse';
|
|
8
|
+
export * from './PublicResortStatus';
|
|
9
|
+
export * from './PublicRun';
|
|
10
|
+
export * from './PublicSnowReport';
|
|
11
|
+
export * from './PublicSnowResponse';
|
|
12
|
+
export * from './RegularHoursDescription';
|
|
13
|
+
export * from './ResortStatusType';
|
|
14
|
+
export * from './RunDifficulty';
|
|
15
|
+
export * from './RunStatus';
|
|
16
|
+
export * from './SnowMetrics';
|
|
17
|
+
export * from './SurfaceCondition';
|
|
18
|
+
export * from './UnitPreference';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export * from './HoursInfo';
|
|
4
|
+
export * from './LiftStatus';
|
|
5
|
+
export * from './LiftType';
|
|
6
|
+
export * from './OperatingHoursResponse';
|
|
7
|
+
export * from './PublicLift';
|
|
8
|
+
export * from './PublicResortInfo';
|
|
9
|
+
export * from './PublicResortResponse';
|
|
10
|
+
export * from './PublicResortStatus';
|
|
11
|
+
export * from './PublicRun';
|
|
12
|
+
export * from './PublicSnowReport';
|
|
13
|
+
export * from './PublicSnowResponse';
|
|
14
|
+
export * from './RegularHoursDescription';
|
|
15
|
+
export * from './ResortStatusType';
|
|
16
|
+
export * from './RunDifficulty';
|
|
17
|
+
export * from './RunStatus';
|
|
18
|
+
export * from './SnowMetrics';
|
|
19
|
+
export * from './SurfaceCondition';
|
|
20
|
+
export * from './UnitPreference';
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MtnManager API
|
|
3
|
+
* Public API for retrieving ski resort snow reports, run status, lift status, and operating hours. No authentication required.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.1.0
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
export declare const BASE_PATH: string;
|
|
13
|
+
export interface ConfigurationParameters {
|
|
14
|
+
basePath?: string;
|
|
15
|
+
fetchApi?: FetchAPI;
|
|
16
|
+
middleware?: Middleware[];
|
|
17
|
+
queryParamsStringify?: (params: HTTPQuery) => string;
|
|
18
|
+
username?: string;
|
|
19
|
+
password?: string;
|
|
20
|
+
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>);
|
|
21
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
|
|
22
|
+
headers?: HTTPHeaders;
|
|
23
|
+
credentials?: RequestCredentials;
|
|
24
|
+
}
|
|
25
|
+
export declare class Configuration {
|
|
26
|
+
private configuration;
|
|
27
|
+
constructor(configuration?: ConfigurationParameters);
|
|
28
|
+
set config(configuration: Configuration);
|
|
29
|
+
get basePath(): string;
|
|
30
|
+
get fetchApi(): FetchAPI | undefined;
|
|
31
|
+
get middleware(): Middleware[];
|
|
32
|
+
get queryParamsStringify(): (params: HTTPQuery) => string;
|
|
33
|
+
get username(): string | undefined;
|
|
34
|
+
get password(): string | undefined;
|
|
35
|
+
get apiKey(): ((name: string) => string | Promise<string>) | undefined;
|
|
36
|
+
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
|
|
37
|
+
get headers(): HTTPHeaders | undefined;
|
|
38
|
+
get credentials(): RequestCredentials | undefined;
|
|
39
|
+
}
|
|
40
|
+
export declare const DefaultConfig: Configuration;
|
|
41
|
+
/**
|
|
42
|
+
* This is the base class for all generated API classes.
|
|
43
|
+
*/
|
|
44
|
+
export declare class BaseAPI {
|
|
45
|
+
protected configuration: Configuration;
|
|
46
|
+
private static readonly jsonRegex;
|
|
47
|
+
private middleware;
|
|
48
|
+
constructor(configuration?: Configuration);
|
|
49
|
+
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
|
|
50
|
+
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
|
|
51
|
+
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
|
|
52
|
+
/**
|
|
53
|
+
* Check if the given MIME is a JSON MIME.
|
|
54
|
+
* JSON MIME examples:
|
|
55
|
+
* application/json
|
|
56
|
+
* application/json; charset=UTF8
|
|
57
|
+
* APPLICATION/JSON
|
|
58
|
+
* application/vnd.company+json
|
|
59
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
60
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
protected isJsonMime(mime: string | null | undefined): boolean;
|
|
63
|
+
protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
|
|
64
|
+
private createFetchParams;
|
|
65
|
+
private fetchApi;
|
|
66
|
+
/**
|
|
67
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
68
|
+
* and then shallow cloning data members.
|
|
69
|
+
*/
|
|
70
|
+
private clone;
|
|
71
|
+
}
|
|
72
|
+
export declare class ResponseError extends Error {
|
|
73
|
+
response: Response;
|
|
74
|
+
name: "ResponseError";
|
|
75
|
+
constructor(response: Response, msg?: string);
|
|
76
|
+
}
|
|
77
|
+
export declare class FetchError extends Error {
|
|
78
|
+
cause: Error;
|
|
79
|
+
name: "FetchError";
|
|
80
|
+
constructor(cause: Error, msg?: string);
|
|
81
|
+
}
|
|
82
|
+
export declare class RequiredError extends Error {
|
|
83
|
+
field: string;
|
|
84
|
+
name: "RequiredError";
|
|
85
|
+
constructor(field: string, msg?: string);
|
|
86
|
+
}
|
|
87
|
+
export declare const COLLECTION_FORMATS: {
|
|
88
|
+
csv: string;
|
|
89
|
+
ssv: string;
|
|
90
|
+
tsv: string;
|
|
91
|
+
pipes: string;
|
|
92
|
+
};
|
|
93
|
+
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
|
|
94
|
+
export type Json = any;
|
|
95
|
+
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
96
|
+
export type HTTPHeaders = {
|
|
97
|
+
[key: string]: string;
|
|
98
|
+
};
|
|
99
|
+
export type HTTPQuery = {
|
|
100
|
+
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
|
|
101
|
+
};
|
|
102
|
+
export type HTTPBody = Json | FormData | URLSearchParams;
|
|
103
|
+
export type HTTPRequestInit = {
|
|
104
|
+
headers?: HTTPHeaders;
|
|
105
|
+
method: HTTPMethod;
|
|
106
|
+
credentials?: RequestCredentials;
|
|
107
|
+
body?: HTTPBody;
|
|
108
|
+
};
|
|
109
|
+
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
|
|
110
|
+
export type InitOverrideFunction = (requestContext: {
|
|
111
|
+
init: HTTPRequestInit;
|
|
112
|
+
context: RequestOpts;
|
|
113
|
+
}) => Promise<RequestInit>;
|
|
114
|
+
export interface FetchParams {
|
|
115
|
+
url: string;
|
|
116
|
+
init: RequestInit;
|
|
117
|
+
}
|
|
118
|
+
export interface RequestOpts {
|
|
119
|
+
path: string;
|
|
120
|
+
method: HTTPMethod;
|
|
121
|
+
headers: HTTPHeaders;
|
|
122
|
+
query?: HTTPQuery;
|
|
123
|
+
body?: HTTPBody;
|
|
124
|
+
}
|
|
125
|
+
export declare function querystring(params: HTTPQuery, prefix?: string): string;
|
|
126
|
+
export declare function exists(json: any, key: string): boolean;
|
|
127
|
+
export declare function mapValues(data: any, fn: (item: any) => any): {
|
|
128
|
+
[key: string]: any;
|
|
129
|
+
};
|
|
130
|
+
export declare function canConsumeForm(consumes: Consume[]): boolean;
|
|
131
|
+
export interface Consume {
|
|
132
|
+
contentType: string;
|
|
133
|
+
}
|
|
134
|
+
export interface RequestContext {
|
|
135
|
+
fetch: FetchAPI;
|
|
136
|
+
url: string;
|
|
137
|
+
init: RequestInit;
|
|
138
|
+
}
|
|
139
|
+
export interface ResponseContext {
|
|
140
|
+
fetch: FetchAPI;
|
|
141
|
+
url: string;
|
|
142
|
+
init: RequestInit;
|
|
143
|
+
response: Response;
|
|
144
|
+
}
|
|
145
|
+
export interface ErrorContext {
|
|
146
|
+
fetch: FetchAPI;
|
|
147
|
+
url: string;
|
|
148
|
+
init: RequestInit;
|
|
149
|
+
error: unknown;
|
|
150
|
+
response?: Response;
|
|
151
|
+
}
|
|
152
|
+
export interface Middleware {
|
|
153
|
+
pre?(context: RequestContext): Promise<FetchParams | void>;
|
|
154
|
+
post?(context: ResponseContext): Promise<Response | void>;
|
|
155
|
+
onError?(context: ErrorContext): Promise<Response | void>;
|
|
156
|
+
}
|
|
157
|
+
export interface ApiResponse<T> {
|
|
158
|
+
raw: Response;
|
|
159
|
+
value(): Promise<T>;
|
|
160
|
+
}
|
|
161
|
+
export interface ResponseTransformer<T> {
|
|
162
|
+
(json: any): T;
|
|
163
|
+
}
|
|
164
|
+
export declare class JSONApiResponse<T> {
|
|
165
|
+
raw: Response;
|
|
166
|
+
private transformer;
|
|
167
|
+
constructor(raw: Response, transformer?: ResponseTransformer<T>);
|
|
168
|
+
value(): Promise<T>;
|
|
169
|
+
}
|
|
170
|
+
export declare class VoidApiResponse {
|
|
171
|
+
raw: Response;
|
|
172
|
+
constructor(raw: Response);
|
|
173
|
+
value(): Promise<void>;
|
|
174
|
+
}
|
|
175
|
+
export declare class BlobApiResponse {
|
|
176
|
+
raw: Response;
|
|
177
|
+
constructor(raw: Response);
|
|
178
|
+
value(): Promise<Blob>;
|
|
179
|
+
}
|
|
180
|
+
export declare class TextApiResponse {
|
|
181
|
+
raw: Response;
|
|
182
|
+
constructor(raw: Response);
|
|
183
|
+
value(): Promise<string>;
|
|
184
|
+
}
|