@medialane/sdk 0.112.0 → 0.114.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.
package/dist/index.cjs CHANGED
@@ -343,6 +343,9 @@ var ApiClient = class {
343
343
  bearer(siwsToken) {
344
344
  return { Authorization: `Bearer ${siwsToken}` };
345
345
  }
346
+ asSubject(siwsToken) {
347
+ return siwsToken ? this.bearer(siwsToken) : void 0;
348
+ }
346
349
  getOrders(query = {}) {
347
350
  const params = new URLSearchParams();
348
351
  if (query.status) params.set("status", query.status);
@@ -537,20 +540,49 @@ var ApiClient = class {
537
540
  body: formData
538
541
  });
539
542
  }
540
- getMe() {
541
- return this.get("/v1/portal/me");
543
+ getMe(siwsToken) {
544
+ return this.request("/v1/portal/me", {
545
+ method: "GET",
546
+ headers: this.asSubject(siwsToken)
547
+ });
548
+ }
549
+ getApiKeys(siwsToken) {
550
+ return this.request("/v1/portal/keys", {
551
+ method: "GET",
552
+ headers: this.asSubject(siwsToken)
553
+ });
554
+ }
555
+ createApiKey(input, siwsToken) {
556
+ return this.request("/v1/portal/keys", {
557
+ method: "POST",
558
+ body: JSON.stringify(input ?? {}),
559
+ headers: this.asSubject(siwsToken)
560
+ });
542
561
  }
543
- getApiKeys() {
544
- return this.get("/v1/portal/keys");
562
+ deleteApiKey(id, siwsToken) {
563
+ return this.request(`/v1/portal/keys/${id}`, {
564
+ method: "DELETE",
565
+ headers: this.asSubject(siwsToken)
566
+ });
545
567
  }
546
- createApiKey(label) {
547
- return this.post("/v1/portal/keys", label ? { label } : {});
568
+ getCreditHistory(siwsToken) {
569
+ return this.request("/v1/portal/credits/history", {
570
+ method: "GET",
571
+ headers: this.asSubject(siwsToken)
572
+ });
548
573
  }
549
- deleteApiKey(id) {
550
- return this.del(`/v1/portal/keys/${id}`);
574
+ getSpend(siwsToken) {
575
+ return this.request("/v1/portal/credits/spend", {
576
+ method: "GET",
577
+ headers: this.asSubject(siwsToken)
578
+ });
551
579
  }
552
- getUsage() {
553
- return this.get("/v1/portal/usage");
580
+ checkDeposit(txHash, siwsToken) {
581
+ return this.request("/v1/portal/credits/check", {
582
+ method: "POST",
583
+ body: JSON.stringify({ txHash }),
584
+ headers: this.asSubject(siwsToken)
585
+ });
554
586
  }
555
587
  getWebhooks() {
556
588
  return this.get("/v1/portal/webhooks");