@teemill/gtins 0.2.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/.openapi-generator/FILES +16 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/README.md +46 -0
- package/dist/apis/GTINsApi.d.ts +77 -0
- package/dist/apis/GTINsApi.js +213 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +19 -0
- package/dist/esm/apis/GTINsApi.d.ts +77 -0
- package/dist/esm/apis/GTINsApi.js +209 -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/ApiError.d.ts +37 -0
- package/dist/esm/models/ApiError.js +42 -0
- package/dist/esm/models/AssignGtinRequest.d.ts +31 -0
- package/dist/esm/models/AssignGtinRequest.js +40 -0
- package/dist/esm/models/GTIN.d.ts +37 -0
- package/dist/esm/models/GTIN.js +44 -0
- package/dist/esm/models/GTINsResponse.d.ts +38 -0
- package/dist/esm/models/GTINsResponse.js +41 -0
- package/dist/esm/models/ImportGtins202Response.d.ts +31 -0
- package/dist/esm/models/ImportGtins202Response.js +38 -0
- package/dist/esm/models/index.d.ts +5 -0
- package/dist/esm/models/index.js +7 -0
- package/dist/esm/runtime.d.ts +187 -0
- package/dist/esm/runtime.js +333 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +21 -0
- package/dist/models/ApiError.d.ts +37 -0
- package/dist/models/ApiError.js +49 -0
- package/dist/models/AssignGtinRequest.d.ts +31 -0
- package/dist/models/AssignGtinRequest.js +47 -0
- package/dist/models/GTIN.d.ts +37 -0
- package/dist/models/GTIN.js +51 -0
- package/dist/models/GTINsResponse.d.ts +38 -0
- package/dist/models/GTINsResponse.js +48 -0
- package/dist/models/ImportGtins202Response.d.ts +31 -0
- package/dist/models/ImportGtins202Response.js +45 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.js +23 -0
- package/dist/runtime.d.ts +187 -0
- package/dist/runtime.js +349 -0
- package/package.json +21 -0
- package/src/apis/GTINsApi.ts +311 -0
- package/src/apis/index.ts +3 -0
- package/src/index.ts +5 -0
- package/src/models/ApiError.ts +69 -0
- package/src/models/AssignGtinRequest.ts +61 -0
- package/src/models/GTIN.ts +70 -0
- package/src/models/GTINsResponse.ts +75 -0
- package/src/models/ImportGtins202Response.ts +60 -0
- package/src/models/index.ts +7 -0
- package/src/runtime.ts +441 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* GTINs API
|
|
6
|
+
* Manage GTINs
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.2.1
|
|
9
|
+
* Contact: hello@teemill.com
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.AssignGtinRequestToJSON = exports.AssignGtinRequestFromJSONTyped = exports.AssignGtinRequestFromJSON = exports.instanceOfAssignGtinRequest = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the AssignGtinRequest interface.
|
|
19
|
+
*/
|
|
20
|
+
function instanceOfAssignGtinRequest(value) {
|
|
21
|
+
if (!('variantRef' in value))
|
|
22
|
+
return false;
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
exports.instanceOfAssignGtinRequest = instanceOfAssignGtinRequest;
|
|
26
|
+
function AssignGtinRequestFromJSON(json) {
|
|
27
|
+
return AssignGtinRequestFromJSONTyped(json, false);
|
|
28
|
+
}
|
|
29
|
+
exports.AssignGtinRequestFromJSON = AssignGtinRequestFromJSON;
|
|
30
|
+
function AssignGtinRequestFromJSONTyped(json, ignoreDiscriminator) {
|
|
31
|
+
if (json == null) {
|
|
32
|
+
return json;
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
'variantRef': json['variantRef'],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.AssignGtinRequestFromJSONTyped = AssignGtinRequestFromJSONTyped;
|
|
39
|
+
function AssignGtinRequestToJSON(value) {
|
|
40
|
+
if (value == null) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
'variantRef': value['variantRef'],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
exports.AssignGtinRequestToJSON = AssignGtinRequestToJSON;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTINs API
|
|
3
|
+
* Manage GTINs
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.2.1
|
|
6
|
+
* Contact: hello@teemill.com
|
|
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
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface GTIN
|
|
16
|
+
*/
|
|
17
|
+
export interface GTIN {
|
|
18
|
+
/**
|
|
19
|
+
* The GTIN
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof GTIN
|
|
22
|
+
*/
|
|
23
|
+
number: string;
|
|
24
|
+
/**
|
|
25
|
+
* A reference to the resource location
|
|
26
|
+
* @type {string}
|
|
27
|
+
* @memberof GTIN
|
|
28
|
+
*/
|
|
29
|
+
variantRef: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check if a given object implements the GTIN interface.
|
|
33
|
+
*/
|
|
34
|
+
export declare function instanceOfGTIN(value: object): boolean;
|
|
35
|
+
export declare function GTINFromJSON(json: any): GTIN;
|
|
36
|
+
export declare function GTINFromJSONTyped(json: any, ignoreDiscriminator: boolean): GTIN;
|
|
37
|
+
export declare function GTINToJSON(value?: GTIN | null): any;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* GTINs API
|
|
6
|
+
* Manage GTINs
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.2.1
|
|
9
|
+
* Contact: hello@teemill.com
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GTINToJSON = exports.GTINFromJSONTyped = exports.GTINFromJSON = exports.instanceOfGTIN = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the GTIN interface.
|
|
19
|
+
*/
|
|
20
|
+
function instanceOfGTIN(value) {
|
|
21
|
+
if (!('number' in value))
|
|
22
|
+
return false;
|
|
23
|
+
if (!('variantRef' in value))
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
exports.instanceOfGTIN = instanceOfGTIN;
|
|
28
|
+
function GTINFromJSON(json) {
|
|
29
|
+
return GTINFromJSONTyped(json, false);
|
|
30
|
+
}
|
|
31
|
+
exports.GTINFromJSON = GTINFromJSON;
|
|
32
|
+
function GTINFromJSONTyped(json, ignoreDiscriminator) {
|
|
33
|
+
if (json == null) {
|
|
34
|
+
return json;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
'number': json['number'],
|
|
38
|
+
'variantRef': json['variantRef'],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
exports.GTINFromJSONTyped = GTINFromJSONTyped;
|
|
42
|
+
function GTINToJSON(value) {
|
|
43
|
+
if (value == null) {
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
'number': value['number'],
|
|
48
|
+
'variantRef': value['variantRef'],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.GTINToJSON = GTINToJSON;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTINs API
|
|
3
|
+
* Manage GTINs
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.2.1
|
|
6
|
+
* Contact: hello@teemill.com
|
|
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
|
+
import type { GTIN } from './GTIN';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface GTINsResponse
|
|
17
|
+
*/
|
|
18
|
+
export interface GTINsResponse {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<GTIN>}
|
|
22
|
+
* @memberof GTINsResponse
|
|
23
|
+
*/
|
|
24
|
+
gtins?: Array<GTIN>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof GTINsResponse
|
|
29
|
+
*/
|
|
30
|
+
nextPageToken?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a given object implements the GTINsResponse interface.
|
|
34
|
+
*/
|
|
35
|
+
export declare function instanceOfGTINsResponse(value: object): boolean;
|
|
36
|
+
export declare function GTINsResponseFromJSON(json: any): GTINsResponse;
|
|
37
|
+
export declare function GTINsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): GTINsResponse;
|
|
38
|
+
export declare function GTINsResponseToJSON(value?: GTINsResponse | null): any;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* GTINs API
|
|
6
|
+
* Manage GTINs
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.2.1
|
|
9
|
+
* Contact: hello@teemill.com
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.GTINsResponseToJSON = exports.GTINsResponseFromJSONTyped = exports.GTINsResponseFromJSON = exports.instanceOfGTINsResponse = void 0;
|
|
17
|
+
const GTIN_1 = require("./GTIN");
|
|
18
|
+
/**
|
|
19
|
+
* Check if a given object implements the GTINsResponse interface.
|
|
20
|
+
*/
|
|
21
|
+
function instanceOfGTINsResponse(value) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
exports.instanceOfGTINsResponse = instanceOfGTINsResponse;
|
|
25
|
+
function GTINsResponseFromJSON(json) {
|
|
26
|
+
return GTINsResponseFromJSONTyped(json, false);
|
|
27
|
+
}
|
|
28
|
+
exports.GTINsResponseFromJSON = GTINsResponseFromJSON;
|
|
29
|
+
function GTINsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
30
|
+
if (json == null) {
|
|
31
|
+
return json;
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
'gtins': json['gtins'] == null ? undefined : (json['gtins'].map(GTIN_1.GTINFromJSON)),
|
|
35
|
+
'nextPageToken': json['nextPageToken'] == null ? undefined : json['nextPageToken'],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
exports.GTINsResponseFromJSONTyped = GTINsResponseFromJSONTyped;
|
|
39
|
+
function GTINsResponseToJSON(value) {
|
|
40
|
+
if (value == null) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
'gtins': value['gtins'] == null ? undefined : (value['gtins'].map(GTIN_1.GTINToJSON)),
|
|
45
|
+
'nextPageToken': value['nextPageToken'],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.GTINsResponseToJSON = GTINsResponseToJSON;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTINs API
|
|
3
|
+
* Manage GTINs
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.2.1
|
|
6
|
+
* Contact: hello@teemill.com
|
|
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
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ImportGtins202Response
|
|
16
|
+
*/
|
|
17
|
+
export interface ImportGtins202Response {
|
|
18
|
+
/**
|
|
19
|
+
* Id of the GTINs import
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ImportGtins202Response
|
|
22
|
+
*/
|
|
23
|
+
importId?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if a given object implements the ImportGtins202Response interface.
|
|
27
|
+
*/
|
|
28
|
+
export declare function instanceOfImportGtins202Response(value: object): boolean;
|
|
29
|
+
export declare function ImportGtins202ResponseFromJSON(json: any): ImportGtins202Response;
|
|
30
|
+
export declare function ImportGtins202ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ImportGtins202Response;
|
|
31
|
+
export declare function ImportGtins202ResponseToJSON(value?: ImportGtins202Response | null): any;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* GTINs API
|
|
6
|
+
* Manage GTINs
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 0.2.1
|
|
9
|
+
* Contact: hello@teemill.com
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ImportGtins202ResponseToJSON = exports.ImportGtins202ResponseFromJSONTyped = exports.ImportGtins202ResponseFromJSON = exports.instanceOfImportGtins202Response = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the ImportGtins202Response interface.
|
|
19
|
+
*/
|
|
20
|
+
function instanceOfImportGtins202Response(value) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
exports.instanceOfImportGtins202Response = instanceOfImportGtins202Response;
|
|
24
|
+
function ImportGtins202ResponseFromJSON(json) {
|
|
25
|
+
return ImportGtins202ResponseFromJSONTyped(json, false);
|
|
26
|
+
}
|
|
27
|
+
exports.ImportGtins202ResponseFromJSON = ImportGtins202ResponseFromJSON;
|
|
28
|
+
function ImportGtins202ResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
29
|
+
if (json == null) {
|
|
30
|
+
return json;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
'importId': json['importId'] == null ? undefined : json['importId'],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.ImportGtins202ResponseFromJSONTyped = ImportGtins202ResponseFromJSONTyped;
|
|
37
|
+
function ImportGtins202ResponseToJSON(value) {
|
|
38
|
+
if (value == null) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
'importId': value['importId'],
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
exports.ImportGtins202ResponseToJSON = ImportGtins202ResponseToJSON;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/* tslint:disable */
|
|
18
|
+
/* eslint-disable */
|
|
19
|
+
__exportStar(require("./ApiError"), exports);
|
|
20
|
+
__exportStar(require("./AssignGtinRequest"), exports);
|
|
21
|
+
__exportStar(require("./GTIN"), exports);
|
|
22
|
+
__exportStar(require("./GTINsResponse"), exports);
|
|
23
|
+
__exportStar(require("./ImportGtins202Response"), exports);
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GTINs API
|
|
3
|
+
* Manage GTINs
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 0.2.1
|
|
6
|
+
* Contact: hello@teemill.com
|
|
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 type OptionalProperties<T> = {
|
|
13
|
+
[K in keyof T]-?: undefined extends T[K] ? K : never;
|
|
14
|
+
}[keyof T];
|
|
15
|
+
export type OptionalOnly<T> = Partial<Pick<T, OptionalProperties<T>>>;
|
|
16
|
+
export declare const BASE_PATH: string;
|
|
17
|
+
export interface ConfigurationParameters {
|
|
18
|
+
basePath?: string;
|
|
19
|
+
fetchApi?: FetchAPI;
|
|
20
|
+
middleware?: Middleware[];
|
|
21
|
+
queryParamsStringify?: (params: HTTPQuery) => string;
|
|
22
|
+
username?: string;
|
|
23
|
+
password?: string;
|
|
24
|
+
apiKey?: string | ((name: string) => string);
|
|
25
|
+
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>);
|
|
26
|
+
headers?: HTTPHeaders;
|
|
27
|
+
credentials?: RequestCredentials;
|
|
28
|
+
}
|
|
29
|
+
export declare class Configuration {
|
|
30
|
+
private configuration;
|
|
31
|
+
constructor(configuration?: ConfigurationParameters);
|
|
32
|
+
set config(configuration: Configuration);
|
|
33
|
+
get basePath(): string;
|
|
34
|
+
get fetchApi(): FetchAPI | undefined;
|
|
35
|
+
get middleware(): Middleware[];
|
|
36
|
+
get queryParamsStringify(): (params: HTTPQuery) => string;
|
|
37
|
+
get username(): string | undefined;
|
|
38
|
+
get password(): string | undefined;
|
|
39
|
+
get apiKey(): ((name: string) => string) | undefined;
|
|
40
|
+
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined;
|
|
41
|
+
get headers(): HTTPHeaders | undefined;
|
|
42
|
+
get credentials(): RequestCredentials | undefined;
|
|
43
|
+
}
|
|
44
|
+
export declare const DefaultConfig: Configuration;
|
|
45
|
+
/**
|
|
46
|
+
* This is the base class for all generated API classes.
|
|
47
|
+
*/
|
|
48
|
+
export declare class BaseAPI {
|
|
49
|
+
protected configuration: Configuration;
|
|
50
|
+
private static readonly jsonRegex;
|
|
51
|
+
private middleware;
|
|
52
|
+
constructor(configuration?: Configuration);
|
|
53
|
+
isResponseError(error: any): error is ResponseError;
|
|
54
|
+
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
|
|
55
|
+
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
|
|
56
|
+
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
|
|
57
|
+
/**
|
|
58
|
+
* Check if the given MIME is a JSON MIME.
|
|
59
|
+
* JSON MIME examples:
|
|
60
|
+
* application/json
|
|
61
|
+
* application/json; charset=UTF8
|
|
62
|
+
* APPLICATION/JSON
|
|
63
|
+
* application/vnd.company+json
|
|
64
|
+
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
65
|
+
* @return True if the given MIME is JSON, false otherwise.
|
|
66
|
+
*/
|
|
67
|
+
protected isJsonMime(mime: string | null | undefined): boolean;
|
|
68
|
+
protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
|
|
69
|
+
private createFetchParams;
|
|
70
|
+
private fetchApi;
|
|
71
|
+
/**
|
|
72
|
+
* Create a shallow clone of `this` by constructing a new instance
|
|
73
|
+
* and then shallow cloning data members.
|
|
74
|
+
*/
|
|
75
|
+
private clone;
|
|
76
|
+
}
|
|
77
|
+
export declare class ResponseError extends Error {
|
|
78
|
+
response: Response;
|
|
79
|
+
name: "ResponseError";
|
|
80
|
+
constructor(response: Response, msg?: string);
|
|
81
|
+
}
|
|
82
|
+
export declare class FetchError extends Error {
|
|
83
|
+
cause: Error;
|
|
84
|
+
name: "FetchError";
|
|
85
|
+
constructor(cause: Error, msg?: string);
|
|
86
|
+
}
|
|
87
|
+
export declare class RequiredError extends Error {
|
|
88
|
+
field: string;
|
|
89
|
+
name: "RequiredError";
|
|
90
|
+
constructor(field: string, msg?: string);
|
|
91
|
+
}
|
|
92
|
+
export declare const COLLECTION_FORMATS: {
|
|
93
|
+
csv: string;
|
|
94
|
+
ssv: string;
|
|
95
|
+
tsv: string;
|
|
96
|
+
pipes: string;
|
|
97
|
+
};
|
|
98
|
+
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
|
|
99
|
+
export type Json = any;
|
|
100
|
+
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
101
|
+
export type HTTPHeaders = {
|
|
102
|
+
[key: string]: string;
|
|
103
|
+
};
|
|
104
|
+
export type HTTPQuery = {
|
|
105
|
+
[key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
|
|
106
|
+
};
|
|
107
|
+
export type HTTPBody = Json | FormData | URLSearchParams;
|
|
108
|
+
export type HTTPRequestInit = {
|
|
109
|
+
headers?: HTTPHeaders;
|
|
110
|
+
method: HTTPMethod;
|
|
111
|
+
credentials?: RequestCredentials;
|
|
112
|
+
body?: HTTPBody;
|
|
113
|
+
};
|
|
114
|
+
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
|
|
115
|
+
export type InitOverrideFunction = (requestContext: {
|
|
116
|
+
init: HTTPRequestInit;
|
|
117
|
+
context: RequestOpts;
|
|
118
|
+
}) => Promise<RequestInit>;
|
|
119
|
+
export interface FetchParams {
|
|
120
|
+
url: string;
|
|
121
|
+
init: RequestInit;
|
|
122
|
+
}
|
|
123
|
+
export interface RequestOpts {
|
|
124
|
+
path: string;
|
|
125
|
+
method: HTTPMethod;
|
|
126
|
+
headers: HTTPHeaders;
|
|
127
|
+
query?: HTTPQuery;
|
|
128
|
+
body?: HTTPBody;
|
|
129
|
+
}
|
|
130
|
+
export declare function exists(json: any, key: string): boolean;
|
|
131
|
+
export declare function querystring(params: HTTPQuery, prefix?: string): string;
|
|
132
|
+
export declare function mapValues(data: any, fn: (item: any) => any): {};
|
|
133
|
+
export declare function canConsumeForm(consumes: Consume[]): boolean;
|
|
134
|
+
export interface Consume {
|
|
135
|
+
contentType: string;
|
|
136
|
+
}
|
|
137
|
+
export interface RequestContext {
|
|
138
|
+
fetch: FetchAPI;
|
|
139
|
+
url: string;
|
|
140
|
+
init: RequestInit;
|
|
141
|
+
}
|
|
142
|
+
export interface ResponseContext {
|
|
143
|
+
fetch: FetchAPI;
|
|
144
|
+
url: string;
|
|
145
|
+
init: RequestInit;
|
|
146
|
+
response: Response;
|
|
147
|
+
}
|
|
148
|
+
export interface ErrorContext {
|
|
149
|
+
fetch: FetchAPI;
|
|
150
|
+
url: string;
|
|
151
|
+
init: RequestInit;
|
|
152
|
+
error: unknown;
|
|
153
|
+
response?: Response;
|
|
154
|
+
}
|
|
155
|
+
export interface Middleware {
|
|
156
|
+
pre?(context: RequestContext): Promise<FetchParams | void>;
|
|
157
|
+
post?(context: ResponseContext): Promise<Response | void>;
|
|
158
|
+
onError?(context: ErrorContext): Promise<Response | void>;
|
|
159
|
+
}
|
|
160
|
+
export interface ApiResponse<T> {
|
|
161
|
+
raw: Response;
|
|
162
|
+
value(): Promise<T>;
|
|
163
|
+
}
|
|
164
|
+
export interface ResponseTransformer<T> {
|
|
165
|
+
(json: any): T;
|
|
166
|
+
}
|
|
167
|
+
export declare class JSONApiResponse<T> {
|
|
168
|
+
raw: Response;
|
|
169
|
+
private transformer;
|
|
170
|
+
constructor(raw: Response, transformer?: ResponseTransformer<T>);
|
|
171
|
+
value(): Promise<T>;
|
|
172
|
+
}
|
|
173
|
+
export declare class VoidApiResponse {
|
|
174
|
+
raw: Response;
|
|
175
|
+
constructor(raw: Response);
|
|
176
|
+
value(): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
export declare class BlobApiResponse {
|
|
179
|
+
raw: Response;
|
|
180
|
+
constructor(raw: Response);
|
|
181
|
+
value(): Promise<Blob>;
|
|
182
|
+
}
|
|
183
|
+
export declare class TextApiResponse {
|
|
184
|
+
raw: Response;
|
|
185
|
+
constructor(raw: Response);
|
|
186
|
+
value(): Promise<string>;
|
|
187
|
+
}
|