@axiom-lattice/client-sdk 2.1.51 → 2.1.53

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.mjs CHANGED
@@ -2790,6 +2790,49 @@ var EvalClient = class {
2790
2790
  }
2791
2791
  };
2792
2792
 
2793
+ // src/resources-client.ts
2794
+ var ResourcesClient = class {
2795
+ constructor(baseURL, getHeaders) {
2796
+ this.baseURL = baseURL;
2797
+ this.getHeaders = getHeaders;
2798
+ }
2799
+ async share(request) {
2800
+ const res = await fetch(`${this.baseURL}/api/resources/share`, {
2801
+ method: "POST",
2802
+ headers: { "Content-Type": "application/json", ...this.getHeaders() },
2803
+ body: JSON.stringify(request)
2804
+ });
2805
+ if (!res.ok)
2806
+ throw new Error(`Share failed: ${res.status}`);
2807
+ return await res.json();
2808
+ }
2809
+ async unshare(token) {
2810
+ const res = await fetch(`${this.baseURL}/api/resources/share/${token}`, {
2811
+ method: "DELETE",
2812
+ headers: this.getHeaders()
2813
+ });
2814
+ if (!res.ok)
2815
+ throw new Error(`Unshare failed: ${res.status}`);
2816
+ }
2817
+ async updateShare(token, patch) {
2818
+ const res = await fetch(`${this.baseURL}/api/resources/share/${token}`, {
2819
+ method: "PATCH",
2820
+ headers: { "Content-Type": "application/json", ...this.getHeaders() },
2821
+ body: JSON.stringify(patch)
2822
+ });
2823
+ if (!res.ok)
2824
+ throw new Error(`Update failed: ${res.status}`);
2825
+ }
2826
+ async listShares() {
2827
+ const res = await fetch(`${this.baseURL}/api/resources/shares`, {
2828
+ headers: this.getHeaders()
2829
+ });
2830
+ if (!res.ok)
2831
+ throw new Error(`List failed: ${res.status}`);
2832
+ return await res.json();
2833
+ }
2834
+ };
2835
+
2793
2836
  // src/client.ts
2794
2837
  var _Client = class extends AbstractClient {
2795
2838
  /**
@@ -2804,6 +2847,7 @@ var _Client = class extends AbstractClient {
2804
2847
  ...this.config.headers
2805
2848
  };
2806
2849
  this.eval = new EvalClient(this.config.baseURL, this.getAllHeaders());
2850
+ this.resources = new ResourcesClient(this.config.baseURL, () => this.getAllHeaders());
2807
2851
  }
2808
2852
  /**
2809
2853
  * Helper method to handle fetch responses and errors
@@ -3431,6 +3475,7 @@ var WorkspaceClient = class {
3431
3475
  "x-tenant-id": tenantId,
3432
3476
  ...config.headers
3433
3477
  };
3478
+ this.resources = new ResourcesClient(this.baseURL, () => ({ ...this.headers }));
3434
3479
  }
3435
3480
  async request(url, options = {}) {
3436
3481
  const fullUrl = `${this.baseURL}${url}`;
@@ -3821,6 +3866,7 @@ export {
3821
3866
  Client,
3822
3867
  EvalClient,
3823
3868
  NetworkError,
3869
+ ResourcesClient,
3824
3870
  ScheduleExecutionType,
3825
3871
  ScheduledTaskStatus,
3826
3872
  WeChatClient,