@api7/portal-sdk 1.0.0 → 1.1.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.
@@ -1,114 +1,105 @@
1
- import X from "axios";
2
- const Y = ({
1
+ import Y from "axios";
2
+ const Z = ({
3
3
  onRequest: e,
4
4
  onSseError: t,
5
5
  onSseEvent: r,
6
6
  responseTransformer: s,
7
7
  responseValidator: i,
8
8
  sseDefaultRetryDelay: l,
9
- sseMaxRetryAttempts: c,
9
+ sseMaxRetryAttempts: a,
10
10
  sseMaxRetryDelay: n,
11
11
  sseSleepFn: o,
12
- url: d,
13
- ...a
12
+ url: h,
13
+ ...d
14
14
  }) => {
15
- let h;
16
- const m = o ?? ((b) => new Promise((y) => setTimeout(y, b)));
15
+ let c;
16
+ const f = o ?? ((T) => new Promise((m) => setTimeout(m, T)));
17
17
  return { stream: async function* () {
18
- let b = l ?? 3e3, y = 0;
19
- const S = a.signal ?? new AbortController().signal;
20
- for (; !S.aborted; ) {
21
- y++;
22
- const k = a.headers instanceof Headers ? a.headers : new Headers(a.headers);
23
- h !== void 0 && k.set("Last-Event-ID", h);
18
+ let T = l ?? 3e3, m = 0;
19
+ const b = d.signal ?? new AbortController().signal;
20
+ for (; !b.aborted; ) {
21
+ m++;
22
+ const k = d.headers instanceof Headers ? d.headers : new Headers(d.headers);
23
+ c !== void 0 && k.set("Last-Event-ID", c);
24
24
  try {
25
- const j = {
25
+ const v = {
26
26
  redirect: "follow",
27
- ...a,
28
- body: a.serializedBody,
27
+ ...d,
28
+ body: d.serializedBody,
29
29
  headers: k,
30
- signal: S
30
+ signal: b
31
31
  };
32
- let v = new Request(d, j);
33
- e && (v = await e(d, j));
34
- const _ = await (a.fetch ?? globalThis.fetch)(v);
35
- if (!_.ok)
36
- throw new Error(
37
- `SSE failed: ${_.status} ${_.statusText}`
38
- );
39
- if (!_.body) throw new Error("No body in SSE response");
40
- const D = _.body.pipeThrough(new TextDecoderStream()).getReader();
41
- let C = "";
32
+ let R = new Request(h, v);
33
+ e && (R = await e(h, v));
34
+ const S = await (d.fetch ?? globalThis.fetch)(R);
35
+ if (!S.ok) throw new Error(`SSE failed: ${S.status} ${S.statusText}`);
36
+ if (!S.body) throw new Error("No body in SSE response");
37
+ const D = S.body.pipeThrough(new TextDecoderStream()).getReader();
38
+ let j = "";
42
39
  const I = () => {
43
40
  try {
44
41
  D.cancel();
45
42
  } catch {
46
43
  }
47
44
  };
48
- S.addEventListener("abort", I);
45
+ b.addEventListener("abort", I);
49
46
  try {
50
47
  for (; ; ) {
51
- const { done: J, value: G } = await D.read();
52
- if (J) break;
53
- C += G, C = C.replace(/\r\n/g, `
48
+ const { done: G, value: K } = await D.read();
49
+ if (G) break;
50
+ j += K, j = j.replace(/\r\n/g, `
54
51
  `).replace(/\r/g, `
55
52
  `);
56
- const O = C.split(`
53
+ const O = j.split(`
57
54
 
58
55
  `);
59
- C = O.pop() ?? "";
60
- for (const K of O) {
61
- const Q = K.split(`
62
- `), R = [];
63
- let q;
64
- for (const f of Q)
65
- if (f.startsWith("data:"))
66
- R.push(f.replace(/^data:\s*/, ""));
67
- else if (f.startsWith("event:"))
68
- q = f.replace(/^event:\s*/, "");
69
- else if (f.startsWith("id:"))
70
- h = f.replace(/^id:\s*/, "");
71
- else if (f.startsWith("retry:")) {
72
- const B = Number.parseInt(
73
- f.replace(/^retry:\s*/, ""),
74
- 10
75
- );
76
- Number.isNaN(B) || (b = B);
56
+ j = O.pop() ?? "";
57
+ for (const Q of O) {
58
+ const X = Q.split(`
59
+ `), E = [];
60
+ let U;
61
+ for (const y of X)
62
+ if (y.startsWith("data:"))
63
+ E.push(y.replace(/^data:\s*/, ""));
64
+ else if (y.startsWith("event:"))
65
+ U = y.replace(/^event:\s*/, "");
66
+ else if (y.startsWith("id:"))
67
+ c = y.replace(/^id:\s*/, "");
68
+ else if (y.startsWith("retry:")) {
69
+ const B = Number.parseInt(y.replace(/^retry:\s*/, ""), 10);
70
+ Number.isNaN(B) || (T = B);
77
71
  }
78
- let T, U = !1;
79
- if (R.length) {
80
- const f = R.join(`
72
+ let g, q = !1;
73
+ if (E.length) {
74
+ const y = E.join(`
81
75
  `);
82
76
  try {
83
- T = JSON.parse(f), U = !0;
77
+ g = JSON.parse(y), q = !0;
84
78
  } catch {
85
- T = f;
79
+ g = y;
86
80
  }
87
81
  }
88
- U && (i && await i(T), s && (T = await s(T))), r?.({
89
- data: T,
90
- event: q,
91
- id: h,
92
- retry: b
93
- }), R.length && (yield T);
82
+ q && (i && await i(g), s && (g = await s(g))), r?.({
83
+ data: g,
84
+ event: U,
85
+ id: c,
86
+ retry: T
87
+ }), E.length && (yield g);
94
88
  }
95
89
  }
96
90
  } finally {
97
- S.removeEventListener("abort", I), D.releaseLock();
91
+ b.removeEventListener("abort", I), D.releaseLock();
98
92
  }
99
93
  break;
100
- } catch (j) {
101
- if (t?.(j), c !== void 0 && y >= c)
94
+ } catch (v) {
95
+ if (t?.(v), a !== void 0 && m >= a)
102
96
  break;
103
- const v = Math.min(
104
- b * 2 ** (y - 1),
105
- n ?? 3e4
106
- );
107
- await m(v);
97
+ const R = Math.min(T * 2 ** (m - 1), n ?? 3e4);
98
+ await f(R);
108
99
  }
109
100
  }
110
101
  }() };
111
- }, Z = (e) => {
102
+ }, ee = (e) => {
112
103
  switch (e) {
113
104
  case "label":
114
105
  return ".";
@@ -119,7 +110,7 @@ const Y = ({
119
110
  default:
120
111
  return "&";
121
112
  }
122
- }, ee = (e) => {
113
+ }, te = (e) => {
123
114
  switch (e) {
124
115
  case "form":
125
116
  return ",";
@@ -130,7 +121,7 @@ const Y = ({
130
121
  default:
131
122
  return ",";
132
123
  }
133
- }, te = (e) => {
124
+ }, re = (e) => {
134
125
  switch (e) {
135
126
  case "label":
136
127
  return ".";
@@ -141,7 +132,7 @@ const Y = ({
141
132
  default:
142
133
  return "&";
143
134
  }
144
- }, W = ({
135
+ }, H = ({
145
136
  allowReserved: e,
146
137
  explode: t,
147
138
  name: r,
@@ -149,7 +140,7 @@ const Y = ({
149
140
  value: i
150
141
  }) => {
151
142
  if (!t) {
152
- const n = (e ? i : i.map((o) => encodeURIComponent(o))).join(ee(s));
143
+ const n = (e ? i : i.map((o) => encodeURIComponent(o))).join(te(s));
153
144
  switch (s) {
154
145
  case "label":
155
146
  return `.${n}`;
@@ -161,13 +152,13 @@ const Y = ({
161
152
  return `${r}=${n}`;
162
153
  }
163
154
  }
164
- const l = Z(s), c = i.map((n) => s === "label" || s === "simple" ? e ? n : encodeURIComponent(n) : P({
155
+ const l = ee(s), a = i.map((n) => s === "label" || s === "simple" ? e ? n : encodeURIComponent(n) : x({
165
156
  allowReserved: e,
166
157
  name: r,
167
158
  value: n
168
159
  })).join(l);
169
- return s === "label" || s === "matrix" ? l + c : c;
170
- }, P = ({
160
+ return s === "label" || s === "matrix" ? l + a : a;
161
+ }, x = ({
171
162
  allowReserved: e,
172
163
  name: t,
173
164
  value: r
@@ -179,7 +170,7 @@ const Y = ({
179
170
  "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
180
171
  );
181
172
  return `${t}=${e ? r : encodeURIComponent(r)}`;
182
- }, H = ({
173
+ }, V = ({
183
174
  allowReserved: e,
184
175
  explode: t,
185
176
  name: r,
@@ -191,56 +182,49 @@ const Y = ({
191
182
  return l ? i.toISOString() : `${r}=${i.toISOString()}`;
192
183
  if (s !== "deepObject" && !t) {
193
184
  let o = [];
194
- Object.entries(i).forEach(([a, h]) => {
195
- o = [
196
- ...o,
197
- a,
198
- e ? h : encodeURIComponent(h)
199
- ];
185
+ Object.entries(i).forEach(([d, c]) => {
186
+ o = [...o, d, e ? c : encodeURIComponent(c)];
200
187
  });
201
- const d = o.join(",");
188
+ const h = o.join(",");
202
189
  switch (s) {
203
190
  case "form":
204
- return `${r}=${d}`;
191
+ return `${r}=${h}`;
205
192
  case "label":
206
- return `.${d}`;
193
+ return `.${h}`;
207
194
  case "matrix":
208
- return `;${r}=${d}`;
195
+ return `;${r}=${h}`;
209
196
  default:
210
- return d;
197
+ return h;
211
198
  }
212
199
  }
213
- const c = te(s), n = Object.entries(i).map(
214
- ([o, d]) => P({
200
+ const a = re(s), n = Object.entries(i).map(
201
+ ([o, h]) => x({
215
202
  allowReserved: e,
216
203
  name: s === "deepObject" ? `${r}[${o}]` : o,
217
- value: d
204
+ value: h
218
205
  })
219
- ).join(c);
220
- return s === "label" || s === "matrix" ? c + n : n;
221
- }, re = /\{[^{}]+\}/g, se = ({ path: e, url: t }) => {
206
+ ).join(a);
207
+ return s === "label" || s === "matrix" ? a + n : n;
208
+ }, se = /\{[^{}]+\}/g, ie = ({ path: e, url: t }) => {
222
209
  let r = t;
223
- const s = t.match(re);
210
+ const s = t.match(se);
224
211
  if (s)
225
212
  for (const i of s) {
226
- let l = !1, c = i.substring(1, i.length - 1), n = "simple";
227
- c.endsWith("*") && (l = !0, c = c.substring(0, c.length - 1)), c.startsWith(".") ? (c = c.substring(1), n = "label") : c.startsWith(";") && (c = c.substring(1), n = "matrix");
228
- const o = e[c];
213
+ let l = !1, a = i.substring(1, i.length - 1), n = "simple";
214
+ a.endsWith("*") && (l = !0, a = a.substring(0, a.length - 1)), a.startsWith(".") ? (a = a.substring(1), n = "label") : a.startsWith(";") && (a = a.substring(1), n = "matrix");
215
+ const o = e[a];
229
216
  if (o == null)
230
217
  continue;
231
218
  if (Array.isArray(o)) {
232
- r = r.replace(
233
- i,
234
- W({ explode: l, name: c, style: n, value: o })
235
- );
219
+ r = r.replace(i, H({ explode: l, name: a, style: n, value: o }));
236
220
  continue;
237
221
  }
238
222
  if (typeof o == "object") {
239
223
  r = r.replace(
240
224
  i,
241
- H({
225
+ V({
242
226
  explode: l,
243
- name: c,
227
+ name: a,
244
228
  style: n,
245
229
  value: o,
246
230
  valueOnly: !0
@@ -251,20 +235,20 @@ const Y = ({
251
235
  if (n === "matrix") {
252
236
  r = r.replace(
253
237
  i,
254
- `;${P({
255
- name: c,
238
+ `;${x({
239
+ name: a,
256
240
  value: o
257
241
  })}`
258
242
  );
259
243
  continue;
260
244
  }
261
- const d = encodeURIComponent(
245
+ const h = encodeURIComponent(
262
246
  n === "label" ? `.${o}` : o
263
247
  );
264
- r = r.replace(i, d);
248
+ r = r.replace(i, h);
265
249
  }
266
250
  return r;
267
- }, ie = ({
251
+ }, ne = ({
268
252
  baseUrl: e,
269
253
  path: t,
270
254
  query: r,
@@ -272,12 +256,12 @@ const Y = ({
272
256
  url: i
273
257
  }) => {
274
258
  const l = i.startsWith("/") ? i : `/${i}`;
275
- let c = (e ?? "") + l;
276
- t && (c = se({ path: t, url: c }));
259
+ let a = (e ?? "") + l;
260
+ t && (a = ie({ path: t, url: a }));
277
261
  let n = r ? s(r) : "";
278
- return n.startsWith("?") && (n = n.substring(1)), n && (c += `?${n}`), c;
262
+ return n.startsWith("?") && (n = n.substring(1)), n && (a += `?${n}`), a;
279
263
  };
280
- function ne(e) {
264
+ function N(e) {
281
265
  const t = e.body !== void 0;
282
266
  if (t && e.bodySerializer)
283
267
  return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body !== "" ? e.body : null;
@@ -295,35 +279,35 @@ const ae = async (e, t) => {
295
279
  const i = [];
296
280
  if (s && typeof s == "object")
297
281
  for (const l in s) {
298
- const c = s[l];
299
- if (c == null)
282
+ const a = s[l];
283
+ if (a == null)
300
284
  continue;
301
285
  const n = e[l] || t;
302
- if (Array.isArray(c)) {
303
- const o = W({
286
+ if (Array.isArray(a)) {
287
+ const o = H({
304
288
  allowReserved: n.allowReserved,
305
289
  explode: !0,
306
290
  name: l,
307
291
  style: "form",
308
- value: c,
292
+ value: a,
309
293
  ...n.array
310
294
  });
311
295
  o && i.push(o);
312
- } else if (typeof c == "object") {
313
- const o = H({
296
+ } else if (typeof a == "object") {
297
+ const o = V({
314
298
  allowReserved: n.allowReserved,
315
299
  explode: !0,
316
300
  name: l,
317
301
  style: "deepObject",
318
- value: c,
302
+ value: a,
319
303
  ...n.object
320
304
  });
321
305
  o && i.push(o);
322
306
  } else {
323
- const o = P({
307
+ const o = x({
324
308
  allowReserved: n.allowReserved,
325
309
  name: l,
326
- value: c
310
+ value: a
327
311
  });
328
312
  o && i.push(o);
329
313
  }
@@ -355,9 +339,9 @@ const ae = async (e, t) => {
355
339
  break;
356
340
  }
357
341
  }
358
- }, N = (e) => {
342
+ }, L = (e) => {
359
343
  const t = e.axios?.defaults?.baseURL, r = e.baseURL && typeof e.baseURL == "string" ? e.baseURL : t;
360
- return ie({
344
+ return ne({
361
345
  baseUrl: r,
362
346
  path: e.path,
363
347
  // let `paramsSerializer()` handle query params if it exists
@@ -365,7 +349,7 @@ const ae = async (e, t) => {
365
349
  querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : ce(e.querySerializer),
366
350
  url: e.url
367
351
  });
368
- }, L = (e, t) => {
352
+ }, W = (e, t) => {
369
353
  const r = { ...e, ...t };
370
354
  return r.headers = $(e.headers, t.headers), r;
371
355
  }, pe = [
@@ -383,9 +367,7 @@ const ae = async (e, t) => {
383
367
  continue;
384
368
  const s = Object.entries(r);
385
369
  for (const [i, l] of s)
386
- if (pe.includes(
387
- i
388
- ) && typeof l == "object")
370
+ if (pe.includes(i) && typeof l == "object")
389
371
  t[i] = {
390
372
  ...t[i],
391
373
  ...l
@@ -393,77 +375,78 @@ const ae = async (e, t) => {
393
375
  else if (l === null)
394
376
  delete t[i];
395
377
  else if (Array.isArray(l))
396
- for (const c of l)
397
- t[i] = [...t[i] ?? [], c];
378
+ for (const a of l)
379
+ t[i] = [...t[i] ?? [], a];
398
380
  else l !== void 0 && (t[i] = typeof l == "object" ? JSON.stringify(l) : l);
399
381
  }
400
382
  return t;
401
- }, V = (e = {}) => ({
383
+ }, M = (e = {}) => ({
402
384
  ...e
403
385
  }), ue = (e = {}) => {
404
- let t = L(V(), e), r;
386
+ let t = W(M(), e), r;
405
387
  if (t.axios && !("Axios" in t.axios))
406
388
  r = t.axios;
407
389
  else {
408
- const { auth: d, ...a } = t;
409
- r = X.create(a);
390
+ const { auth: d, ...c } = t;
391
+ r = Y.create(c);
410
392
  }
411
- const s = () => ({ ...t }), i = (d) => (t = L(t, d), r.defaults = {
393
+ const s = () => ({ ...t }), i = (d) => (t = W(t, d), r.defaults = {
412
394
  ...r.defaults,
413
395
  ...t,
414
396
  // @ts-expect-error
415
397
  headers: $(r.defaults.headers, t.headers)
416
398
  }, s()), l = async (d) => {
417
- const a = {
399
+ const c = {
418
400
  ...t,
419
401
  ...d,
420
402
  axios: d.axios ?? t.axios ?? r,
421
403
  headers: $(t.headers, d.headers)
422
404
  };
423
- a.security && await le({
424
- ...a,
425
- security: a.security
426
- }), a.requestValidator && await a.requestValidator(a), a.body !== void 0 && a.bodySerializer && (a.body = a.bodySerializer(a.body));
427
- const h = N(a);
428
- return { opts: a, url: h };
429
- }, c = async (d) => {
430
- const { opts: a, url: h } = await l(d);
405
+ c.security && await le({
406
+ ...c,
407
+ security: c.security
408
+ }), c.requestValidator && await c.requestValidator(c), c.body !== void 0 && c.bodySerializer && (c.body = c.bodySerializer(c.body));
409
+ const f = L(c);
410
+ return { opts: c, url: f };
411
+ }, a = async (d) => {
412
+ const { opts: c, url: f } = await l(d);
431
413
  try {
432
- const m = a.axios, { auth: g, ...z } = a, b = await m({
433
- ...z,
414
+ const w = c.axios, { auth: _, ...T } = c, m = await w({
415
+ ...T,
434
416
  baseURL: "",
435
417
  // the baseURL is already included in `url`
436
- data: ne(a),
437
- headers: a.headers,
418
+ data: N(c),
419
+ headers: c.headers,
438
420
  // let `paramsSerializer()` handle query params if it exists
439
- params: a.paramsSerializer ? a.query : void 0,
440
- url: h
421
+ params: c.paramsSerializer ? c.query : void 0,
422
+ url: f
441
423
  });
442
- let { data: y } = b;
443
- return a.responseType === "json" && (a.responseValidator && await a.responseValidator(y), a.responseTransformer && (y = await a.responseTransformer(y))), {
444
- ...b,
445
- data: y ?? {}
424
+ let { data: b } = m;
425
+ return c.responseType === "json" && (c.responseValidator && await c.responseValidator(b), c.responseTransformer && (b = await c.responseTransformer(b))), {
426
+ ...m,
427
+ data: b ?? {}
446
428
  };
447
- } catch (m) {
448
- const g = m;
449
- if (a.throwOnError)
450
- throw g;
451
- return g.error = g.response?.data ?? {}, g;
429
+ } catch (w) {
430
+ const _ = w;
431
+ if (c.throwOnError)
432
+ throw _;
433
+ return _.error = _.response?.data ?? {}, _;
452
434
  }
453
- }, n = (d) => (a) => c({ ...a, method: d }), o = (d) => async (a) => {
454
- const { opts: h, url: m } = await l(a);
455
- return Y({
456
- ...h,
457
- body: h.body,
458
- headers: h.headers,
435
+ }, n = (d) => (c) => a({ ...c, method: d }), o = (d) => async (c) => {
436
+ const { opts: f, url: w } = await l(c);
437
+ return Z({
438
+ ...f,
439
+ body: f.body,
440
+ headers: f.headers,
459
441
  method: d,
442
+ serializedBody: N(f),
460
443
  // @ts-expect-error
461
- signal: h.signal,
462
- url: m
444
+ signal: f.signal,
445
+ url: w
463
446
  });
464
447
  };
465
448
  return {
466
- buildUrl: N,
449
+ buildUrl: (d) => L({ axios: r, ...t, ...d }),
467
450
  connect: n("CONNECT"),
468
451
  delete: n("DELETE"),
469
452
  get: n("GET"),
@@ -474,7 +457,7 @@ const ae = async (e, t) => {
474
457
  patch: n("PATCH"),
475
458
  post: n("POST"),
476
459
  put: n("PUT"),
477
- request: c,
460
+ request: a,
478
461
  setConfig: i,
479
462
  sse: {
480
463
  connect: o("CONNECT"),
@@ -489,7 +472,7 @@ const ae = async (e, t) => {
489
472
  },
490
473
  trace: n("TRACE")
491
474
  };
492
- }, u = ue(V()), w = (e) => (e = new Date(e), e), M = (e) => (e.last_active_at && (e.last_active_at = w(e.last_active_at)), e.created_at = w(e.created_at), e.updated_at = w(e.updated_at), e), de = async (e) => (e.list = e.list.map((t) => M(t)), e), he = async (e) => (e = M(e), e), fe = (e) => (e.subscribed_at = w(e.subscribed_at), e), ye = async (e) => (e.list = e.list.map((t) => fe(t)), e), F = (e) => (e.created_at = w(e.created_at), e.updated_at = w(e.updated_at), e), x = (e) => (e = F(e), e), be = (e) => (e = x(e), e), me = async (e) => (e.list = e.list.map((t) => be(t)), e), Te = async (e) => (e = x(e), e), ge = async (e) => (e = x(e), e), we = async (e) => (e = x(e), e), A = (e) => (e = F(e), e), Ae = async (e) => (e.list = e.list.map((t) => A(t)), e), _e = async (e) => (e = A(e), e), Ce = async (e) => (e = A(e), e), Se = async (e) => (e = A(e), e), je = async (e) => (e = A(e), e), ve = async (e) => (e.list = e.list.map((t) => A(t)), e), Re = (e) => (e?.client ?? u).get({
475
+ }, u = ue(M()), A = (e) => (e = new Date(e), e), F = (e) => (e.last_active_at && (e.last_active_at = A(e.last_active_at)), e.created_at = A(e.created_at), e.updated_at = A(e.updated_at), e), de = async (e) => (e.list = e.list.map((t) => F(t)), e), he = async (e) => (e = F(e), e), fe = (e) => (e.subscribed_at && (e.subscribed_at = A(e.subscribed_at)), e), ye = async (e) => (e.list = e.list.map((t) => fe(t)), e), J = (e) => (e.created_at = A(e.created_at), e.updated_at = A(e.updated_at), e), z = (e) => (e = J(e), e), be = (e) => (e = z(e), e), me = async (e) => (e.list = e.list.map((t) => be(t)), e), Te = async (e) => (e = z(e), e), ge = async (e) => (e = z(e), e), we = async (e) => (e = z(e), e), C = (e) => (e = J(e), e), _e = async (e) => (e.list = e.list.map((t) => C(t)), e), Ae = async (e) => (e = C(e), e), Ce = async (e) => (e = C(e), e), Se = async (e) => (e = C(e), e), je = async (e) => (e = C(e), e), ve = async (e) => (e.list = e.list.map((t) => C(t)), e), Re = (e) => (e?.client ?? u).get({
493
476
  responseTransformer: de,
494
477
  responseType: "json",
495
478
  url: "/api/developers",
@@ -507,18 +490,18 @@ const ae = async (e, t) => {
507
490
  responseType: "json",
508
491
  url: "/api/api_products",
509
492
  ...e
510
- }), De = (e) => (e.client ?? u).get({
493
+ }), ze = (e) => (e.client ?? u).get({
511
494
  responseType: "json",
512
495
  url: "/api/api_products/{api_product_id}",
513
496
  ...e
514
- }), $e = (e) => (e.client ?? u).post({
497
+ }), De = (e) => (e.client ?? u).post({
515
498
  url: "/api/api_products/{api_product_id}/subscriptions",
516
499
  ...e,
517
500
  headers: {
518
501
  "Content-Type": "application/json",
519
502
  ...e.headers
520
503
  }
521
- }), ze = (e) => (e?.client ?? u).get({
504
+ }), $e = (e) => (e?.client ?? u).get({
522
505
  responseTransformer: ye,
523
506
  responseType: "json",
524
507
  url: "/api/subscriptions",
@@ -535,7 +518,7 @@ const ae = async (e, t) => {
535
518
  responseType: "json",
536
519
  url: "/api/applications",
537
520
  ...e
538
- }), qe = (e) => (e?.client ?? u).post({
521
+ }), Ue = (e) => (e?.client ?? u).post({
539
522
  responseTransformer: Te,
540
523
  responseType: "json",
541
524
  url: "/api/applications",
@@ -544,7 +527,7 @@ const ae = async (e, t) => {
544
527
  "Content-Type": "application/json",
545
528
  ...e?.headers
546
529
  }
547
- }), Ue = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}", ...e }), Be = (e) => (e.client ?? u).get({
530
+ }), qe = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}", ...e }), Be = (e) => (e.client ?? u).get({
548
531
  responseTransformer: ge,
549
532
  responseType: "json",
550
533
  url: "/api/applications/{application_id}",
@@ -559,12 +542,12 @@ const ae = async (e, t) => {
559
542
  ...e.headers
560
543
  }
561
544
  }), Le = (e) => (e.client ?? u).get({
562
- responseTransformer: Ae,
545
+ responseTransformer: _e,
563
546
  responseType: "json",
564
547
  url: "/api/applications/{application_id}/credentials",
565
548
  ...e
566
549
  }), We = (e) => (e.client ?? u).post({
567
- responseTransformer: _e,
550
+ responseTransformer: Ae,
568
551
  responseType: "json",
569
552
  url: "/api/applications/{application_id}/credentials",
570
553
  ...e,
@@ -617,14 +600,14 @@ const ae = async (e, t) => {
617
600
  url: "/api/dcr_providers",
618
601
  ...e
619
602
  });
620
- class E extends Error {
603
+ class P extends Error {
621
604
  constructor(t, r, s, i, l) {
622
605
  super(t), this.message = t, this.status = r, this.method = s, this.url = i, this.stack = void 0, this.#e = l;
623
606
  }
624
607
  #e;
625
608
  static fromAxiosError = (t) => {
626
609
  const r = t.error && t.error.error_msg;
627
- return new E(
610
+ return new P(
628
611
  `Request failed: ${r || (t.status ? `with status code ${t.status}` : t.message)}`,
629
612
  t.status ?? 0,
630
613
  t.config?.method?.toUpperCase() ?? "",
@@ -637,7 +620,7 @@ class E extends Error {
637
620
  * @param error The error to check.
638
621
  * @returns True if the error is an instance of APIError, false otherwise.
639
622
  */
640
- static isAPIError = (t) => t instanceof E;
623
+ static isAPIError = (t) => t instanceof P;
641
624
  /**
642
625
  * Get the original raw Axios error.
643
626
  * @returns {AxiosError} The original Axios error.
@@ -648,7 +631,7 @@ class E extends Error {
648
631
  }
649
632
  const p = (e) => {
650
633
  if (e.error || e.status && e.status >= 400)
651
- throw E.fromAxiosError(e);
634
+ throw P.fromAxiosError(e);
652
635
  return e.data;
653
636
  };
654
637
  class Ye {
@@ -795,7 +778,7 @@ class rt {
795
778
  */
796
779
  async create(t) {
797
780
  return p(
798
- await qe({
781
+ await Ue({
799
782
  client: this.client,
800
783
  body: t
801
784
  })
@@ -849,7 +832,7 @@ class rt {
849
832
  */
850
833
  async delete(t) {
851
834
  p(
852
- await Ue({
835
+ await qe({
853
836
  client: this.client,
854
837
  path: { application_id: t }
855
838
  })
@@ -976,7 +959,7 @@ class ct {
976
959
  */
977
960
  async get(t) {
978
961
  return p(
979
- await De({
962
+ await ze({
980
963
  client: this.client,
981
964
  path: { api_product_id: t }
982
965
  })
@@ -990,7 +973,7 @@ class ct {
990
973
  */
991
974
  async subscribe(t, r) {
992
975
  p(
993
- await $e({
976
+ await De({
994
977
  client: this.client,
995
978
  path: { api_product_id: t },
996
979
  body: r
@@ -1010,7 +993,7 @@ class ot {
1010
993
  */
1011
994
  async list(t) {
1012
995
  return p(
1013
- await ze({ client: this.client, query: t })
996
+ await $e({ client: this.client, query: t })
1014
997
  );
1015
998
  }
1016
999
  /**
@@ -1049,5 +1032,5 @@ export {
1049
1032
  at as b,
1050
1033
  ue as c,
1051
1034
  it as d,
1052
- E as e
1035
+ P as e
1053
1036
  };