@api7/portal-sdk 0.0.1 → 0.0.3

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.
@@ -0,0 +1,1054 @@
1
+ import X from "axios";
2
+ const Y = ({
3
+ onRequest: e,
4
+ onSseError: t,
5
+ onSseEvent: r,
6
+ responseTransformer: s,
7
+ responseValidator: n,
8
+ sseDefaultRetryDelay: l,
9
+ sseMaxRetryAttempts: c,
10
+ sseMaxRetryDelay: i,
11
+ sseSleepFn: o,
12
+ url: d,
13
+ ...a
14
+ }) => {
15
+ let h;
16
+ const b = o ?? ((m) => new Promise((y) => setTimeout(y, m)));
17
+ return { stream: async function* () {
18
+ let m = l ?? 3e3, y = 0;
19
+ const A = a.signal ?? new AbortController().signal;
20
+ for (; !A.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);
24
+ try {
25
+ const S = {
26
+ redirect: "follow",
27
+ ...a,
28
+ body: a.serializedBody,
29
+ headers: k,
30
+ signal: A
31
+ };
32
+ let j = new Request(d, S);
33
+ e && (j = await e(d, S));
34
+ const v = await (a.fetch ?? globalThis.fetch)(j);
35
+ if (!v.ok)
36
+ throw new Error(
37
+ `SSE failed: ${v.status} ${v.statusText}`
38
+ );
39
+ if (!v.body) throw new Error("No body in SSE response");
40
+ const x = v.body.pipeThrough(new TextDecoderStream()).getReader();
41
+ let C = "";
42
+ const I = () => {
43
+ try {
44
+ x.cancel();
45
+ } catch {
46
+ }
47
+ };
48
+ A.addEventListener("abort", I);
49
+ try {
50
+ for (; ; ) {
51
+ const { done: J, value: G } = await x.read();
52
+ if (J) break;
53
+ C += G, C = C.replace(/\r\n/g, `
54
+ `).replace(/\r/g, `
55
+ `);
56
+ const O = C.split(`
57
+
58
+ `);
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) || (m = B);
77
+ }
78
+ let T, U = !1;
79
+ if (R.length) {
80
+ const f = R.join(`
81
+ `);
82
+ try {
83
+ T = JSON.parse(f), U = !0;
84
+ } catch {
85
+ T = f;
86
+ }
87
+ }
88
+ U && (n && await n(T), s && (T = await s(T))), r?.({
89
+ data: T,
90
+ event: q,
91
+ id: h,
92
+ retry: m
93
+ }), R.length && (yield T);
94
+ }
95
+ }
96
+ } finally {
97
+ A.removeEventListener("abort", I), x.releaseLock();
98
+ }
99
+ break;
100
+ } catch (S) {
101
+ if (t?.(S), c !== void 0 && y >= c)
102
+ break;
103
+ const j = Math.min(
104
+ m * 2 ** (y - 1),
105
+ i ?? 3e4
106
+ );
107
+ await b(j);
108
+ }
109
+ }
110
+ }() };
111
+ }, Z = (e) => {
112
+ switch (e) {
113
+ case "label":
114
+ return ".";
115
+ case "matrix":
116
+ return ";";
117
+ case "simple":
118
+ return ",";
119
+ default:
120
+ return "&";
121
+ }
122
+ }, ee = (e) => {
123
+ switch (e) {
124
+ case "form":
125
+ return ",";
126
+ case "pipeDelimited":
127
+ return "|";
128
+ case "spaceDelimited":
129
+ return "%20";
130
+ default:
131
+ return ",";
132
+ }
133
+ }, te = (e) => {
134
+ switch (e) {
135
+ case "label":
136
+ return ".";
137
+ case "matrix":
138
+ return ";";
139
+ case "simple":
140
+ return ",";
141
+ default:
142
+ return "&";
143
+ }
144
+ }, W = ({
145
+ allowReserved: e,
146
+ explode: t,
147
+ name: r,
148
+ style: s,
149
+ value: n
150
+ }) => {
151
+ if (!t) {
152
+ const i = (e ? n : n.map((o) => encodeURIComponent(o))).join(ee(s));
153
+ switch (s) {
154
+ case "label":
155
+ return `.${i}`;
156
+ case "matrix":
157
+ return `;${r}=${i}`;
158
+ case "simple":
159
+ return i;
160
+ default:
161
+ return `${r}=${i}`;
162
+ }
163
+ }
164
+ const l = Z(s), c = n.map((i) => s === "label" || s === "simple" ? e ? i : encodeURIComponent(i) : E({
165
+ allowReserved: e,
166
+ name: r,
167
+ value: i
168
+ })).join(l);
169
+ return s === "label" || s === "matrix" ? l + c : c;
170
+ }, E = ({
171
+ allowReserved: e,
172
+ name: t,
173
+ value: r
174
+ }) => {
175
+ if (r == null)
176
+ return "";
177
+ if (typeof r == "object")
178
+ throw new Error(
179
+ "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
180
+ );
181
+ return `${t}=${e ? r : encodeURIComponent(r)}`;
182
+ }, H = ({
183
+ allowReserved: e,
184
+ explode: t,
185
+ name: r,
186
+ style: s,
187
+ value: n,
188
+ valueOnly: l
189
+ }) => {
190
+ if (n instanceof Date)
191
+ return l ? n.toISOString() : `${r}=${n.toISOString()}`;
192
+ if (s !== "deepObject" && !t) {
193
+ let o = [];
194
+ Object.entries(n).forEach(([a, h]) => {
195
+ o = [
196
+ ...o,
197
+ a,
198
+ e ? h : encodeURIComponent(h)
199
+ ];
200
+ });
201
+ const d = o.join(",");
202
+ switch (s) {
203
+ case "form":
204
+ return `${r}=${d}`;
205
+ case "label":
206
+ return `.${d}`;
207
+ case "matrix":
208
+ return `;${r}=${d}`;
209
+ default:
210
+ return d;
211
+ }
212
+ }
213
+ const c = te(s), i = Object.entries(n).map(
214
+ ([o, d]) => E({
215
+ allowReserved: e,
216
+ name: s === "deepObject" ? `${r}[${o}]` : o,
217
+ value: d
218
+ })
219
+ ).join(c);
220
+ return s === "label" || s === "matrix" ? c + i : i;
221
+ }, re = /\{[^{}]+\}/g, se = ({ path: e, url: t }) => {
222
+ let r = t;
223
+ const s = t.match(re);
224
+ if (s)
225
+ for (const n of s) {
226
+ let l = !1, c = n.substring(1, n.length - 1), i = "simple";
227
+ c.endsWith("*") && (l = !0, c = c.substring(0, c.length - 1)), c.startsWith(".") ? (c = c.substring(1), i = "label") : c.startsWith(";") && (c = c.substring(1), i = "matrix");
228
+ const o = e[c];
229
+ if (o == null)
230
+ continue;
231
+ if (Array.isArray(o)) {
232
+ r = r.replace(
233
+ n,
234
+ W({ explode: l, name: c, style: i, value: o })
235
+ );
236
+ continue;
237
+ }
238
+ if (typeof o == "object") {
239
+ r = r.replace(
240
+ n,
241
+ H({
242
+ explode: l,
243
+ name: c,
244
+ style: i,
245
+ value: o,
246
+ valueOnly: !0
247
+ })
248
+ );
249
+ continue;
250
+ }
251
+ if (i === "matrix") {
252
+ r = r.replace(
253
+ n,
254
+ `;${E({
255
+ name: c,
256
+ value: o
257
+ })}`
258
+ );
259
+ continue;
260
+ }
261
+ const d = encodeURIComponent(
262
+ i === "label" ? `.${o}` : o
263
+ );
264
+ r = r.replace(n, d);
265
+ }
266
+ return r;
267
+ }, ne = ({
268
+ baseUrl: e,
269
+ path: t,
270
+ query: r,
271
+ querySerializer: s,
272
+ url: n
273
+ }) => {
274
+ const l = n.startsWith("/") ? n : `/${n}`;
275
+ let c = (e ?? "") + l;
276
+ t && (c = se({ path: t, url: c }));
277
+ let i = r ? s(r) : "";
278
+ return i.startsWith("?") && (i = i.substring(1)), i && (c += `?${i}`), c;
279
+ };
280
+ function ie(e) {
281
+ const t = e.body !== void 0;
282
+ if (t && e.bodySerializer)
283
+ return "serializedBody" in e ? e.serializedBody !== void 0 && e.serializedBody !== "" ? e.serializedBody : null : e.body !== "" ? e.body : null;
284
+ if (t)
285
+ return e.body;
286
+ }
287
+ const ae = async (e, t) => {
288
+ const r = typeof t == "function" ? await t(e) : t;
289
+ if (r)
290
+ return e.scheme === "bearer" ? `Bearer ${r}` : e.scheme === "basic" ? `Basic ${btoa(r)}` : r;
291
+ }, ce = ({
292
+ parameters: e = {},
293
+ ...t
294
+ } = {}) => (s) => {
295
+ const n = [];
296
+ if (s && typeof s == "object")
297
+ for (const l in s) {
298
+ const c = s[l];
299
+ if (c == null)
300
+ continue;
301
+ const i = e[l] || t;
302
+ if (Array.isArray(c)) {
303
+ const o = W({
304
+ allowReserved: i.allowReserved,
305
+ explode: !0,
306
+ name: l,
307
+ style: "form",
308
+ value: c,
309
+ ...i.array
310
+ });
311
+ o && n.push(o);
312
+ } else if (typeof c == "object") {
313
+ const o = H({
314
+ allowReserved: i.allowReserved,
315
+ explode: !0,
316
+ name: l,
317
+ style: "deepObject",
318
+ value: c,
319
+ ...i.object
320
+ });
321
+ o && n.push(o);
322
+ } else {
323
+ const o = E({
324
+ allowReserved: i.allowReserved,
325
+ name: l,
326
+ value: c
327
+ });
328
+ o && n.push(o);
329
+ }
330
+ }
331
+ return n.join("&");
332
+ }, oe = (e, t) => t ? t in e.headers || e.query?.[t] ? !0 : "Cookie" in e.headers && e.headers.Cookie && typeof e.headers.Cookie == "string" ? e.headers.Cookie.includes(`${t}=`) : !1 : !1, le = async ({
333
+ security: e,
334
+ ...t
335
+ }) => {
336
+ for (const r of e) {
337
+ if (oe(t, r.name))
338
+ continue;
339
+ const s = await ae(r, t.auth);
340
+ if (!s)
341
+ continue;
342
+ const n = r.name ?? "Authorization";
343
+ switch (r.in) {
344
+ case "query":
345
+ t.query || (t.query = {}), t.query[n] = s;
346
+ break;
347
+ case "cookie": {
348
+ const l = `${n}=${s}`;
349
+ "Cookie" in t.headers && t.headers.Cookie ? t.headers.Cookie = `${t.headers.Cookie}; ${l}` : t.headers.Cookie = l;
350
+ break;
351
+ }
352
+ case "header":
353
+ default:
354
+ t.headers[n] = s;
355
+ break;
356
+ }
357
+ }
358
+ }, N = (e) => {
359
+ const t = e.axios?.defaults?.baseURL, r = e.baseURL && typeof e.baseURL == "string" ? e.baseURL : t;
360
+ return ne({
361
+ baseUrl: r,
362
+ path: e.path,
363
+ // let `paramsSerializer()` handle query params if it exists
364
+ query: e.paramsSerializer ? void 0 : e.query,
365
+ querySerializer: typeof e.querySerializer == "function" ? e.querySerializer : ce(e.querySerializer),
366
+ url: e.url
367
+ });
368
+ }, L = (e, t) => {
369
+ const r = { ...e, ...t };
370
+ return r.headers = $(e.headers, t.headers), r;
371
+ }, pe = [
372
+ "common",
373
+ "delete",
374
+ "get",
375
+ "head",
376
+ "patch",
377
+ "post",
378
+ "put"
379
+ ], $ = (...e) => {
380
+ const t = {};
381
+ for (const r of e) {
382
+ if (!r || typeof r != "object")
383
+ continue;
384
+ const s = Object.entries(r);
385
+ for (const [n, l] of s)
386
+ if (pe.includes(
387
+ n
388
+ ) && typeof l == "object")
389
+ t[n] = {
390
+ ...t[n],
391
+ ...l
392
+ };
393
+ else if (l === null)
394
+ delete t[n];
395
+ else if (Array.isArray(l))
396
+ for (const c of l)
397
+ t[n] = [...t[n] ?? [], c];
398
+ else l !== void 0 && (t[n] = typeof l == "object" ? JSON.stringify(l) : l);
399
+ }
400
+ return t;
401
+ }, V = (e = {}) => ({
402
+ ...e
403
+ }), ue = (e = {}) => {
404
+ let t = L(V(), e), r;
405
+ if (t.axios && !("Axios" in t.axios))
406
+ r = t.axios;
407
+ else {
408
+ const { auth: d, ...a } = t;
409
+ r = X.create(a);
410
+ }
411
+ const s = () => ({ ...t }), n = (d) => (t = L(t, d), r.defaults = {
412
+ ...r.defaults,
413
+ ...t,
414
+ // @ts-expect-error
415
+ headers: $(r.defaults.headers, t.headers)
416
+ }, s()), l = async (d) => {
417
+ const a = {
418
+ ...t,
419
+ ...d,
420
+ axios: d.axios ?? t.axios ?? r,
421
+ headers: $(t.headers, d.headers)
422
+ };
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);
431
+ try {
432
+ const b = a.axios, { auth: w, ...z } = a, m = await b({
433
+ ...z,
434
+ baseURL: "",
435
+ // the baseURL is already included in `url`
436
+ data: ie(a),
437
+ headers: a.headers,
438
+ // let `paramsSerializer()` handle query params if it exists
439
+ params: a.paramsSerializer ? a.query : void 0,
440
+ url: h
441
+ });
442
+ let { data: y } = m;
443
+ return a.responseType === "json" && (a.responseValidator && await a.responseValidator(y), a.responseTransformer && (y = await a.responseTransformer(y))), {
444
+ ...m,
445
+ data: y ?? {}
446
+ };
447
+ } catch (b) {
448
+ const w = b;
449
+ if (a.throwOnError)
450
+ throw w;
451
+ return w.error = w.response?.data ?? {}, w;
452
+ }
453
+ }, i = (d) => (a) => c({ ...a, method: d }), o = (d) => async (a) => {
454
+ const { opts: h, url: b } = await l(a);
455
+ return Y({
456
+ ...h,
457
+ body: h.body,
458
+ headers: h.headers,
459
+ method: d,
460
+ // @ts-expect-error
461
+ signal: h.signal,
462
+ url: b
463
+ });
464
+ };
465
+ return {
466
+ buildUrl: N,
467
+ connect: i("CONNECT"),
468
+ delete: i("DELETE"),
469
+ get: i("GET"),
470
+ getConfig: s,
471
+ head: i("HEAD"),
472
+ instance: r,
473
+ options: i("OPTIONS"),
474
+ patch: i("PATCH"),
475
+ post: i("POST"),
476
+ put: i("PUT"),
477
+ request: c,
478
+ setConfig: n,
479
+ sse: {
480
+ connect: o("CONNECT"),
481
+ delete: o("DELETE"),
482
+ get: o("GET"),
483
+ head: o("HEAD"),
484
+ options: o("OPTIONS"),
485
+ patch: o("PATCH"),
486
+ post: o("POST"),
487
+ put: o("PUT"),
488
+ trace: o("TRACE")
489
+ },
490
+ trace: i("TRACE")
491
+ };
492
+ }, u = ue(V()), g = (e) => (e = new Date(e), e), M = (e) => (e.last_active_at && (e.last_active_at = g(e.last_active_at)), e.created_at = g(e.created_at), e.updated_at = g(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 = g(e.subscribed_at), e), ye = async (e) => (e.list = e.list.map((t) => fe(t)), e), F = (e) => (e.created_at = g(e.created_at), e.updated_at = g(e.updated_at), e), P = (e) => (e = F(e), e), me = (e) => (e = P(e), e), be = async (e) => (e.list = e.list.map((t) => me(t)), e), Te = async (e) => (e = P(e), e), ge = async (e) => (e = P(e), e), we = async (e) => (e = P(e), e), _ = (e) => (e = F(e), e), _e = async (e) => (e.list = e.list.map((t) => _(t)), e), ve = async (e) => (e = _(e), e), Ce = async (e) => (e = _(e), e), Ae = async (e) => (e = _(e), e), Se = async (e) => (e = _(e), e), je = (e) => (e.hour_timestamp = g(e.hour_timestamp), e), Re = async (e) => (e.list = e.list.map((t) => je(t)), e), De = async (e) => (e.list = e.list.map((t) => _(t)), e), Ee = (e) => (e?.client ?? u).get({
493
+ responseTransformer: de,
494
+ responseType: "json",
495
+ url: "/api/developers",
496
+ ...e
497
+ }), Pe = (e) => (e?.client ?? u).post({
498
+ responseTransformer: he,
499
+ responseType: "json",
500
+ url: "/api/developers",
501
+ ...e,
502
+ headers: {
503
+ "Content-Type": "application/json",
504
+ ...e?.headers
505
+ }
506
+ }), xe = (e) => (e.client ?? u).delete({ url: "/api/developers/{developer_id}", ...e }), $e = (e) => (e?.client ?? u).get({
507
+ responseType: "json",
508
+ url: "/api/api_products",
509
+ ...e
510
+ }), ze = (e) => (e.client ?? u).get({
511
+ responseType: "json",
512
+ url: "/api/api_products/{api_product_id}",
513
+ ...e
514
+ }), ke = (e) => (e.client ?? u).post({
515
+ url: "/api/api_products/{api_product_id}/subscriptions",
516
+ ...e,
517
+ headers: {
518
+ "Content-Type": "application/json",
519
+ ...e.headers
520
+ }
521
+ }), Ie = (e) => (e?.client ?? u).get({
522
+ responseTransformer: ye,
523
+ responseType: "json",
524
+ url: "/api/subscriptions",
525
+ ...e
526
+ }), Oe = (e) => (e?.client ?? u).post({
527
+ url: "/api/subscriptions",
528
+ ...e,
529
+ headers: {
530
+ "Content-Type": "application/json",
531
+ ...e?.headers
532
+ }
533
+ }), qe = (e) => (e.client ?? u).delete({ url: "/api/subscriptions/{subscription_id}", ...e }), Ue = (e) => (e?.client ?? u).get({
534
+ responseTransformer: be,
535
+ responseType: "json",
536
+ url: "/api/applications",
537
+ ...e
538
+ }), Be = (e) => (e?.client ?? u).post({
539
+ responseTransformer: Te,
540
+ responseType: "json",
541
+ url: "/api/applications",
542
+ ...e,
543
+ headers: {
544
+ "Content-Type": "application/json",
545
+ ...e?.headers
546
+ }
547
+ }), Ne = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}", ...e }), Le = (e) => (e.client ?? u).get({
548
+ responseTransformer: ge,
549
+ responseType: "json",
550
+ url: "/api/applications/{application_id}",
551
+ ...e
552
+ }), We = (e) => (e.client ?? u).put({
553
+ responseTransformer: we,
554
+ responseType: "json",
555
+ url: "/api/applications/{application_id}",
556
+ ...e,
557
+ headers: {
558
+ "Content-Type": "application/json",
559
+ ...e.headers
560
+ }
561
+ }), He = (e) => (e.client ?? u).get({
562
+ responseTransformer: _e,
563
+ responseType: "json",
564
+ url: "/api/applications/{application_id}/credentials",
565
+ ...e
566
+ }), Ve = (e) => (e.client ?? u).post({
567
+ responseTransformer: ve,
568
+ responseType: "json",
569
+ url: "/api/applications/{application_id}/credentials",
570
+ ...e,
571
+ headers: {
572
+ "Content-Type": "application/json",
573
+ ...e.headers
574
+ }
575
+ }), Me = (e) => (e.client ?? u).delete({ url: "/api/applications/{application_id}/credentials/{credential_id}", ...e }), Fe = (e) => (e.client ?? u).get({
576
+ responseTransformer: Ce,
577
+ responseType: "json",
578
+ url: "/api/applications/{application_id}/credentials/{credential_id}",
579
+ ...e
580
+ }), Je = (e) => (e.client ?? u).put({
581
+ responseTransformer: Ae,
582
+ responseType: "json",
583
+ url: "/api/applications/{application_id}/credentials/{credential_id}",
584
+ ...e,
585
+ headers: {
586
+ "Content-Type": "application/json",
587
+ ...e.headers
588
+ }
589
+ }), Ge = (e) => (e.client ?? u).put({
590
+ responseTransformer: Se,
591
+ responseType: "json",
592
+ url: "/api/applications/{application_id}/credentials/{credential_id}/regenerate",
593
+ ...e,
594
+ headers: {
595
+ "Content-Type": "application/json",
596
+ ...e.headers
597
+ }
598
+ }), Ke = (e) => (e.client ?? u).get({
599
+ responseTransformer: Re,
600
+ responseType: "json",
601
+ url: "/api/applications/api_calls",
602
+ ...e
603
+ }), Qe = (e) => (e?.client ?? u).get({
604
+ responseTransformer: De,
605
+ responseType: "json",
606
+ url: "/api/credentials",
607
+ ...e
608
+ }), Xe = (e) => (e.client ?? u).get({
609
+ responseType: "json",
610
+ url: "/api/labels/{resource_type}",
611
+ ...e
612
+ }), Ye = (e) => (e?.client ?? u).get({
613
+ responseType: "json",
614
+ url: "/api/system_settings/public_access",
615
+ ...e
616
+ }), Ze = (e) => (e?.client ?? u).get({
617
+ responseType: "json",
618
+ url: "/api/dcr_providers",
619
+ ...e
620
+ });
621
+ class D extends Error {
622
+ constructor(t, r, s, n, l) {
623
+ super(t), this.message = t, this.status = r, this.method = s, this.url = n, this.stack = void 0, this.#e = l;
624
+ }
625
+ #e;
626
+ static fromAxiosError = (t) => {
627
+ const r = t.error && t.error.error_msg;
628
+ return new D(
629
+ `Request failed: ${r || (t.status ? `with status code ${t.status}` : t.message)}`,
630
+ t.status ?? 0,
631
+ t.config?.method?.toUpperCase() ?? "",
632
+ t.config?.url ?? "",
633
+ t
634
+ );
635
+ };
636
+ /**
637
+ * Check if the given error is an instance of APIError.
638
+ * @param error The error to check.
639
+ * @returns True if the error is an instance of APIError, false otherwise.
640
+ */
641
+ static isAPIError = (t) => t instanceof D;
642
+ /**
643
+ * Get the original raw Axios error.
644
+ * @returns {AxiosError} The original Axios error.
645
+ */
646
+ rawError() {
647
+ return this.#e;
648
+ }
649
+ }
650
+ const p = (e) => {
651
+ if (e.error || e.status && e.status >= 400)
652
+ throw D.fromAxiosError(e);
653
+ return e.data;
654
+ };
655
+ class et {
656
+ constructor(t) {
657
+ this.client = t;
658
+ }
659
+ /**
660
+ * Create a new application credential.
661
+ * @param applicationId The application ID.
662
+ * @param data The credential data.
663
+ * @returns The created application credential.
664
+ * @throws {APIError} If the API request fails or network error occurs.
665
+ */
666
+ async create(t, r) {
667
+ return p(
668
+ await Ve({
669
+ client: this.client,
670
+ path: { application_id: t },
671
+ body: r
672
+ })
673
+ );
674
+ }
675
+ /**
676
+ * List all application credentials for a given application.
677
+ * @param applicationId The application ID.
678
+ * @param query The query parameters.
679
+ * @returns The list of application credentials.
680
+ * @throws {APIError} If the API request fails or network error occurs.
681
+ */
682
+ async list(t, r) {
683
+ return p(
684
+ await He({
685
+ client: this.client,
686
+ path: { application_id: t },
687
+ query: r
688
+ })
689
+ );
690
+ }
691
+ /**
692
+ * Get an application credential by ID.
693
+ * @param applicationId The application ID.
694
+ * @param credentialId The credential ID.
695
+ * @returns The application credential.
696
+ * @throws {APIError} If the API request fails or network error occurs.
697
+ */
698
+ async get(t, r) {
699
+ return p(
700
+ await Fe({
701
+ client: this.client,
702
+ path: {
703
+ application_id: t,
704
+ credential_id: r
705
+ }
706
+ })
707
+ );
708
+ }
709
+ /**
710
+ * Update an application credential.
711
+ * @param applicationId The application ID.
712
+ * @param credentialId The credential ID.
713
+ * @param data The credential data.
714
+ * @returns The updated application credential.
715
+ * @throws {APIError} If the API request fails or network error occurs.
716
+ */
717
+ async update(t, r, s) {
718
+ return p(
719
+ await Je({
720
+ client: this.client,
721
+ path: {
722
+ application_id: t,
723
+ credential_id: r
724
+ },
725
+ body: s
726
+ })
727
+ );
728
+ }
729
+ /**
730
+ * Delete an application credential.
731
+ * @param applicationId The application ID.
732
+ * @param credentialId The credential ID.
733
+ * @throws {APIError} If the API request fails or network error occurs.
734
+ */
735
+ async delete(t, r) {
736
+ return p(
737
+ await Me({
738
+ client: this.client,
739
+ path: {
740
+ application_id: t,
741
+ credential_id: r
742
+ }
743
+ })
744
+ );
745
+ }
746
+ /**
747
+ * Regenerate an application credential.
748
+ * @param applicationId The application ID.
749
+ * @param credentialId The credential ID.
750
+ * @param data The credential data.
751
+ * @returns The regenerated application credential.
752
+ * @throws {APIError} If the API request fails or network error occurs.
753
+ */
754
+ async regenerate(t, r, s) {
755
+ return p(
756
+ await Ge({
757
+ client: this.client,
758
+ path: {
759
+ application_id: t,
760
+ credential_id: r
761
+ },
762
+ body: s
763
+ })
764
+ );
765
+ }
766
+ }
767
+ class st {
768
+ constructor(t) {
769
+ this.client = t;
770
+ }
771
+ /**
772
+ * List all credentials.
773
+ * @param query The query parameters.
774
+ * @returns The list of credentials.
775
+ * @throws {APIError} If the API request fails or network error occurs.
776
+ */
777
+ async list(t) {
778
+ return p(
779
+ await Qe({
780
+ client: this.client,
781
+ query: t
782
+ })
783
+ );
784
+ }
785
+ }
786
+ class nt {
787
+ constructor(t) {
788
+ this.client = t, this.credential = new et(this.client);
789
+ }
790
+ credential;
791
+ /**
792
+ * Create a new developer application.
793
+ * @param data The application data.
794
+ * @returns The created developer application.
795
+ * @throws {APIError} If the API request fails or network error occurs.
796
+ */
797
+ async create(t) {
798
+ return p(
799
+ await Be({
800
+ client: this.client,
801
+ body: t
802
+ })
803
+ );
804
+ }
805
+ /**
806
+ * List all applications for a developer.
807
+ * @param query The query parameters.
808
+ * @returns The list of developer's applications.
809
+ * @throws {APIError} If the API request fails or network error occurs.
810
+ */
811
+ async list(t) {
812
+ return p(
813
+ await Ue({ client: this.client, query: t })
814
+ );
815
+ }
816
+ /**
817
+ * Get a developer application by ID.
818
+ * @param applicationId The application ID.
819
+ * @returns The developer application.
820
+ * @throws {APIError} If the API request fails or network error occurs.
821
+ */
822
+ async get(t) {
823
+ return p(
824
+ await Le({
825
+ client: this.client,
826
+ path: { application_id: t }
827
+ })
828
+ );
829
+ }
830
+ /**
831
+ * Update a developer application.
832
+ * @param applicationId The application ID.
833
+ * @param data The application data.
834
+ * @returns The updated developer application.
835
+ * @throws {APIError} If the API request fails or network error occurs.
836
+ */
837
+ async update(t, r) {
838
+ return p(
839
+ await We({
840
+ client: this.client,
841
+ path: { application_id: t },
842
+ body: r
843
+ })
844
+ );
845
+ }
846
+ /**
847
+ * Delete a developer application.
848
+ * @param applicationId The application ID.
849
+ * @throws {APIError} If the API request fails or network error occurs.
850
+ */
851
+ async delete(t) {
852
+ p(
853
+ await Ne({
854
+ client: this.client,
855
+ path: { application_id: t }
856
+ })
857
+ );
858
+ }
859
+ /**
860
+ * Get API call metrics.
861
+ * @param query The query parameters.
862
+ * @returns The API call metrics.
863
+ * @throws {APIError} If the API request fails or network error occurs.
864
+ */
865
+ async apiCall(t) {
866
+ return p(
867
+ await Ke({
868
+ client: this.client,
869
+ query: t
870
+ })
871
+ );
872
+ }
873
+ }
874
+ class it {
875
+ constructor(t) {
876
+ this.client = t;
877
+ }
878
+ /**
879
+ * List all DCR providers.
880
+ * @returns The list of DCR providers.
881
+ * @throws {APIError} If the API request fails or network error occurs.
882
+ */
883
+ async list(t) {
884
+ return p(
885
+ await Ze({ client: this.client, query: t })
886
+ );
887
+ }
888
+ }
889
+ class at {
890
+ constructor(t) {
891
+ this.client = t;
892
+ }
893
+ /**
894
+ * Get public access settings.
895
+ * @returns Whether the developer portal is publicly accessible.
896
+ * @throws {APIError} If the API request fails or network error occurs.
897
+ */
898
+ async getPublicAccess() {
899
+ return p(
900
+ await Ye({ client: this.client })
901
+ ).portal_public_access;
902
+ }
903
+ }
904
+ class ct {
905
+ constructor(t) {
906
+ this.client = t;
907
+ }
908
+ /**
909
+ * Get list of labels for a given resource type.
910
+ * @param type The resource type.
911
+ * @returns The list of labels.
912
+ * @throws {APIError} If the API request fails or network error occurs.
913
+ */
914
+ async listLabels(t) {
915
+ return p(
916
+ await Xe({ client: this.client, path: { resource_type: t } })
917
+ );
918
+ }
919
+ }
920
+ class ot {
921
+ constructor(t) {
922
+ this.client = t;
923
+ }
924
+ /**
925
+ * Create a new developer.
926
+ * @param data The developer data.
927
+ * @returns The created developer.
928
+ * @throws {APIError} If the API request fails or network error occurs.
929
+ */
930
+ async create(t) {
931
+ return p(
932
+ await Pe({ client: this.client, body: t })
933
+ );
934
+ }
935
+ /**
936
+ * List all developers.
937
+ * @param query Optional query parameters.
938
+ * @returns The list of developers.
939
+ * @throws {APIError} If the API request fails or network error occurs.
940
+ */
941
+ async list(t) {
942
+ return p(
943
+ await Ee({ client: this.client, query: t })
944
+ );
945
+ }
946
+ /**
947
+ * Delete a developer by ID.
948
+ * @param id The developer ID.
949
+ * @throws {APIError} If the API request fails or network error occurs.
950
+ */
951
+ async delete(t) {
952
+ p(
953
+ await xe({ client: this.client, path: { developer_id: t } })
954
+ );
955
+ }
956
+ }
957
+ class lt {
958
+ constructor(t) {
959
+ this.client = t;
960
+ }
961
+ /**
962
+ * List all API products.
963
+ * @param query The query parameters.
964
+ * @returns The list of API products.
965
+ * @throws {APIError} If the API request fails or network error occurs.
966
+ */
967
+ async list(t) {
968
+ return p(
969
+ await $e({ client: this.client, query: t })
970
+ );
971
+ }
972
+ /**
973
+ * Get an API product by ID.
974
+ * @param id The API product ID.
975
+ * @returns The API product.
976
+ * @throws {APIError} If the API request fails or network error occurs.
977
+ */
978
+ async get(t) {
979
+ return p(
980
+ await ze({
981
+ client: this.client,
982
+ path: { api_product_id: t }
983
+ })
984
+ );
985
+ }
986
+ /**
987
+ * Subscribe to an API product by ID.
988
+ * @param id The API product ID.
989
+ * @param data The subscription data.
990
+ * @throws {APIError} If the API request fails or network error occurs.
991
+ */
992
+ async subscribe(t, r) {
993
+ p(
994
+ await ke({
995
+ client: this.client,
996
+ path: { api_product_id: t },
997
+ body: r
998
+ })
999
+ );
1000
+ }
1001
+ }
1002
+ class pt {
1003
+ constructor(t) {
1004
+ this.client = t;
1005
+ }
1006
+ /**
1007
+ * List all subscriptions.
1008
+ * @param query Optional query parameters.
1009
+ * @returns The list of subscriptions.
1010
+ * @throws {APIError} If the API request fails or network error occurs.
1011
+ */
1012
+ async list(t) {
1013
+ return p(
1014
+ await Ie({ client: this.client, query: t })
1015
+ );
1016
+ }
1017
+ /**
1018
+ * Bulk subscribe to products
1019
+ * @param data The subscription data.
1020
+ * @returns The created subscription.
1021
+ * @throws {APIError} If the API request fails or network error occurs.
1022
+ */
1023
+ async bulkSubscribe(t) {
1024
+ p(
1025
+ await Oe({ client: this.client, body: t })
1026
+ );
1027
+ }
1028
+ /**
1029
+ * Unsubscribe from a subscription by ID.
1030
+ * @param id The subscription ID.
1031
+ * @returns The result of the unsubscription.
1032
+ * @throws {APIError} If the API request fails or network error occurs.
1033
+ */
1034
+ async unsubscribe(t) {
1035
+ p(
1036
+ await qe({
1037
+ client: this.client,
1038
+ path: { subscription_id: t }
1039
+ })
1040
+ );
1041
+ }
1042
+ }
1043
+ export {
1044
+ lt as A,
1045
+ st as C,
1046
+ it as D,
1047
+ ct as M,
1048
+ pt as S,
1049
+ nt as a,
1050
+ ot as b,
1051
+ ue as c,
1052
+ at as d,
1053
+ D as e
1054
+ };