@todoforai/cli 0.1.25 → 0.1.26

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 (2) hide show
  1. package/dist/todoai.js +30 -0
  2. package/package.json +1 -1
package/dist/todoai.js CHANGED
@@ -42859,6 +42859,36 @@ class ApiClient {
42859
42859
  payload.scheduledTimestamp = scheduledTimestamp;
42860
42860
  return this.request("POST", `/api/v1/projects/${projectId}/todos`, payload);
42861
42861
  }
42862
+ async showFile(todoId, file, filename, opts = {}) {
42863
+ const form = new FormData;
42864
+ form.append("file", file, filename);
42865
+ form.append("todoId", todoId);
42866
+ for (const [k, v] of Object.entries(opts))
42867
+ if (v)
42868
+ form.append(k, v);
42869
+ const url = `${this.apiUrl}${restBasePath(this.apiKey)}/resources/show`;
42870
+ const res = await fetch(url, {
42871
+ method: "POST",
42872
+ headers: { "x-api-key": this.apiKey },
42873
+ body: form,
42874
+ signal: AbortSignal.timeout(120000)
42875
+ });
42876
+ if (!res.ok)
42877
+ throw new Error(`API POST /resources/show failed: ${res.status} ${await res.text()}`);
42878
+ return res.json();
42879
+ }
42880
+ async showUrl(todoId, url, opts = {}) {
42881
+ const endpoint = `${this.apiUrl}${restBasePath(this.apiKey)}/resources/open`;
42882
+ const res = await fetch(endpoint, {
42883
+ method: "POST",
42884
+ headers: { "x-api-key": this.apiKey, "Content-Type": "application/json" },
42885
+ body: JSON.stringify({ todoId, url, ...opts }),
42886
+ signal: AbortSignal.timeout(30000)
42887
+ });
42888
+ if (!res.ok)
42889
+ throw new Error(`API POST /resources/open failed: ${res.status} ${await res.text()}`);
42890
+ return res.json();
42891
+ }
42862
42892
  patchEdgeConfig(edgeId, updates) {
42863
42893
  return this.request("PATCH", `/api/v1/edges/${edgeId}`, { updates });
42864
42894
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/cli",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "todoforai-cli": "bin/todoforai-cli.js",