@unkey/api 2.0.0-alpha.1 → 2.0.0-alpha.2

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 (194) hide show
  1. package/README.md +15 -34
  2. package/dist/commonjs/funcs/livenessCheck.d.ts +1 -1
  3. package/dist/commonjs/funcs/livenessCheck.d.ts.map +1 -1
  4. package/dist/commonjs/funcs/livenessCheck.js +5 -9
  5. package/dist/commonjs/funcs/livenessCheck.js.map +1 -1
  6. package/dist/commonjs/funcs/ratelimitDeleteOverride.d.ts +1 -1
  7. package/dist/commonjs/funcs/ratelimitDeleteOverride.d.ts.map +1 -1
  8. package/dist/commonjs/funcs/ratelimitDeleteOverride.js +5 -13
  9. package/dist/commonjs/funcs/ratelimitDeleteOverride.js.map +1 -1
  10. package/dist/commonjs/funcs/ratelimitGetOverride.d.ts +1 -1
  11. package/dist/commonjs/funcs/ratelimitGetOverride.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/ratelimitGetOverride.js +5 -13
  13. package/dist/commonjs/funcs/ratelimitGetOverride.js.map +1 -1
  14. package/dist/commonjs/funcs/ratelimitLimit.d.ts +1 -1
  15. package/dist/commonjs/funcs/ratelimitLimit.d.ts.map +1 -1
  16. package/dist/commonjs/funcs/ratelimitLimit.js +5 -13
  17. package/dist/commonjs/funcs/ratelimitLimit.js.map +1 -1
  18. package/dist/commonjs/funcs/ratelimitSetOverride.d.ts +1 -1
  19. package/dist/commonjs/funcs/ratelimitSetOverride.d.ts.map +1 -1
  20. package/dist/commonjs/funcs/ratelimitSetOverride.js +5 -13
  21. package/dist/commonjs/funcs/ratelimitSetOverride.js.map +1 -1
  22. package/dist/commonjs/lib/config.d.ts +3 -3
  23. package/dist/commonjs/lib/config.js +3 -3
  24. package/dist/commonjs/lib/matchers.d.ts +1 -1
  25. package/dist/commonjs/lib/matchers.d.ts.map +1 -1
  26. package/dist/commonjs/lib/matchers.js +9 -6
  27. package/dist/commonjs/lib/matchers.js.map +1 -1
  28. package/dist/commonjs/models/components/httpmetadata.d.ts +37 -0
  29. package/dist/commonjs/models/components/httpmetadata.d.ts.map +1 -0
  30. package/dist/commonjs/models/components/httpmetadata.js +86 -0
  31. package/dist/commonjs/models/components/httpmetadata.js.map +1 -0
  32. package/dist/commonjs/models/components/index.d.ts +1 -0
  33. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/index.js +1 -0
  35. package/dist/commonjs/models/components/index.js.map +1 -1
  36. package/dist/commonjs/models/errors/apierror.d.ts +8 -5
  37. package/dist/commonjs/models/errors/apierror.d.ts.map +1 -1
  38. package/dist/commonjs/models/errors/apierror.js +3 -9
  39. package/dist/commonjs/models/errors/apierror.js.map +1 -1
  40. package/dist/{esm/models/errors/notfounderror.d.ts → commonjs/models/errors/baseerror.d.ts} +15 -15
  41. package/dist/commonjs/models/errors/baseerror.d.ts.map +1 -0
  42. package/dist/commonjs/models/errors/{notfounderror.js → baseerror.js} +15 -15
  43. package/dist/commonjs/models/errors/baseerror.js.map +1 -0
  44. package/dist/commonjs/models/errors/index.d.ts +1 -5
  45. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  46. package/dist/commonjs/models/errors/index.js +1 -5
  47. package/dist/commonjs/models/errors/index.js.map +1 -1
  48. package/dist/commonjs/models/operations/liveness.d.ts +2 -15
  49. package/dist/commonjs/models/operations/liveness.d.ts.map +1 -1
  50. package/dist/commonjs/models/operations/liveness.js +4 -14
  51. package/dist/commonjs/models/operations/liveness.js.map +1 -1
  52. package/dist/commonjs/models/operations/ratelimitdeleteoverride.d.ts +2 -15
  53. package/dist/commonjs/models/operations/ratelimitdeleteoverride.d.ts.map +1 -1
  54. package/dist/commonjs/models/operations/ratelimitdeleteoverride.js +4 -14
  55. package/dist/commonjs/models/operations/ratelimitdeleteoverride.js.map +1 -1
  56. package/dist/commonjs/models/operations/ratelimitgetoverride.d.ts +2 -15
  57. package/dist/commonjs/models/operations/ratelimitgetoverride.d.ts.map +1 -1
  58. package/dist/commonjs/models/operations/ratelimitgetoverride.js +4 -14
  59. package/dist/commonjs/models/operations/ratelimitgetoverride.js.map +1 -1
  60. package/dist/commonjs/models/operations/ratelimitsetoverride.d.ts +2 -15
  61. package/dist/commonjs/models/operations/ratelimitsetoverride.d.ts.map +1 -1
  62. package/dist/commonjs/models/operations/ratelimitsetoverride.js +4 -14
  63. package/dist/commonjs/models/operations/ratelimitsetoverride.js.map +1 -1
  64. package/dist/commonjs/models/operations/v1ratelimitlimit.d.ts +2 -15
  65. package/dist/commonjs/models/operations/v1ratelimitlimit.d.ts.map +1 -1
  66. package/dist/commonjs/models/operations/v1ratelimitlimit.js +4 -14
  67. package/dist/commonjs/models/operations/v1ratelimitlimit.js.map +1 -1
  68. package/dist/esm/funcs/livenessCheck.d.ts +1 -1
  69. package/dist/esm/funcs/livenessCheck.d.ts.map +1 -1
  70. package/dist/esm/funcs/livenessCheck.js +5 -9
  71. package/dist/esm/funcs/livenessCheck.js.map +1 -1
  72. package/dist/esm/funcs/ratelimitDeleteOverride.d.ts +1 -1
  73. package/dist/esm/funcs/ratelimitDeleteOverride.d.ts.map +1 -1
  74. package/dist/esm/funcs/ratelimitDeleteOverride.js +5 -13
  75. package/dist/esm/funcs/ratelimitDeleteOverride.js.map +1 -1
  76. package/dist/esm/funcs/ratelimitGetOverride.d.ts +1 -1
  77. package/dist/esm/funcs/ratelimitGetOverride.d.ts.map +1 -1
  78. package/dist/esm/funcs/ratelimitGetOverride.js +5 -13
  79. package/dist/esm/funcs/ratelimitGetOverride.js.map +1 -1
  80. package/dist/esm/funcs/ratelimitLimit.d.ts +1 -1
  81. package/dist/esm/funcs/ratelimitLimit.d.ts.map +1 -1
  82. package/dist/esm/funcs/ratelimitLimit.js +5 -13
  83. package/dist/esm/funcs/ratelimitLimit.js.map +1 -1
  84. package/dist/esm/funcs/ratelimitSetOverride.d.ts +1 -1
  85. package/dist/esm/funcs/ratelimitSetOverride.d.ts.map +1 -1
  86. package/dist/esm/funcs/ratelimitSetOverride.js +5 -13
  87. package/dist/esm/funcs/ratelimitSetOverride.js.map +1 -1
  88. package/dist/esm/lib/config.d.ts +3 -3
  89. package/dist/esm/lib/config.js +3 -3
  90. package/dist/esm/lib/matchers.d.ts +1 -1
  91. package/dist/esm/lib/matchers.d.ts.map +1 -1
  92. package/dist/esm/lib/matchers.js +9 -6
  93. package/dist/esm/lib/matchers.js.map +1 -1
  94. package/dist/esm/models/components/httpmetadata.d.ts +37 -0
  95. package/dist/esm/models/components/httpmetadata.d.ts.map +1 -0
  96. package/dist/esm/models/components/httpmetadata.js +48 -0
  97. package/dist/esm/models/components/httpmetadata.js.map +1 -0
  98. package/dist/esm/models/components/index.d.ts +1 -0
  99. package/dist/esm/models/components/index.d.ts.map +1 -1
  100. package/dist/esm/models/components/index.js +1 -0
  101. package/dist/esm/models/components/index.js.map +1 -1
  102. package/dist/esm/models/errors/apierror.d.ts +8 -5
  103. package/dist/esm/models/errors/apierror.d.ts.map +1 -1
  104. package/dist/esm/models/errors/apierror.js +3 -9
  105. package/dist/esm/models/errors/apierror.js.map +1 -1
  106. package/dist/{commonjs/models/errors/notfounderror.d.ts → esm/models/errors/baseerror.d.ts} +15 -15
  107. package/dist/esm/models/errors/baseerror.d.ts.map +1 -0
  108. package/dist/esm/models/errors/{notfounderror.js → baseerror.js} +13 -13
  109. package/dist/esm/models/errors/baseerror.js.map +1 -0
  110. package/dist/esm/models/errors/index.d.ts +1 -5
  111. package/dist/esm/models/errors/index.d.ts.map +1 -1
  112. package/dist/esm/models/errors/index.js +1 -5
  113. package/dist/esm/models/errors/index.js.map +1 -1
  114. package/dist/esm/models/operations/liveness.d.ts +2 -15
  115. package/dist/esm/models/operations/liveness.d.ts.map +1 -1
  116. package/dist/esm/models/operations/liveness.js +4 -14
  117. package/dist/esm/models/operations/liveness.js.map +1 -1
  118. package/dist/esm/models/operations/ratelimitdeleteoverride.d.ts +2 -15
  119. package/dist/esm/models/operations/ratelimitdeleteoverride.d.ts.map +1 -1
  120. package/dist/esm/models/operations/ratelimitdeleteoverride.js +4 -14
  121. package/dist/esm/models/operations/ratelimitdeleteoverride.js.map +1 -1
  122. package/dist/esm/models/operations/ratelimitgetoverride.d.ts +2 -15
  123. package/dist/esm/models/operations/ratelimitgetoverride.d.ts.map +1 -1
  124. package/dist/esm/models/operations/ratelimitgetoverride.js +4 -14
  125. package/dist/esm/models/operations/ratelimitgetoverride.js.map +1 -1
  126. package/dist/esm/models/operations/ratelimitsetoverride.d.ts +2 -15
  127. package/dist/esm/models/operations/ratelimitsetoverride.d.ts.map +1 -1
  128. package/dist/esm/models/operations/ratelimitsetoverride.js +4 -14
  129. package/dist/esm/models/operations/ratelimitsetoverride.js.map +1 -1
  130. package/dist/esm/models/operations/v1ratelimitlimit.d.ts +2 -15
  131. package/dist/esm/models/operations/v1ratelimitlimit.d.ts.map +1 -1
  132. package/dist/esm/models/operations/v1ratelimitlimit.js +4 -14
  133. package/dist/esm/models/operations/v1ratelimitlimit.js.map +1 -1
  134. package/docs/sdks/liveness/README.md +5 -5
  135. package/docs/sdks/ratelimit/README.md +24 -32
  136. package/jsr.json +1 -1
  137. package/package.json +1 -1
  138. package/src/funcs/livenessCheck.ts +11 -15
  139. package/src/funcs/ratelimitDeleteOverride.ts +11 -27
  140. package/src/funcs/ratelimitGetOverride.ts +11 -27
  141. package/src/funcs/ratelimitLimit.ts +11 -27
  142. package/src/funcs/ratelimitSetOverride.ts +11 -27
  143. package/src/lib/config.ts +3 -3
  144. package/src/lib/matchers.ts +9 -12
  145. package/src/models/components/httpmetadata.ts +87 -0
  146. package/src/models/components/index.ts +1 -0
  147. package/src/models/errors/apierror.ts +7 -13
  148. package/src/models/errors/{notfounderror.ts → baseerror.ts} +20 -20
  149. package/src/models/errors/index.ts +1 -5
  150. package/src/models/operations/liveness.ts +6 -29
  151. package/src/models/operations/ratelimitdeleteoverride.ts +6 -29
  152. package/src/models/operations/ratelimitgetoverride.ts +6 -29
  153. package/src/models/operations/ratelimitsetoverride.ts +6 -29
  154. package/src/models/operations/v1ratelimitlimit.ts +6 -29
  155. package/dist/commonjs/models/errors/forbiddenerror.d.ts +0 -82
  156. package/dist/commonjs/models/errors/forbiddenerror.d.ts.map +0 -1
  157. package/dist/commonjs/models/errors/forbiddenerror.js +0 -93
  158. package/dist/commonjs/models/errors/forbiddenerror.js.map +0 -1
  159. package/dist/commonjs/models/errors/internalservererror.d.ts +0 -82
  160. package/dist/commonjs/models/errors/internalservererror.d.ts.map +0 -1
  161. package/dist/commonjs/models/errors/internalservererror.js +0 -93
  162. package/dist/commonjs/models/errors/internalservererror.js.map +0 -1
  163. package/dist/commonjs/models/errors/notfounderror.d.ts.map +0 -1
  164. package/dist/commonjs/models/errors/notfounderror.js.map +0 -1
  165. package/dist/commonjs/models/errors/preconditionfailederror.d.ts +0 -82
  166. package/dist/commonjs/models/errors/preconditionfailederror.d.ts.map +0 -1
  167. package/dist/commonjs/models/errors/preconditionfailederror.js +0 -93
  168. package/dist/commonjs/models/errors/preconditionfailederror.js.map +0 -1
  169. package/dist/commonjs/models/errors/unauthorizederror.d.ts +0 -82
  170. package/dist/commonjs/models/errors/unauthorizederror.d.ts.map +0 -1
  171. package/dist/commonjs/models/errors/unauthorizederror.js +0 -93
  172. package/dist/commonjs/models/errors/unauthorizederror.js.map +0 -1
  173. package/dist/esm/models/errors/forbiddenerror.d.ts +0 -82
  174. package/dist/esm/models/errors/forbiddenerror.d.ts.map +0 -1
  175. package/dist/esm/models/errors/forbiddenerror.js +0 -56
  176. package/dist/esm/models/errors/forbiddenerror.js.map +0 -1
  177. package/dist/esm/models/errors/internalservererror.d.ts +0 -82
  178. package/dist/esm/models/errors/internalservererror.d.ts.map +0 -1
  179. package/dist/esm/models/errors/internalservererror.js +0 -56
  180. package/dist/esm/models/errors/internalservererror.js.map +0 -1
  181. package/dist/esm/models/errors/notfounderror.d.ts.map +0 -1
  182. package/dist/esm/models/errors/notfounderror.js.map +0 -1
  183. package/dist/esm/models/errors/preconditionfailederror.d.ts +0 -82
  184. package/dist/esm/models/errors/preconditionfailederror.d.ts.map +0 -1
  185. package/dist/esm/models/errors/preconditionfailederror.js +0 -56
  186. package/dist/esm/models/errors/preconditionfailederror.js.map +0 -1
  187. package/dist/esm/models/errors/unauthorizederror.d.ts +0 -82
  188. package/dist/esm/models/errors/unauthorizederror.d.ts.map +0 -1
  189. package/dist/esm/models/errors/unauthorizederror.js +0 -56
  190. package/dist/esm/models/errors/unauthorizederror.js.map +0 -1
  191. package/src/models/errors/forbiddenerror.ts +0 -135
  192. package/src/models/errors/internalservererror.ts +0 -135
  193. package/src/models/errors/preconditionfailederror.ts +0 -135
  194. package/src/models/errors/unauthorizederror.ts +0 -135
@@ -1,135 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
-
7
- export type InternalServerErrorData = {
8
- /**
9
- * A unique id for this request. Please always provide this to support.
10
- */
11
- requestId: string;
12
- /**
13
- * A human-readable explanation specific to this occurrence of the problem.
14
- */
15
- detail: string;
16
- /**
17
- * A URI reference that identifies the specific occurrence of the problem.
18
- */
19
- instance?: string | undefined;
20
- /**
21
- * HTTP status code
22
- */
23
- status: number;
24
- /**
25
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
26
- */
27
- title: string;
28
- /**
29
- * A URI reference to human-readable documentation for the error.
30
- */
31
- type: string;
32
- };
33
-
34
- export class InternalServerError extends Error {
35
- /**
36
- * A unique id for this request. Please always provide this to support.
37
- */
38
- requestId: string;
39
- /**
40
- * A human-readable explanation specific to this occurrence of the problem.
41
- */
42
- detail: string;
43
- /**
44
- * A URI reference that identifies the specific occurrence of the problem.
45
- */
46
- instance?: string | undefined;
47
- /**
48
- * HTTP status code
49
- */
50
- status: number;
51
- /**
52
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
53
- */
54
- title: string;
55
- /**
56
- * A URI reference to human-readable documentation for the error.
57
- */
58
- type: string;
59
-
60
- /** The original data that was passed to this error instance. */
61
- data$: InternalServerErrorData;
62
-
63
- constructor(err: InternalServerErrorData) {
64
- const message = "message" in err && typeof err.message === "string"
65
- ? err.message
66
- : `API error occurred: ${JSON.stringify(err)}`;
67
- super(message);
68
- this.data$ = err;
69
-
70
- this.requestId = err.requestId;
71
- this.detail = err.detail;
72
- if (err.instance != null) this.instance = err.instance;
73
- this.status = err.status;
74
- this.title = err.title;
75
- this.type = err.type;
76
-
77
- this.name = "InternalServerError";
78
- }
79
- }
80
-
81
- /** @internal */
82
- export const InternalServerError$inboundSchema: z.ZodType<
83
- InternalServerError,
84
- z.ZodTypeDef,
85
- unknown
86
- > = z.object({
87
- requestId: z.string(),
88
- detail: z.string(),
89
- instance: z.string().optional(),
90
- status: z.number().int(),
91
- title: z.string(),
92
- type: z.string(),
93
- })
94
- .transform((v) => {
95
- return new InternalServerError(v);
96
- });
97
-
98
- /** @internal */
99
- export type InternalServerError$Outbound = {
100
- requestId: string;
101
- detail: string;
102
- instance?: string | undefined;
103
- status: number;
104
- title: string;
105
- type: string;
106
- };
107
-
108
- /** @internal */
109
- export const InternalServerError$outboundSchema: z.ZodType<
110
- InternalServerError$Outbound,
111
- z.ZodTypeDef,
112
- InternalServerError
113
- > = z.instanceof(InternalServerError)
114
- .transform(v => v.data$)
115
- .pipe(z.object({
116
- requestId: z.string(),
117
- detail: z.string(),
118
- instance: z.string().optional(),
119
- status: z.number().int(),
120
- title: z.string(),
121
- type: z.string(),
122
- }));
123
-
124
- /**
125
- * @internal
126
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
127
- */
128
- export namespace InternalServerError$ {
129
- /** @deprecated use `InternalServerError$inboundSchema` instead. */
130
- export const inboundSchema = InternalServerError$inboundSchema;
131
- /** @deprecated use `InternalServerError$outboundSchema` instead. */
132
- export const outboundSchema = InternalServerError$outboundSchema;
133
- /** @deprecated use `InternalServerError$Outbound` instead. */
134
- export type Outbound = InternalServerError$Outbound;
135
- }
@@ -1,135 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
-
7
- export type PreconditionFailedErrorData = {
8
- /**
9
- * A unique id for this request. Please always provide this to support.
10
- */
11
- requestId: string;
12
- /**
13
- * A human-readable explanation specific to this occurrence of the problem.
14
- */
15
- detail: string;
16
- /**
17
- * A URI reference that identifies the specific occurrence of the problem.
18
- */
19
- instance?: string | undefined;
20
- /**
21
- * HTTP status code
22
- */
23
- status: number;
24
- /**
25
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
26
- */
27
- title: string;
28
- /**
29
- * A URI reference to human-readable documentation for the error.
30
- */
31
- type: string;
32
- };
33
-
34
- export class PreconditionFailedError extends Error {
35
- /**
36
- * A unique id for this request. Please always provide this to support.
37
- */
38
- requestId: string;
39
- /**
40
- * A human-readable explanation specific to this occurrence of the problem.
41
- */
42
- detail: string;
43
- /**
44
- * A URI reference that identifies the specific occurrence of the problem.
45
- */
46
- instance?: string | undefined;
47
- /**
48
- * HTTP status code
49
- */
50
- status: number;
51
- /**
52
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
53
- */
54
- title: string;
55
- /**
56
- * A URI reference to human-readable documentation for the error.
57
- */
58
- type: string;
59
-
60
- /** The original data that was passed to this error instance. */
61
- data$: PreconditionFailedErrorData;
62
-
63
- constructor(err: PreconditionFailedErrorData) {
64
- const message = "message" in err && typeof err.message === "string"
65
- ? err.message
66
- : `API error occurred: ${JSON.stringify(err)}`;
67
- super(message);
68
- this.data$ = err;
69
-
70
- this.requestId = err.requestId;
71
- this.detail = err.detail;
72
- if (err.instance != null) this.instance = err.instance;
73
- this.status = err.status;
74
- this.title = err.title;
75
- this.type = err.type;
76
-
77
- this.name = "PreconditionFailedError";
78
- }
79
- }
80
-
81
- /** @internal */
82
- export const PreconditionFailedError$inboundSchema: z.ZodType<
83
- PreconditionFailedError,
84
- z.ZodTypeDef,
85
- unknown
86
- > = z.object({
87
- requestId: z.string(),
88
- detail: z.string(),
89
- instance: z.string().optional(),
90
- status: z.number().int(),
91
- title: z.string(),
92
- type: z.string(),
93
- })
94
- .transform((v) => {
95
- return new PreconditionFailedError(v);
96
- });
97
-
98
- /** @internal */
99
- export type PreconditionFailedError$Outbound = {
100
- requestId: string;
101
- detail: string;
102
- instance?: string | undefined;
103
- status: number;
104
- title: string;
105
- type: string;
106
- };
107
-
108
- /** @internal */
109
- export const PreconditionFailedError$outboundSchema: z.ZodType<
110
- PreconditionFailedError$Outbound,
111
- z.ZodTypeDef,
112
- PreconditionFailedError
113
- > = z.instanceof(PreconditionFailedError)
114
- .transform(v => v.data$)
115
- .pipe(z.object({
116
- requestId: z.string(),
117
- detail: z.string(),
118
- instance: z.string().optional(),
119
- status: z.number().int(),
120
- title: z.string(),
121
- type: z.string(),
122
- }));
123
-
124
- /**
125
- * @internal
126
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
127
- */
128
- export namespace PreconditionFailedError$ {
129
- /** @deprecated use `PreconditionFailedError$inboundSchema` instead. */
130
- export const inboundSchema = PreconditionFailedError$inboundSchema;
131
- /** @deprecated use `PreconditionFailedError$outboundSchema` instead. */
132
- export const outboundSchema = PreconditionFailedError$outboundSchema;
133
- /** @deprecated use `PreconditionFailedError$Outbound` instead. */
134
- export type Outbound = PreconditionFailedError$Outbound;
135
- }
@@ -1,135 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
-
7
- export type UnauthorizedErrorData = {
8
- /**
9
- * A unique id for this request. Please always provide this to support.
10
- */
11
- requestId: string;
12
- /**
13
- * A human-readable explanation specific to this occurrence of the problem.
14
- */
15
- detail: string;
16
- /**
17
- * A URI reference that identifies the specific occurrence of the problem.
18
- */
19
- instance?: string | undefined;
20
- /**
21
- * HTTP status code
22
- */
23
- status: number;
24
- /**
25
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
26
- */
27
- title: string;
28
- /**
29
- * A URI reference to human-readable documentation for the error.
30
- */
31
- type: string;
32
- };
33
-
34
- export class UnauthorizedError extends Error {
35
- /**
36
- * A unique id for this request. Please always provide this to support.
37
- */
38
- requestId: string;
39
- /**
40
- * A human-readable explanation specific to this occurrence of the problem.
41
- */
42
- detail: string;
43
- /**
44
- * A URI reference that identifies the specific occurrence of the problem.
45
- */
46
- instance?: string | undefined;
47
- /**
48
- * HTTP status code
49
- */
50
- status: number;
51
- /**
52
- * A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
53
- */
54
- title: string;
55
- /**
56
- * A URI reference to human-readable documentation for the error.
57
- */
58
- type: string;
59
-
60
- /** The original data that was passed to this error instance. */
61
- data$: UnauthorizedErrorData;
62
-
63
- constructor(err: UnauthorizedErrorData) {
64
- const message = "message" in err && typeof err.message === "string"
65
- ? err.message
66
- : `API error occurred: ${JSON.stringify(err)}`;
67
- super(message);
68
- this.data$ = err;
69
-
70
- this.requestId = err.requestId;
71
- this.detail = err.detail;
72
- if (err.instance != null) this.instance = err.instance;
73
- this.status = err.status;
74
- this.title = err.title;
75
- this.type = err.type;
76
-
77
- this.name = "UnauthorizedError";
78
- }
79
- }
80
-
81
- /** @internal */
82
- export const UnauthorizedError$inboundSchema: z.ZodType<
83
- UnauthorizedError,
84
- z.ZodTypeDef,
85
- unknown
86
- > = z.object({
87
- requestId: z.string(),
88
- detail: z.string(),
89
- instance: z.string().optional(),
90
- status: z.number().int(),
91
- title: z.string(),
92
- type: z.string(),
93
- })
94
- .transform((v) => {
95
- return new UnauthorizedError(v);
96
- });
97
-
98
- /** @internal */
99
- export type UnauthorizedError$Outbound = {
100
- requestId: string;
101
- detail: string;
102
- instance?: string | undefined;
103
- status: number;
104
- title: string;
105
- type: string;
106
- };
107
-
108
- /** @internal */
109
- export const UnauthorizedError$outboundSchema: z.ZodType<
110
- UnauthorizedError$Outbound,
111
- z.ZodTypeDef,
112
- UnauthorizedError
113
- > = z.instanceof(UnauthorizedError)
114
- .transform(v => v.data$)
115
- .pipe(z.object({
116
- requestId: z.string(),
117
- detail: z.string(),
118
- instance: z.string().optional(),
119
- status: z.number().int(),
120
- title: z.string(),
121
- type: z.string(),
122
- }));
123
-
124
- /**
125
- * @internal
126
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
127
- */
128
- export namespace UnauthorizedError$ {
129
- /** @deprecated use `UnauthorizedError$inboundSchema` instead. */
130
- export const inboundSchema = UnauthorizedError$inboundSchema;
131
- /** @deprecated use `UnauthorizedError$outboundSchema` instead. */
132
- export const outboundSchema = UnauthorizedError$outboundSchema;
133
- /** @deprecated use `UnauthorizedError$Outbound` instead. */
134
- export type Outbound = UnauthorizedError$Outbound;
135
- }