@teemill/gfn-catalog 1.1.0 → 1.3.0
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 +4 -0
- package/.openapi-generator/VERSION +1 -1
- package/README.md +2 -2
- package/dist/apis/ProductsApi.d.ts +1 -1
- package/dist/apis/ProductsApi.js +47 -128
- package/dist/apis/VariantsApi.d.ts +34 -2
- package/dist/apis/VariantsApi.js +180 -186
- package/dist/esm/apis/ProductsApi.d.ts +35 -0
- package/dist/esm/apis/ProductsApi.js +81 -0
- package/dist/esm/apis/VariantsApi.d.ts +82 -0
- package/dist/esm/apis/VariantsApi.js +225 -0
- package/dist/esm/apis/index.d.ts +2 -0
- package/dist/esm/apis/index.js +4 -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/Attribute.d.ts +50 -0
- package/dist/esm/models/Attribute.js +49 -0
- package/dist/esm/models/AttributeThumbnail.d.ts +46 -0
- package/dist/esm/models/AttributeThumbnail.js +48 -0
- package/dist/esm/models/Image.d.ts +67 -0
- package/dist/esm/models/Image.js +50 -0
- package/dist/esm/models/Product.d.ts +67 -0
- package/dist/esm/models/Product.js +52 -0
- package/dist/esm/models/ProductsResponse.d.ts +38 -0
- package/dist/esm/models/ProductsResponse.js +41 -0
- package/dist/esm/models/Stock.d.ts +31 -0
- package/dist/esm/models/Stock.js +38 -0
- package/dist/esm/models/StockResponse.d.ts +38 -0
- package/dist/esm/models/StockResponse.js +41 -0
- package/dist/esm/models/Variant.d.ts +78 -0
- package/dist/esm/models/Variant.js +61 -0
- package/dist/esm/models/VariantManufacturerOrigin.d.ts +37 -0
- package/dist/esm/models/VariantManufacturerOrigin.js +40 -0
- package/dist/esm/models/VariantProduct.d.ts +37 -0
- package/dist/esm/models/VariantProduct.js +40 -0
- package/dist/esm/models/VariantStock.d.ts +50 -0
- package/dist/esm/models/VariantStock.js +45 -0
- package/dist/esm/models/VariantsResponse.d.ts +38 -0
- package/dist/esm/models/VariantsResponse.js +41 -0
- package/dist/esm/models/index.d.ts +13 -0
- package/dist/esm/models/index.js +15 -0
- package/dist/esm/runtime.d.ts +187 -0
- package/dist/esm/runtime.js +333 -0
- package/dist/models/ApiError.d.ts +1 -1
- package/dist/models/ApiError.js +1 -1
- package/dist/models/Attribute.d.ts +1 -1
- package/dist/models/Attribute.js +2 -2
- package/dist/models/AttributeThumbnail.d.ts +1 -1
- package/dist/models/AttributeThumbnail.js +1 -1
- package/dist/models/Image.d.ts +1 -1
- package/dist/models/Image.js +1 -1
- package/dist/models/Product.d.ts +1 -1
- package/dist/models/Product.js +1 -1
- package/dist/models/ProductsResponse.d.ts +1 -1
- package/dist/models/ProductsResponse.js +2 -2
- package/dist/models/Stock.d.ts +31 -0
- package/dist/models/Stock.js +45 -0
- package/dist/models/StockResponse.d.ts +38 -0
- package/dist/models/StockResponse.js +48 -0
- package/dist/models/Variant.d.ts +11 -4
- package/dist/models/Variant.js +10 -7
- package/dist/models/VariantManufacturerOrigin.d.ts +37 -0
- package/dist/models/VariantManufacturerOrigin.js +47 -0
- package/dist/models/VariantProduct.d.ts +1 -1
- package/dist/models/VariantProduct.js +1 -1
- package/dist/models/VariantStock.d.ts +23 -4
- package/dist/models/VariantStock.js +10 -3
- package/dist/models/VariantsResponse.d.ts +1 -1
- package/dist/models/VariantsResponse.js +2 -2
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +3 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +223 -439
- package/package.json +4 -2
- package/src/apis/ProductsApi.ts +1 -1
- package/src/apis/VariantsApi.ts +157 -1
- package/src/models/ApiError.ts +1 -1
- package/src/models/Attribute.ts +1 -1
- package/src/models/AttributeThumbnail.ts +1 -1
- package/src/models/Image.ts +1 -1
- package/src/models/Product.ts +1 -1
- package/src/models/ProductsResponse.ts +1 -1
- package/src/models/Stock.ts +60 -0
- package/src/models/StockResponse.ts +75 -0
- package/src/models/Variant.ts +25 -11
- package/src/models/VariantManufacturerOrigin.ts +68 -0
- package/src/models/VariantProduct.ts +1 -1
- package/src/models/VariantStock.ts +37 -6
- package/src/models/VariantsResponse.ts +1 -1
- package/src/models/index.ts +3 -0
- package/src/runtime.ts +1 -1
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +2 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GFN Catalog API
|
|
3
|
+
* Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.3.0
|
|
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 { Stock } from './Stock';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface VariantStock
|
|
17
|
+
*/
|
|
18
|
+
export interface VariantStock {
|
|
19
|
+
/**
|
|
20
|
+
* Unique object identifier
|
|
21
|
+
* @type {string}
|
|
22
|
+
* @memberof VariantStock
|
|
23
|
+
*/
|
|
24
|
+
id?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A reference to the resource location
|
|
27
|
+
* @type {string}
|
|
28
|
+
* @memberof VariantStock
|
|
29
|
+
*/
|
|
30
|
+
ref?: string;
|
|
31
|
+
/**
|
|
32
|
+
* A reference to the resource location
|
|
33
|
+
* @type {string}
|
|
34
|
+
* @memberof VariantStock
|
|
35
|
+
*/
|
|
36
|
+
productRef?: string;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @type {Stock}
|
|
40
|
+
* @memberof VariantStock
|
|
41
|
+
*/
|
|
42
|
+
stock?: Stock;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if a given object implements the VariantStock interface.
|
|
46
|
+
*/
|
|
47
|
+
export declare function instanceOfVariantStock(value: object): boolean;
|
|
48
|
+
export declare function VariantStockFromJSON(json: any): VariantStock;
|
|
49
|
+
export declare function VariantStockFromJSONTyped(json: any, ignoreDiscriminator: boolean): VariantStock;
|
|
50
|
+
export declare function VariantStockToJSON(value?: VariantStock | null): any;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GFN Catalog API
|
|
5
|
+
* Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.3.0
|
|
8
|
+
* Contact: hello@teemill.com
|
|
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
|
+
import { StockFromJSON, StockToJSON, } from './Stock';
|
|
15
|
+
/**
|
|
16
|
+
* Check if a given object implements the VariantStock interface.
|
|
17
|
+
*/
|
|
18
|
+
export function instanceOfVariantStock(value) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
export function VariantStockFromJSON(json) {
|
|
22
|
+
return VariantStockFromJSONTyped(json, false);
|
|
23
|
+
}
|
|
24
|
+
export function VariantStockFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
if (json == null) {
|
|
26
|
+
return json;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
'id': json['id'] == null ? undefined : json['id'],
|
|
30
|
+
'ref': json['ref'] == null ? undefined : json['ref'],
|
|
31
|
+
'productRef': json['productRef'] == null ? undefined : json['productRef'],
|
|
32
|
+
'stock': json['stock'] == null ? undefined : StockFromJSON(json['stock']),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function VariantStockToJSON(value) {
|
|
36
|
+
if (value == null) {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
'id': value['id'],
|
|
41
|
+
'ref': value['ref'],
|
|
42
|
+
'productRef': value['productRef'],
|
|
43
|
+
'stock': StockToJSON(value['stock']),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GFN Catalog API
|
|
3
|
+
* Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.3.0
|
|
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 { Variant } from './Variant';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface VariantsResponse
|
|
17
|
+
*/
|
|
18
|
+
export interface VariantsResponse {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<Variant>}
|
|
22
|
+
* @memberof VariantsResponse
|
|
23
|
+
*/
|
|
24
|
+
variants?: Array<Variant>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @type {number}
|
|
28
|
+
* @memberof VariantsResponse
|
|
29
|
+
*/
|
|
30
|
+
nextPageToken?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a given object implements the VariantsResponse interface.
|
|
34
|
+
*/
|
|
35
|
+
export declare function instanceOfVariantsResponse(value: object): boolean;
|
|
36
|
+
export declare function VariantsResponseFromJSON(json: any): VariantsResponse;
|
|
37
|
+
export declare function VariantsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): VariantsResponse;
|
|
38
|
+
export declare function VariantsResponseToJSON(value?: VariantsResponse | null): any;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* GFN Catalog API
|
|
5
|
+
* Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.3.0
|
|
8
|
+
* Contact: hello@teemill.com
|
|
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
|
+
import { VariantFromJSON, VariantToJSON, } from './Variant';
|
|
15
|
+
/**
|
|
16
|
+
* Check if a given object implements the VariantsResponse interface.
|
|
17
|
+
*/
|
|
18
|
+
export function instanceOfVariantsResponse(value) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
export function VariantsResponseFromJSON(json) {
|
|
22
|
+
return VariantsResponseFromJSONTyped(json, false);
|
|
23
|
+
}
|
|
24
|
+
export function VariantsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
25
|
+
if (json == null) {
|
|
26
|
+
return json;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
'variants': json['variants'] == null ? undefined : (json['variants'].map(VariantFromJSON)),
|
|
30
|
+
'nextPageToken': json['nextPageToken'] == null ? undefined : json['nextPageToken'],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function VariantsResponseToJSON(value) {
|
|
34
|
+
if (value == null) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
'variants': value['variants'] == null ? undefined : (value['variants'].map(VariantToJSON)),
|
|
39
|
+
'nextPageToken': value['nextPageToken'],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './ApiError';
|
|
2
|
+
export * from './Attribute';
|
|
3
|
+
export * from './AttributeThumbnail';
|
|
4
|
+
export * from './Image';
|
|
5
|
+
export * from './Product';
|
|
6
|
+
export * from './ProductsResponse';
|
|
7
|
+
export * from './Stock';
|
|
8
|
+
export * from './StockResponse';
|
|
9
|
+
export * from './Variant';
|
|
10
|
+
export * from './VariantManufacturerOrigin';
|
|
11
|
+
export * from './VariantProduct';
|
|
12
|
+
export * from './VariantStock';
|
|
13
|
+
export * from './VariantsResponse';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export * from './ApiError';
|
|
4
|
+
export * from './Attribute';
|
|
5
|
+
export * from './AttributeThumbnail';
|
|
6
|
+
export * from './Image';
|
|
7
|
+
export * from './Product';
|
|
8
|
+
export * from './ProductsResponse';
|
|
9
|
+
export * from './Stock';
|
|
10
|
+
export * from './StockResponse';
|
|
11
|
+
export * from './Variant';
|
|
12
|
+
export * from './VariantManufacturerOrigin';
|
|
13
|
+
export * from './VariantProduct';
|
|
14
|
+
export * from './VariantStock';
|
|
15
|
+
export * from './VariantsResponse';
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GFN Catalog API
|
|
3
|
+
* Use this API to access the Global Fulfilment Network, which contains all the warehouse products and variants available to a given project. Warehouse products represent the base products that can be printed on. Products are the top level items, and variants are the different options available for each product. For example, a product might be a T-shirt, and each variant represents a different size and colour combination of that T-shirt. Use references to these warehouse products to create new product listings on your project via the Product Catalog API. Use the variant information to decide which options you would like to offer on each product listing.
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.3.0
|
|
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
|
+
}
|