@cargo-ai/api 1.0.1 → 1.0.2

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/README.md +85 -0
  2. package/package.json +5 -4
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # Cargo API
2
+
3
+ TypeScript client and types for the [Cargo API](https://docs.getcargo.ai/api-reference/introduction). Use it to manage data models, orchestrate workflows, build AI agents, and integrate with the Cargo platform from Node.js or the browser.
4
+
5
+ **API reference:** [docs.getcargo.ai/api-reference/introduction](https://docs.getcargo.ai/api-reference/introduction)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @cargo-ai/api
11
+ ```
12
+
13
+ ## Peer dependencies
14
+
15
+ `@cargo-ai/api` depends on **@cargo-ai/types** and **@cargo-ai/utils**, which are published alongside it. Install them if your environment does not already provide them:
16
+
17
+ ```bash
18
+ npm install @cargo-ai/types @cargo-ai/utils
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Building the API client
24
+
25
+ Create an API client by calling `buildApi` with the [Cargo API base URL](https://docs.getcargo.ai/api-reference/introduction) and your API token (Bearer auth):
26
+
27
+ ```ts
28
+ import { buildApi } from "@cargo-ai/api";
29
+
30
+ const api = buildApi({
31
+ baseUrl: "https://api.getcargo.io/v1",
32
+ accessToken: "YOUR_API_TOKEN",
33
+ });
34
+
35
+ // Use domain APIs
36
+ const datasets = await api.storage.getDatasets();
37
+ const workflows = await api.orchestration.getWorkflows();
38
+ ```
39
+
40
+ ### Domain clients and types
41
+
42
+ The package exports typed **domain** namespaces and API modules for:
43
+
44
+ - **Ai** – AI resources, agents, MCP servers, files
45
+ - **Billing** – subscriptions and billing
46
+ - **Connection** – connectors, integrations, filters
47
+ - **Expression** – expressions and formula helpers
48
+ - **Orchestration** – workflows, plays, tools, templates
49
+ - **RevenueOrganization** – members, capacities, territories
50
+ - **Segmentation** – segments
51
+ - **Storage** – datasets, models, relationships, columns
52
+ - **SystemOfRecordIntegration** – system of records, clients
53
+ - **UserManagement** – users and permissions
54
+ - **WorkspaceManagement** – workspaces, folders, roles, tokens
55
+
56
+ Use the domain types for request/response typing and the API instance (`api.storage`, `api.connection`, etc.) for HTTP calls.
57
+
58
+ ### Error handling
59
+
60
+ ```ts
61
+ import { determineIfIsFetcherError, type FetcherError } from "@cargo-ai/api";
62
+
63
+ try {
64
+ await api.storage.getDataset({ datasetUuid: "..." });
65
+ } catch (err) {
66
+ if (determineIfIsFetcherError(err)) {
67
+ const fetcherError = err as FetcherError;
68
+ console.error(fetcherError.status, fetcherError.body);
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Requirements
74
+
75
+ - Node.js 22.x
76
+ - TypeScript (for types)
77
+
78
+ ## Resources
79
+
80
+ - **[Cargo API Reference](https://docs.getcargo.ai/api-reference/introduction)** – Endpoints, authentication, and platform concepts (Datasets, Models, Connectors, Tools, Plays, Agents, etc.)
81
+ - API tokens: create in your workspace under **Settings → API**
82
+
83
+ ## License
84
+
85
+ See the root of the repository for license information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cargo-ai/api",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Cargo API client and types",
5
5
  "private": false,
6
6
  "license": "UNLICENSED",
@@ -15,7 +15,8 @@
15
15
  ".": "./build/src/index.js"
16
16
  },
17
17
  "files": [
18
- "build"
18
+ "build",
19
+ "README.md"
19
20
  ],
20
21
  "scripts": {
21
22
  "afterinstall": "npm run build",
@@ -30,8 +31,8 @@
30
31
  "dependencies": {
31
32
  "axios": "1.12.0",
32
33
  "zod": "3.25.76",
33
- "@cargo-ai/types": "^1.0.1",
34
- "@cargo-ai/utils": "^1.0.4"
34
+ "@cargo-ai/types": "^1.0.2",
35
+ "@cargo-ai/utils": "^1.0.5"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/node": "^20.10.8",