@shapeshiftoss/unchained-client 10.7.0 → 10.9.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.
Files changed (72) hide show
  1. package/dist/cosmossdk/parser/index.d.ts +1 -0
  2. package/dist/cosmossdk/parser/index.js +11 -1
  3. package/dist/evm/index.d.ts +1 -0
  4. package/dist/evm/index.js +2 -1
  5. package/dist/evm/optimism/index.d.ts +2 -0
  6. package/dist/evm/optimism/index.js +18 -0
  7. package/dist/evm/optimism/parser/index.d.ts +5 -0
  8. package/dist/evm/optimism/parser/index.js +12 -0
  9. package/dist/evm/parser/index.js +13 -8
  10. package/dist/generated/avalanche/models/GasFees.d.ts +2 -2
  11. package/dist/generated/avalanche/models/GasFees.js +3 -4
  12. package/dist/generated/cosmos/apis/V1Api.d.ts +6 -2
  13. package/dist/generated/cosmos/apis/V1Api.js +9 -3
  14. package/dist/generated/cosmos/models/Validators.d.ts +6 -0
  15. package/dist/generated/cosmos/models/Validators.js +3 -0
  16. package/dist/generated/cosmos/models/ValidatorsAllOf.d.ts +32 -0
  17. package/dist/generated/cosmos/models/ValidatorsAllOf.js +52 -0
  18. package/dist/generated/cosmos/models/index.d.ts +1 -0
  19. package/dist/generated/cosmos/models/index.js +1 -0
  20. package/dist/generated/ethereum/models/GasFees.d.ts +2 -2
  21. package/dist/generated/ethereum/models/GasFees.js +3 -4
  22. package/dist/generated/optimism/apis/V1Api.d.ts +94 -0
  23. package/dist/generated/optimism/apis/V1Api.js +239 -0
  24. package/dist/generated/optimism/apis/index.d.ts +1 -0
  25. package/dist/generated/optimism/apis/index.js +20 -0
  26. package/dist/generated/optimism/index.d.ts +3 -0
  27. package/dist/generated/optimism/index.js +22 -0
  28. package/dist/generated/optimism/models/Account.d.ts +56 -0
  29. package/dist/generated/optimism/models/Account.js +64 -0
  30. package/dist/generated/optimism/models/BadRequestError.d.ts +31 -0
  31. package/dist/generated/optimism/models/BadRequestError.js +51 -0
  32. package/dist/generated/optimism/models/BaseInfo.d.ts +31 -0
  33. package/dist/generated/optimism/models/BaseInfo.js +51 -0
  34. package/dist/generated/optimism/models/BaseTxHistoryTx.d.ts +44 -0
  35. package/dist/generated/optimism/models/BaseTxHistoryTx.js +58 -0
  36. package/dist/generated/optimism/models/GasFees.d.ts +43 -0
  37. package/dist/generated/optimism/models/GasFees.js +56 -0
  38. package/dist/generated/optimism/models/InternalServerError.d.ts +31 -0
  39. package/dist/generated/optimism/models/InternalServerError.js +51 -0
  40. package/dist/generated/optimism/models/InternalTx.d.ts +43 -0
  41. package/dist/generated/optimism/models/InternalTx.js +57 -0
  42. package/dist/generated/optimism/models/SendTxBody.d.ts +31 -0
  43. package/dist/generated/optimism/models/SendTxBody.js +51 -0
  44. package/dist/generated/optimism/models/TokenBalance.d.ts +61 -0
  45. package/dist/generated/optimism/models/TokenBalance.js +66 -0
  46. package/dist/generated/optimism/models/TokenTransfer.d.ts +73 -0
  47. package/dist/generated/optimism/models/TokenTransfer.js +72 -0
  48. package/dist/generated/optimism/models/Tx.d.ts +123 -0
  49. package/dist/generated/optimism/models/Tx.js +94 -0
  50. package/dist/generated/optimism/models/ValidationError.d.ts +46 -0
  51. package/dist/generated/optimism/models/ValidationError.js +60 -0
  52. package/dist/generated/optimism/models/index.d.ts +12 -0
  53. package/dist/generated/optimism/models/index.js +31 -0
  54. package/dist/generated/optimism/runtime.d.ts +170 -0
  55. package/dist/generated/optimism/runtime.js +310 -0
  56. package/dist/generated/osmosis/apis/V1Api.d.ts +6 -2
  57. package/dist/generated/osmosis/apis/V1Api.js +9 -3
  58. package/dist/generated/osmosis/models/Validators.d.ts +6 -0
  59. package/dist/generated/osmosis/models/Validators.js +3 -0
  60. package/dist/generated/osmosis/models/ValidatorsAllOf.d.ts +32 -0
  61. package/dist/generated/osmosis/models/ValidatorsAllOf.js +52 -0
  62. package/dist/generated/osmosis/models/index.d.ts +1 -0
  63. package/dist/generated/osmosis/models/index.js +1 -0
  64. package/dist/generated/thorchain/models/Validators.d.ts +6 -0
  65. package/dist/generated/thorchain/models/Validators.js +3 -0
  66. package/dist/generated/thorchain/models/ValidatorsAllOf.d.ts +32 -0
  67. package/dist/generated/thorchain/models/ValidatorsAllOf.js +52 -0
  68. package/dist/generated/thorchain/models/index.d.ts +1 -0
  69. package/dist/generated/thorchain/models/index.js +1 -0
  70. package/dist/index.d.ts +1 -0
  71. package/dist/index.js +2 -1
  72. package/package.json +2 -2
@@ -0,0 +1,123 @@
1
+ /**
2
+ * @shapeshiftoss/optimism-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 8.0.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
+ import type { InternalTx } from './InternalTx';
13
+ import type { TokenTransfer } from './TokenTransfer';
14
+ /**
15
+ * Contains info about an EVM transaction
16
+ * @export
17
+ * @interface Tx
18
+ */
19
+ export interface Tx {
20
+ /**
21
+ *
22
+ * @type {string}
23
+ * @memberof Tx
24
+ */
25
+ txid: string;
26
+ /**
27
+ *
28
+ * @type {string}
29
+ * @memberof Tx
30
+ */
31
+ blockHash?: string;
32
+ /**
33
+ *
34
+ * @type {number}
35
+ * @memberof Tx
36
+ */
37
+ blockHeight: number;
38
+ /**
39
+ *
40
+ * @type {number}
41
+ * @memberof Tx
42
+ */
43
+ timestamp: number;
44
+ /**
45
+ *
46
+ * @type {string}
47
+ * @memberof Tx
48
+ */
49
+ from: string;
50
+ /**
51
+ *
52
+ * @type {string}
53
+ * @memberof Tx
54
+ */
55
+ to: string;
56
+ /**
57
+ *
58
+ * @type {number}
59
+ * @memberof Tx
60
+ */
61
+ confirmations: number;
62
+ /**
63
+ *
64
+ * @type {string}
65
+ * @memberof Tx
66
+ */
67
+ value: string;
68
+ /**
69
+ *
70
+ * @type {string}
71
+ * @memberof Tx
72
+ */
73
+ fee: string;
74
+ /**
75
+ *
76
+ * @type {string}
77
+ * @memberof Tx
78
+ */
79
+ gasLimit: string;
80
+ /**
81
+ *
82
+ * @type {string}
83
+ * @memberof Tx
84
+ */
85
+ gasUsed?: string;
86
+ /**
87
+ *
88
+ * @type {string}
89
+ * @memberof Tx
90
+ */
91
+ gasPrice: string;
92
+ /**
93
+ *
94
+ * @type {number}
95
+ * @memberof Tx
96
+ */
97
+ status: number;
98
+ /**
99
+ *
100
+ * @type {string}
101
+ * @memberof Tx
102
+ */
103
+ inputData?: string;
104
+ /**
105
+ *
106
+ * @type {Array<TokenTransfer>}
107
+ * @memberof Tx
108
+ */
109
+ tokenTransfers?: Array<TokenTransfer>;
110
+ /**
111
+ *
112
+ * @type {Array<InternalTx>}
113
+ * @memberof Tx
114
+ */
115
+ internalTxs?: Array<InternalTx>;
116
+ }
117
+ /**
118
+ * Check if a given object implements the Tx interface.
119
+ */
120
+ export declare function instanceOfTx(value: object): boolean;
121
+ export declare function TxFromJSON(json: any): Tx;
122
+ export declare function TxFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tx;
123
+ export declare function TxToJSON(value?: Tx | null): any;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * @shapeshiftoss/optimism-api
7
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+ *
9
+ * The version of the OpenAPI document: 8.0.0
10
+ *
11
+ *
12
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
13
+ * https://openapi-generator.tech
14
+ * Do not edit the class manually.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.TxToJSON = exports.TxFromJSONTyped = exports.TxFromJSON = exports.instanceOfTx = void 0;
18
+ const runtime_1 = require("../runtime");
19
+ const InternalTx_1 = require("./InternalTx");
20
+ const TokenTransfer_1 = require("./TokenTransfer");
21
+ /**
22
+ * Check if a given object implements the Tx interface.
23
+ */
24
+ function instanceOfTx(value) {
25
+ let isInstance = true;
26
+ isInstance = isInstance && "txid" in value;
27
+ isInstance = isInstance && "blockHeight" in value;
28
+ isInstance = isInstance && "timestamp" in value;
29
+ isInstance = isInstance && "from" in value;
30
+ isInstance = isInstance && "to" in value;
31
+ isInstance = isInstance && "confirmations" in value;
32
+ isInstance = isInstance && "value" in value;
33
+ isInstance = isInstance && "fee" in value;
34
+ isInstance = isInstance && "gasLimit" in value;
35
+ isInstance = isInstance && "gasPrice" in value;
36
+ isInstance = isInstance && "status" in value;
37
+ return isInstance;
38
+ }
39
+ exports.instanceOfTx = instanceOfTx;
40
+ function TxFromJSON(json) {
41
+ return TxFromJSONTyped(json, false);
42
+ }
43
+ exports.TxFromJSON = TxFromJSON;
44
+ function TxFromJSONTyped(json, ignoreDiscriminator) {
45
+ if ((json === undefined) || (json === null)) {
46
+ return json;
47
+ }
48
+ return {
49
+ 'txid': json['txid'],
50
+ 'blockHash': !(0, runtime_1.exists)(json, 'blockHash') ? undefined : json['blockHash'],
51
+ 'blockHeight': json['blockHeight'],
52
+ 'timestamp': json['timestamp'],
53
+ 'from': json['from'],
54
+ 'to': json['to'],
55
+ 'confirmations': json['confirmations'],
56
+ 'value': json['value'],
57
+ 'fee': json['fee'],
58
+ 'gasLimit': json['gasLimit'],
59
+ 'gasUsed': !(0, runtime_1.exists)(json, 'gasUsed') ? undefined : json['gasUsed'],
60
+ 'gasPrice': json['gasPrice'],
61
+ 'status': json['status'],
62
+ 'inputData': !(0, runtime_1.exists)(json, 'inputData') ? undefined : json['inputData'],
63
+ 'tokenTransfers': !(0, runtime_1.exists)(json, 'tokenTransfers') ? undefined : (json['tokenTransfers'].map(TokenTransfer_1.TokenTransferFromJSON)),
64
+ 'internalTxs': !(0, runtime_1.exists)(json, 'internalTxs') ? undefined : (json['internalTxs'].map(InternalTx_1.InternalTxFromJSON)),
65
+ };
66
+ }
67
+ exports.TxFromJSONTyped = TxFromJSONTyped;
68
+ function TxToJSON(value) {
69
+ if (value === undefined) {
70
+ return undefined;
71
+ }
72
+ if (value === null) {
73
+ return null;
74
+ }
75
+ return {
76
+ 'txid': value.txid,
77
+ 'blockHash': value.blockHash,
78
+ 'blockHeight': value.blockHeight,
79
+ 'timestamp': value.timestamp,
80
+ 'from': value.from,
81
+ 'to': value.to,
82
+ 'confirmations': value.confirmations,
83
+ 'value': value.value,
84
+ 'fee': value.fee,
85
+ 'gasLimit': value.gasLimit,
86
+ 'gasUsed': value.gasUsed,
87
+ 'gasPrice': value.gasPrice,
88
+ 'status': value.status,
89
+ 'inputData': value.inputData,
90
+ 'tokenTransfers': value.tokenTransfers === undefined ? undefined : (value.tokenTransfers.map(TokenTransfer_1.TokenTransferToJSON)),
91
+ 'internalTxs': value.internalTxs === undefined ? undefined : (value.internalTxs.map(InternalTx_1.InternalTxToJSON)),
92
+ };
93
+ }
94
+ exports.TxToJSON = TxToJSON;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @shapeshiftoss/optimism-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 8.0.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
+ * Contains info about a 422 Validation Error response
14
+ * @export
15
+ * @interface ValidationError
16
+ */
17
+ export interface ValidationError {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof ValidationError
22
+ */
23
+ message: ValidationErrorMessageEnum;
24
+ /**
25
+ *
26
+ * @type {{ [key: string]: any; }}
27
+ * @memberof ValidationError
28
+ */
29
+ details: {
30
+ [key: string]: any;
31
+ };
32
+ }
33
+ /**
34
+ * @export
35
+ */
36
+ export declare const ValidationErrorMessageEnum: {
37
+ readonly ValidationFailed: "Validation failed";
38
+ };
39
+ export declare type ValidationErrorMessageEnum = typeof ValidationErrorMessageEnum[keyof typeof ValidationErrorMessageEnum];
40
+ /**
41
+ * Check if a given object implements the ValidationError interface.
42
+ */
43
+ export declare function instanceOfValidationError(value: object): boolean;
44
+ export declare function ValidationErrorFromJSON(json: any): ValidationError;
45
+ export declare function ValidationErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidationError;
46
+ export declare function ValidationErrorToJSON(value?: ValidationError | null): any;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ /**
6
+ * @shapeshiftoss/optimism-api
7
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
+ *
9
+ * The version of the OpenAPI document: 8.0.0
10
+ *
11
+ *
12
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
13
+ * https://openapi-generator.tech
14
+ * Do not edit the class manually.
15
+ */
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ValidationErrorToJSON = exports.ValidationErrorFromJSONTyped = exports.ValidationErrorFromJSON = exports.instanceOfValidationError = exports.ValidationErrorMessageEnum = void 0;
18
+ /**
19
+ * @export
20
+ */
21
+ exports.ValidationErrorMessageEnum = {
22
+ ValidationFailed: 'Validation failed'
23
+ };
24
+ /**
25
+ * Check if a given object implements the ValidationError interface.
26
+ */
27
+ function instanceOfValidationError(value) {
28
+ let isInstance = true;
29
+ isInstance = isInstance && "message" in value;
30
+ isInstance = isInstance && "details" in value;
31
+ return isInstance;
32
+ }
33
+ exports.instanceOfValidationError = instanceOfValidationError;
34
+ function ValidationErrorFromJSON(json) {
35
+ return ValidationErrorFromJSONTyped(json, false);
36
+ }
37
+ exports.ValidationErrorFromJSON = ValidationErrorFromJSON;
38
+ function ValidationErrorFromJSONTyped(json, ignoreDiscriminator) {
39
+ if ((json === undefined) || (json === null)) {
40
+ return json;
41
+ }
42
+ return {
43
+ 'message': json['message'],
44
+ 'details': json['details'],
45
+ };
46
+ }
47
+ exports.ValidationErrorFromJSONTyped = ValidationErrorFromJSONTyped;
48
+ function ValidationErrorToJSON(value) {
49
+ if (value === undefined) {
50
+ return undefined;
51
+ }
52
+ if (value === null) {
53
+ return null;
54
+ }
55
+ return {
56
+ 'message': value.message,
57
+ 'details': value.details,
58
+ };
59
+ }
60
+ exports.ValidationErrorToJSON = ValidationErrorToJSON;
@@ -0,0 +1,12 @@
1
+ export * from './Account';
2
+ export * from './BadRequestError';
3
+ export * from './BaseInfo';
4
+ export * from './BaseTxHistoryTx';
5
+ export * from './GasFees';
6
+ export * from './InternalServerError';
7
+ export * from './InternalTx';
8
+ export * from './SendTxBody';
9
+ export * from './TokenBalance';
10
+ export * from './TokenTransfer';
11
+ export * from './Tx';
12
+ export * from './ValidationError';
@@ -0,0 +1,31 @@
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
+ // @ts-nocheck
18
+ /* tslint:disable */
19
+ /* eslint-disable */
20
+ __exportStar(require("./Account"), exports);
21
+ __exportStar(require("./BadRequestError"), exports);
22
+ __exportStar(require("./BaseInfo"), exports);
23
+ __exportStar(require("./BaseTxHistoryTx"), exports);
24
+ __exportStar(require("./GasFees"), exports);
25
+ __exportStar(require("./InternalServerError"), exports);
26
+ __exportStar(require("./InternalTx"), exports);
27
+ __exportStar(require("./SendTxBody"), exports);
28
+ __exportStar(require("./TokenBalance"), exports);
29
+ __exportStar(require("./TokenTransfer"), exports);
30
+ __exportStar(require("./Tx"), exports);
31
+ __exportStar(require("./ValidationError"), exports);
@@ -0,0 +1,170 @@
1
+ /**
2
+ * @shapeshiftoss/optimism-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 8.0.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 | ((name: string) => 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) | 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 middleware;
47
+ constructor(configuration?: Configuration);
48
+ withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]): T;
49
+ withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>): T;
50
+ withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>): T;
51
+ protected request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response>;
52
+ private createFetchParams;
53
+ private fetchApi;
54
+ /**
55
+ * Create a shallow clone of `this` by constructing a new instance
56
+ * and then shallow cloning data members.
57
+ */
58
+ private clone;
59
+ }
60
+ export declare class ResponseError extends Error {
61
+ response: Response;
62
+ name: "ResponseError";
63
+ constructor(response: Response, msg?: string);
64
+ }
65
+ export declare class FetchError extends Error {
66
+ cause: Error;
67
+ name: "FetchError";
68
+ constructor(cause: Error, msg?: string);
69
+ }
70
+ export declare class RequiredError extends Error {
71
+ field: string;
72
+ name: "RequiredError";
73
+ constructor(field: string, msg?: string);
74
+ }
75
+ export declare const COLLECTION_FORMATS: {
76
+ csv: string;
77
+ ssv: string;
78
+ tsv: string;
79
+ pipes: string;
80
+ };
81
+ export declare type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
82
+ export declare type Json = any;
83
+ export declare type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
84
+ export declare type HTTPHeaders = {
85
+ [key: string]: string;
86
+ };
87
+ export declare type HTTPQuery = {
88
+ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery;
89
+ };
90
+ export declare type HTTPBody = Json | FormData | URLSearchParams;
91
+ export declare type HTTPRequestInit = {
92
+ headers?: HTTPHeaders;
93
+ method: HTTPMethod;
94
+ credentials?: RequestCredentials;
95
+ body?: HTTPBody;
96
+ };
97
+ export declare type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
98
+ export declare type InitOverrideFunction = (requestContext: {
99
+ init: HTTPRequestInit;
100
+ context: RequestOpts;
101
+ }) => Promise<RequestInit>;
102
+ export interface FetchParams {
103
+ url: string;
104
+ init: RequestInit;
105
+ }
106
+ export interface RequestOpts {
107
+ path: string;
108
+ method: HTTPMethod;
109
+ headers: HTTPHeaders;
110
+ query?: HTTPQuery;
111
+ body?: HTTPBody;
112
+ }
113
+ export declare function exists(json: any, key: string): boolean;
114
+ export declare function querystring(params: HTTPQuery, prefix?: string): string;
115
+ export declare function mapValues(data: any, fn: (item: any) => any): {};
116
+ export declare function canConsumeForm(consumes: Consume[]): boolean;
117
+ export interface Consume {
118
+ contentType: string;
119
+ }
120
+ export interface RequestContext {
121
+ fetch: FetchAPI;
122
+ url: string;
123
+ init: RequestInit;
124
+ }
125
+ export interface ResponseContext {
126
+ fetch: FetchAPI;
127
+ url: string;
128
+ init: RequestInit;
129
+ response: Response;
130
+ }
131
+ export interface ErrorContext {
132
+ fetch: FetchAPI;
133
+ url: string;
134
+ init: RequestInit;
135
+ error: unknown;
136
+ response?: Response;
137
+ }
138
+ export interface Middleware {
139
+ pre?(context: RequestContext): Promise<FetchParams | void>;
140
+ post?(context: ResponseContext): Promise<Response | void>;
141
+ onError?(context: ErrorContext): Promise<Response | void>;
142
+ }
143
+ export interface ApiResponse<T> {
144
+ raw: Response;
145
+ value(): Promise<T>;
146
+ }
147
+ export interface ResponseTransformer<T> {
148
+ (json: any): T;
149
+ }
150
+ export declare class JSONApiResponse<T> {
151
+ raw: Response;
152
+ private transformer;
153
+ constructor(raw: Response, transformer?: ResponseTransformer<T>);
154
+ value(): Promise<T>;
155
+ }
156
+ export declare class VoidApiResponse {
157
+ raw: Response;
158
+ constructor(raw: Response);
159
+ value(): Promise<void>;
160
+ }
161
+ export declare class BlobApiResponse {
162
+ raw: Response;
163
+ constructor(raw: Response);
164
+ value(): Promise<Blob>;
165
+ }
166
+ export declare class TextApiResponse {
167
+ raw: Response;
168
+ constructor(raw: Response);
169
+ value(): Promise<string>;
170
+ }