@reclaimprotocol/client 0.1.0-dev.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/lib/client.d.ts +30 -0
- package/lib/client.js +107 -0
- package/lib/consts.d.ts +3 -0
- package/lib/consts.js +4 -0
- package/lib/errors.d.ts +5 -0
- package/lib/errors.js +22 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.js +4 -0
- package/lib/keypair.d.ts +21 -0
- package/lib/keypair.js +51 -0
- package/lib/routes.gen.d.ts +279 -0
- package/lib/routes.gen.js +75 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +1 -0
- package/lib/types/openapi.d.ts +74 -0
- package/lib/types/openapi.gen.d.ts +3989 -0
- package/lib/types/openapi.gen.js +5 -0
- package/lib/types/openapi.js +1 -0
- package/package.json +56 -0
- package/src/client.ts +146 -0
- package/src/consts.ts +6 -0
- package/src/errors.ts +30 -0
- package/src/index.ts +10 -0
- package/src/keypair.ts +63 -0
- package/src/routes.gen.ts +78 -0
- package/src/types/index.ts +2 -0
- package/src/types/openapi.gen.ts +3990 -0
- package/src/types/openapi.ts +80 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { components, operations } from './openapi.gen.ts';
|
|
2
|
+
export type IOperationId = keyof operations;
|
|
3
|
+
type RequestBodyContent<T> = T extends {
|
|
4
|
+
content: {
|
|
5
|
+
'application/json': infer R;
|
|
6
|
+
};
|
|
7
|
+
} ? R : T extends {
|
|
8
|
+
content: {
|
|
9
|
+
'application/x-www-form-urlencoded': infer R;
|
|
10
|
+
};
|
|
11
|
+
} ? R : undefined;
|
|
12
|
+
export type IJsonRequestBody<T extends IOperationId> = operations[T] extends {
|
|
13
|
+
requestBody?: infer B;
|
|
14
|
+
} ? RequestBodyContent<B> : undefined;
|
|
15
|
+
type AnySuccess<R> = R extends {
|
|
16
|
+
200: {
|
|
17
|
+
content: {
|
|
18
|
+
'application/json': infer J;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
} ? J : R extends {
|
|
22
|
+
201: {
|
|
23
|
+
content: {
|
|
24
|
+
'application/json': infer J;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
} ? J : R extends {
|
|
28
|
+
204: unknown;
|
|
29
|
+
} ? void : unknown;
|
|
30
|
+
export type IJsonResponseBody<T extends IOperationId> = operations[T] extends {
|
|
31
|
+
responses: infer R;
|
|
32
|
+
} ? AnySuccess<R> : void;
|
|
33
|
+
export type IQuery<T extends IOperationId> = operations[T] extends {
|
|
34
|
+
parameters: {
|
|
35
|
+
query?: infer R;
|
|
36
|
+
};
|
|
37
|
+
} ? Exclude<R, undefined> : undefined;
|
|
38
|
+
export type IParams<T extends IOperationId> = operations[T] extends {
|
|
39
|
+
parameters: {
|
|
40
|
+
path?: infer R;
|
|
41
|
+
};
|
|
42
|
+
} ? Exclude<R, undefined> : undefined;
|
|
43
|
+
export type IHeaders<T extends IOperationId> = operations[T] extends {
|
|
44
|
+
parameters: {
|
|
45
|
+
header?: infer R;
|
|
46
|
+
};
|
|
47
|
+
} ? Exclude<R, undefined> : undefined;
|
|
48
|
+
export type IOperationArgs<T extends IOperationId> = {
|
|
49
|
+
params?: IParams<T> | undefined;
|
|
50
|
+
query?: IQuery<T> | undefined;
|
|
51
|
+
body?: IJsonRequestBody<T> | undefined;
|
|
52
|
+
headers?: IHeaders<T> | undefined;
|
|
53
|
+
} & ([
|
|
54
|
+
IParams<T>
|
|
55
|
+
] extends [undefined] ? unknown : {
|
|
56
|
+
params: IParams<T>;
|
|
57
|
+
}) & ([
|
|
58
|
+
IQuery<T>
|
|
59
|
+
] extends [undefined] ? unknown : {
|
|
60
|
+
query: IQuery<T>;
|
|
61
|
+
}) & ([
|
|
62
|
+
IJsonRequestBody<T>
|
|
63
|
+
] extends [undefined] ? unknown : {
|
|
64
|
+
body: IJsonRequestBody<T>;
|
|
65
|
+
}) & ([
|
|
66
|
+
IHeaders<T>
|
|
67
|
+
] extends [undefined] ? unknown : {
|
|
68
|
+
headers: IHeaders<T>;
|
|
69
|
+
});
|
|
70
|
+
export type IOperationResponse<T extends IOperationId> = IJsonResponseBody<T>;
|
|
71
|
+
export type ProblemDetails = components['schemas']['Problem'] & {
|
|
72
|
+
[key: string]: unknown;
|
|
73
|
+
};
|
|
74
|
+
export {};
|