@superclerk/sdk 0.0.0-stage → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-11-07)
4
+
5
+ The first release, pinned to API version `2026-11-05`.
6
+
7
+ - A typed method for every endpoint of the public API, and a typed input and output for every integration tool.
8
+ - `tools.run`, `connect.links.wait`, `connections.fetch`, `social.media.upload`, and `webhooks.unwrap` and `webhooks.sign`.
9
+ - Retries that are safe by construction: one `Idempotency-Key` per call, repeated on every retry, with the same bytes.
10
+ - `SUPERCLERK_LOG=debug` prints each attempt and retry with its request ID.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Benrov, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,265 @@
1
- # Temporary Holding Version
1
+ # Superclerk TypeScript SDK
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The official TypeScript client for the [Superclerk API](https://docs.superclerk.com): connections and their tools, the
4
+ provider proxy, social posts and media, CRM, conversations, workflows and webhooks. It is generated from the API's
5
+ OpenAPI document and its tool catalog, so every method, parameter and answer is typed, and so is every tool's input and
6
+ output.
7
+
8
+ It depends on nothing but `fetch` and WebCrypto. It needs Node.js 20.19 or later, or Bun. It's an ES module, which
9
+ CommonJS code can `require` on those versions.
10
+
11
+ ```sh
12
+ npm install @superclerk/sdk
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ts
18
+ import { Superclerk } from "@superclerk/sdk"
19
+
20
+ const superclerk = new Superclerk({ apiKey: process.env.SUPERCLERK_API_KEY })
21
+
22
+ const contact = await superclerk.contacts.create({ displayName: "Ada Lovelace" })
23
+ ```
24
+
25
+ `apiKey` defaults to the `SUPERCLERK_API_KEY` environment variable; [create a key](https://docs.superclerk.com/authentication)
26
+ in Settings → Developer API. Every method is listed in [api.md](./api.md).
27
+
28
+ ## Connect an account
29
+
30
+ A connect link is a URL you send to the person whose account it is. `connect.links.wait` reads the link until they
31
+ finish.
32
+
33
+ ```ts
34
+ const link = await superclerk.connect.links.create({ appID: "gmail", returnURL: "https://example.com/done" })
35
+ // Send link.url to the person whose account it is, then wait while they finish.
36
+ const finished = await superclerk.connect.links.wait(link.id)
37
+ if (finished.status === "succeeded") console.log(finished.connection?.id)
38
+ ```
39
+
40
+ ## Run a tool
41
+
42
+ `tools.run` runs a tool on a connection, or a built-in tool by its app, and answers its output. Both are typed by the
43
+ tool, so a wrong input is a compile error.
44
+
45
+ ```ts
46
+ const { messageId } = await superclerk.tools.run({
47
+ tool: "gmail_send_email",
48
+ connectionID: "itn_123",
49
+ input: { to: ["ada@example.com"], subject: "Hello", bodyText: "Hi Ada" },
50
+ })
51
+ ```
52
+
53
+ A run that ends failed throws `ToolRunError`, whose `code` is the run's error kind. To start a run without waiting for
54
+ it, call `tools.runs.create` and read it later with `tools.runs.wait`.
55
+
56
+ ## Call a provider's API
57
+
58
+ `connections.fetch` sends a request to the provider's own API with the connection's credentials, and answers the
59
+ provider's response as it came, whatever its status. The path and query go as you wrote them. An app has a proxy when
60
+ `apps.get` lists its `proxy.methods`, as Meta Ads and Google Ads do.
61
+
62
+ ```ts
63
+ const response = await superclerk.connections.fetch("itn_123", "/me/adaccounts?fields=id,name")
64
+ const accounts = await response.json()
65
+ ```
66
+
67
+ A run that fails, such as a write whose outcome is unknown, throws `APIError` rather than answering as the provider.
68
+
69
+ ## Schedule a social post
70
+
71
+ ```ts
72
+ import { readFile } from "node:fs/promises"
73
+
74
+ const asset = await superclerk.social.media.upload(await readFile("launch.png"), {
75
+ filename: "launch.png",
76
+ contentType: "image/png",
77
+ storageAccess: "private",
78
+ })
79
+ const { accounts } = await superclerk.social.accounts.list()
80
+ await superclerk.social.posts.create({
81
+ content: "We're live.",
82
+ mediaItems: [{ assetId: asset.id }],
83
+ platforms: [{ platform: "threads", accountId: accounts[0]!.id, platformSpecificData: {} }],
84
+ scheduledFor: "2026-12-01T09:00:00Z",
85
+ })
86
+ ```
87
+
88
+ To finish an upload that was cut off, call `upload` again with the same `idempotencyKey`: an asset already ready comes
89
+ back at once, and bytes already stored are confirmed rather than sent again.
90
+
91
+ ## Pages
92
+
93
+ A list method answers its first page when awaited, and every item across every page when iterated. `body` is the
94
+ page's whole answer, with any fields beside its items, such as an opportunity list's `stageCounts`.
95
+
96
+ ```ts
97
+ const page = await superclerk.contacts.list({ limit: 50 })
98
+ page.items
99
+ page.nextCursor
100
+
101
+ for await (const contact of superclerk.contacts.list()) {
102
+ console.log(contact.displayName)
103
+ }
104
+ ```
105
+
106
+ ## Webhooks
107
+
108
+ `webhooks.unwrap` verifies a delivery's [Standard Webhooks](https://www.standardwebhooks.com) signature and answers its
109
+ event, typed by its type. Pass the body exactly as it arrived, before any JSON parsing.
110
+
111
+ ```ts
112
+ const event = await superclerk.webhooks.unwrap(await request.text(), request.headers, {
113
+ secret: process.env.SUPERCLERK_WEBHOOK_SECRET,
114
+ })
115
+ if (event.type === "contact.created") console.log(event.data.contactID)
116
+ ```
117
+
118
+ The secret defaults to the client's `webhookSecret` option, then the `SUPERCLERK_WEBHOOK_SECRET` environment variable.
119
+ A delivery that doesn't verify throws `WebhookVerificationError`.
120
+
121
+ To test your endpoint, `webhooks.sign` makes the delivery Superclerk would send for an event, signed with the same
122
+ secret:
123
+
124
+ ```ts
125
+ const { body, headers } = await superclerk.webhooks.sign({
126
+ id: "evt_test",
127
+ type: "contact.created",
128
+ createdAt: new Date().toISOString(),
129
+ data: { contactID: "cct_123" },
130
+ })
131
+ await fetch("http://localhost:3000/webhooks/superclerk", { method: "POST", body, headers })
132
+ ```
133
+
134
+ ## Client workspaces
135
+
136
+ An agency's key acts in the agency's own workspace. To act in one of its client workspaces, name it on the client or on
137
+ one request:
138
+
139
+ ```ts
140
+ const client = superclerk.withOptions({ workspace: "org_client" })
141
+ await superclerk.contacts.list({}, { workspace: "org_client" })
142
+ ```
143
+
144
+ An operation takes a client workspace only when its reference names the `Superclerk-Workspace` header. The rest act in
145
+ the key's own workspace alone, and answer `403 workspace_not_supported` when a request names another.
146
+
147
+ ## Errors
148
+
149
+ Everything the SDK throws is a `SuperclerkError`, apart from the reason you abort a call with. Branch on its `code`,
150
+ which names the failure the way the API does. A request with wrong fields throws `invalid_request`, and its message
151
+ names each one, such as `Request does not match the endpoint schema (input.url: Invalid URL)`.
152
+
153
+ | Error | When |
154
+ | -------------------------- | ------------------------------------------------------------------------------------------------- |
155
+ | `APIError` | The API answered with a status that isn't 2xx: `status`, `code`, `message`, `fields`, `requestID` |
156
+ | `APIConnectionError` | No whole answer came: `connection_failed`, or `timeout` |
157
+ | `ToolRunError` | A run `tools.run` started ended failed or cancelled: `run` |
158
+ | `WebhookVerificationError` | A webhook's signature didn't verify |
159
+
160
+ ```ts
161
+ import { APIError } from "@superclerk/sdk"
162
+
163
+ const contact = await superclerk.contacts.get("cct_123")
164
+ try {
165
+ await superclerk.contacts.update(contact.id, { expectedRevision: contact.revision, displayName: "Ada King" })
166
+ } catch (error) {
167
+ if (error instanceof APIError && error.code === "revision_conflict") {
168
+ // Someone else changed the contact first: read it again and retry.
169
+ }
170
+ }
171
+ ```
172
+
173
+ ## Retries and idempotency
174
+
175
+ A failed attempt is retried twice by default, with exponential backoff and jitter, and the wait a `Retry-After` header
176
+ asks for:
177
+
178
+ - a refusal before any work started (429, 503) is always retried
179
+ - a timeout, a dropped connection or a 5xx is retried only when the call repeats harmlessly: a read, a `PUT` or
180
+ `DELETE`, or a write the API deduplicates by its `Idempotency-Key`
181
+
182
+ The SDK sends an `Idempotency-Key` with every write that takes one, and repeats it on every retry of that call. To
183
+ retry a write across processes, pass your own:
184
+
185
+ ```ts
186
+ // Saved with the work, so a retry from another process sends the same key.
187
+ const idempotencyKey = crypto.randomUUID()
188
+ await superclerk.contacts.create({ displayName: "Ada" }, { idempotencyKey, maxRetries: 5 })
189
+ ```
190
+
191
+ ## Timeouts and cancelling
192
+
193
+ An attempt times out when no answer has started within 60 seconds by default; once one has, reading it takes as long
194
+ as it takes. Set `timeout` (in milliseconds) on the client or one request, or pass an `AbortSignal`, which also stops
195
+ reading an answer. The helpers that wait, such as `tools.run`, ask the API to hold each read for the timeout less five
196
+ seconds, up to the 30 seconds it holds, so a short timeout polls rather than timing out.
197
+
198
+ ```ts
199
+ const controller = new AbortController()
200
+ await superclerk.connections.list({}, { timeout: 5_000, signal: controller.signal })
201
+ ```
202
+
203
+ ## Raw responses
204
+
205
+ ```ts
206
+ const { data, response, requestID } = await superclerk.contacts.get("cct_123").withResponse()
207
+ const raw = await superclerk.contacts.get("cct_123").asResponse()
208
+ ```
209
+
210
+ ## Endpoints the SDK doesn't have yet
211
+
212
+ `request` sends any operation in the [API reference](https://docs.superclerk.com/reference), such as one newer than your
213
+ SDK, with the client's key, retries and timeouts, and answers its parsed body. Set `idempotent: true` on a write that
214
+ takes an `Idempotency-Key`, and the SDK sends one and repeats it on every retry.
215
+
216
+ ```ts
217
+ const contact = await superclerk.request<{ id: string }>({
218
+ method: "GET",
219
+ path: "/v1/contacts/cct_123",
220
+ response: "json",
221
+ })
222
+ ```
223
+
224
+ ## Debugging
225
+
226
+ Set `SUPERCLERK_LOG=debug` to print every attempt to stderr: its method, host and path, status, time and request ID,
227
+ and each retry with its wait. Queries are left out, since an upload URL's query is a credential.
228
+
229
+ ```text
230
+ [superclerk] POST api.superclerk.com/v1/tools/runs → 503 in 41 ms (req_8f2…)
231
+ [superclerk] retrying in 500 ms after 503
232
+ [superclerk] POST api.superclerk.com/v1/tools/runs → 202 in 1012 ms (req_c41…)
233
+ ```
234
+
235
+ Quote the request ID when you write to support.
236
+
237
+ ## Coding agents
238
+
239
+ Every method and type carries its documentation, and `api.md` lists every method, for the version you installed. Add
240
+ this to your repository's `AGENTS.md` or `CLAUDE.md` so an agent reads them before writing Superclerk code:
241
+
242
+ ```md
243
+ ## Superclerk
244
+
245
+ - Call the Superclerk API through `@superclerk/sdk`. Read `node_modules/@superclerk/sdk/README.md`, and `api.md`
246
+ beside it for every method, before writing Superclerk code.
247
+ - Run tools with `superclerk.tools.run`; it waits for the run and throws `ToolRunError` when the run fails.
248
+ - Ask before running a tool that writes, sends or posts. Never print or commit the API key.
249
+ - Docs: https://docs.superclerk.com/llms.txt, or the docs MCP server at https://docs.superclerk.com/mcp.
250
+ ```
251
+
252
+ Requests carry a `User-Agent` such as `superclerk-js/0.1.0 node/22.12.0 darwin-arm64`, which ends in the agent's name,
253
+ such as `agent/claude_code`, when a coding agent runs the process. It names the SDK, runtime and agent, nothing else.
254
+
255
+ ## API versions
256
+
257
+ The SDK pins the API version it was generated from, sent as the `Superclerk-Version` header, so a later API version
258
+ can't change answers under your code. Upgrading the SDK moves you to the newer version. `API_VERSION` names it.
259
+
260
+ ## Development
261
+
262
+ This package lives in the Superclerk repository. `bun run generate` regenerates `src/generated`, `api.md` and
263
+ `test/generated` from `docs-site/openapi.json` and `docs-site/integrations.json`; the hand-written client is in
264
+ `src/core` and the helpers above in `src/lib`. `bun test` runs the tests, and `bun run build` builds the package into
265
+ `dist`, then loads it in Node.
package/api.md ADDED
@@ -0,0 +1,310 @@
1
+ # Superclerk TypeScript SDK reference
2
+
3
+ Generated from the public OpenAPI document. Every method returns an `APIPromise`; a list method returns a `PagePromise` you can await for one page or iterate for every item. See the README for the hand-written helpers: `tools.run`, `tools.runs.wait`, `connect.links.wait`, `connections.fetch`, `social.media.upload` and `webhooks.unwrap`.
4
+
5
+ ## connect
6
+
7
+ ### connect.links
8
+
9
+ - `client.connect.links.create(params?)` → `ConnectLinkCreated` — `POST /v1/connect/links`
10
+ - `client.connect.links.get(connectLinkID)` → `ConnectLink` — `GET /v1/connect/links/{connectLinkID}`
11
+
12
+ ## webhooks
13
+
14
+ - `client.webhooks.list(params?)` → `WebhooksListResponse (paged)` — `GET /v1/webhooks`
15
+ - `client.webhooks.create(params)` → `WebhookCreated` — `POST /v1/webhooks`
16
+ - `client.webhooks.get(webhookID)` → `Webhook` — `GET /v1/webhooks/{webhookID}`
17
+ - `client.webhooks.disable(webhookID)` → `Webhook` — `POST /v1/webhooks/{webhookID}/disable`
18
+
19
+ ### webhooks.deliveries
20
+
21
+ - `client.webhooks.deliveries.list(webhookID, params?)` → `WebhooksDeliveriesListResponse (paged)` — `GET /v1/webhooks/{webhookID}/deliveries`
22
+ - `client.webhooks.deliveries.replay(deliveryID, params)` → `WebhooksDeliveriesReplayResponse` — `POST /v1/webhooks/{webhookID}/deliveries/{deliveryID}/replay`
23
+
24
+ ## tools
25
+
26
+ - `client.tools.list(params?)` → `ToolsListResponse` — `GET /v1/tools`
27
+
28
+ ### tools.runs
29
+
30
+ - `client.tools.runs.create(params)` → `ToolsRunsCreateResponse` — `POST /v1/tools/runs`
31
+ - `client.tools.runs.get(runID)` → `ToolsRunsGetResponse` — `GET /v1/tools/runs/{runID}`
32
+
33
+ ## workspaces
34
+
35
+ - `client.workspaces.list(params?)` → `WorkspacesListResponse (paged)` — `GET /v1/workspaces`
36
+ - `client.workspaces.create(params)` → `Workspace` — `POST /v1/workspaces`
37
+
38
+ ## apps
39
+
40
+ - `client.apps.list(params?)` → `AppsListResponse` — `GET /v1/apps`
41
+ - `client.apps.get(appID)` → `AppsGetResponse` — `GET /v1/apps/{appID}`
42
+
43
+ ### apps.tools
44
+
45
+ - `client.apps.tools.list(appID, params?)` → `AppsToolsListResponse` — `GET /v1/apps/{appID}/tools`
46
+
47
+ ## connections
48
+
49
+ - `client.connections.list(params?)` → `ConnectionsListResponse (paged)` — `GET /v1/connections`
50
+ - `client.connections.get(connectionID)` → `Connection` — `GET /v1/connections/{connectionID}`
51
+ - `client.connections.delete(connectionID)` → `Connection` — `DELETE /v1/connections/{connectionID}`
52
+
53
+ ### connections.accounts
54
+
55
+ - `client.connections.accounts.list(connectionID, params?)` → `ConnectionsAccountsListResponse` — `GET /v1/connections/{connectionID}/accounts`
56
+ - `client.connections.accounts.add(connectionID, params)` → `Connection` — `POST /v1/connections/{connectionID}/accounts`
57
+ - `client.connections.accounts.remove(connectionID, params)` → `Connection` — `DELETE /v1/connections/{connectionID}/accounts`
58
+
59
+ ### connections.tools
60
+
61
+ - `client.connections.tools.list(connectionID, params?)` → `ConnectionsToolsListResponse` — `GET /v1/connections/{connectionID}/tools`
62
+
63
+ ### connections.proxy
64
+
65
+ - `client.connections.proxy.get(providerPath, params)` → `Response` — `GET /v1/connections/{connectionID}/proxy/{providerPath}`
66
+ - `client.connections.proxy.post(providerPath, params)` → `Response` — `POST /v1/connections/{connectionID}/proxy/{providerPath}`
67
+ - `client.connections.proxy.delete(providerPath, params)` → `Response` — `DELETE /v1/connections/{connectionID}/proxy/{providerPath}`
68
+
69
+ #### connections.proxy.runs
70
+
71
+ - `client.connections.proxy.runs.get(runID)` → `Response` — `GET /v1/connections/proxy/runs/{runID}`
72
+
73
+ ## social
74
+
75
+ ### social.accounts
76
+
77
+ - `client.social.accounts.list()` → `SocialAccountsListResponse` — `GET /v1/social/accounts`
78
+ - `client.social.accounts.disconnect(socialAccountID)` → `SocialAccountsDisconnectResponse` — `DELETE /v1/social/accounts/{socialAccountID}`
79
+
80
+ #### social.accounts.analytics
81
+
82
+ - `client.social.accounts.analytics.overview(socialAccountID)` → `SocialAccountsAnalyticsOverviewResponse` — `GET /v1/social/accounts/{socialAccountID}/analytics`
83
+ - `client.social.accounts.analytics.posts(socialAccountID, params?)` → `SocialAccountsAnalyticsPostsResponse` — `GET /v1/social/accounts/{socialAccountID}/analytics/posts`
84
+
85
+ #### social.accounts.tiktok
86
+
87
+ - `client.social.accounts.tiktok.analytics(socialAccountID)` → `SocialAccountsTiktokAnalyticsResponse` — `GET /v1/social/accounts/{socialAccountID}/tiktok/analytics`
88
+ - `client.social.accounts.tiktok.videos(socialAccountID, params?)` → `SocialAccountsTiktokVideosResponse` — `GET /v1/social/accounts/{socialAccountID}/tiktok/videos`
89
+
90
+ ### social.media
91
+
92
+ - `client.social.media.list(params?)` → `SocialMediaListResponse (paged)` — `GET /v1/social/media`
93
+ - `client.social.media.create(params)` → `SocialMediaCreateResponse` — `POST /v1/social/media`
94
+ - `client.social.media.confirm(mediaID)` → `SocialMediaConfirmResponse` — `POST /v1/social/media/{mediaID}/confirm`
95
+ - `client.social.media.download(mediaID)` → `SocialMediaDownloadResponse` — `GET /v1/social/media/{mediaID}/download`
96
+ - `client.social.media.get(mediaID)` → `SocialMediaGetResponse` — `GET /v1/social/media/{mediaID}`
97
+
98
+ ### social.posts
99
+
100
+ - `client.social.posts.list(params?)` → `SocialPostsListResponse (paged)` — `GET /v1/social/posts`
101
+ - `client.social.posts.create(params)` → `SocialPostsCreateResponse` — `POST /v1/social/posts`
102
+ - `client.social.posts.get(postID)` → `SocialPostsGetResponse` — `GET /v1/social/posts/{postID}`
103
+ - `client.social.posts.update(postID, params)` → `SocialPostsUpdateResponse` — `PUT /v1/social/posts/{postID}`
104
+ - `client.social.posts.reschedule(postID, params)` → `SocialPostsRescheduleResponse` — `POST /v1/social/posts/{postID}/reschedule`
105
+ - `client.social.posts.cancel(postID, params)` → `SocialPostsCancelResponse` — `POST /v1/social/posts/{postID}/cancel`
106
+
107
+ ## conversations
108
+
109
+ - `client.conversations.list(params?)` → `ConversationsListResponse (paged)` — `GET /v1/conversations`
110
+ - `client.conversations.get(conversationID)` → `Conversation` — `GET /v1/conversations/{conversationID}`
111
+ - `client.conversations.update(conversationID, params)` → `Conversation` — `PATCH /v1/conversations/{conversationID}`
112
+ - `client.conversations.takeOver(conversationID)` → `Conversation` — `POST /v1/conversations/{conversationID}/take_over`
113
+ - `client.conversations.handBack(conversationID)` → `Conversation` — `POST /v1/conversations/{conversationID}/hand_back`
114
+
115
+ ### conversations.messages
116
+
117
+ - `client.conversations.messages.list(conversationID, params?)` → `ConversationsMessagesListResponse (paged)` — `GET /v1/conversations/{conversationID}/messages`
118
+ - `client.conversations.messages.create(conversationID, params)` → `ConversationMessage` — `POST /v1/conversations/{conversationID}/messages`
119
+
120
+ ## tags
121
+
122
+ - `client.tags.list(params?)` → `TagsListResponse (paged)` — `GET /v1/tags`
123
+ - `client.tags.create(params)` → `TagsCreateResponse` — `POST /v1/tags`
124
+
125
+ ## contacts
126
+
127
+ - `client.contacts.list(params?)` → `ContactsListResponse (paged)` — `GET /v1/contacts`
128
+ - `client.contacts.create(params)` → `Contact` — `POST /v1/contacts`
129
+ - `client.contacts.import(params)` → `ContactImport` — `POST /v1/contacts/import`
130
+ - `client.contacts.get(contactID)` → `Contact` — `GET /v1/contacts/{contactID}`
131
+ - `client.contacts.update(contactID, params)` → `Contact` — `PATCH /v1/contacts/{contactID}`
132
+ - `client.contacts.archive(contactID, params)` → `Contact` — `POST /v1/contacts/{contactID}/archive`
133
+ - `client.contacts.unarchive(contactID, params)` → `Contact` — `POST /v1/contacts/{contactID}/unarchive`
134
+ - `client.contacts.merge(contactID, params)` → `Contact` — `POST /v1/contacts/{contactID}/merge`
135
+
136
+ ### contacts.lifecycle
137
+
138
+ - `client.contacts.lifecycle.get()` → `ContactLifecycle` — `GET /v1/contacts/lifecycle`
139
+ - `client.contacts.lifecycle.update(params)` → `ContactLifecycle` — `PUT /v1/contacts/lifecycle`
140
+
141
+ #### contacts.lifecycle.stages
142
+
143
+ - `client.contacts.lifecycle.stages.create(params)` → `ContactLifecycle` — `POST /v1/contacts/lifecycle/stages`
144
+ - `client.contacts.lifecycle.stages.archive(lifecycleStageID, params)` → `ContactLifecycle` — `POST /v1/contacts/lifecycle/stages/{lifecycleStageID}/archive`
145
+
146
+ ### contacts.identities
147
+
148
+ - `client.contacts.identities.create(contactID, params)` → `ContactIdentity` — `POST /v1/contacts/{contactID}/identities`
149
+ - `client.contacts.identities.delete(identityID, params)` → `Contact` — `DELETE /v1/contacts/{contactID}/identities/{identityID}`
150
+ - `client.contacts.identities.move(identityID, params)` → `Contact` — `POST /v1/contacts/{contactID}/identities/{identityID}/move`
151
+
152
+ ### contacts.notes
153
+
154
+ - `client.contacts.notes.list(contactID, params?)` → `ContactsNotesListResponse (paged)` — `GET /v1/contacts/{contactID}/notes`
155
+ - `client.contacts.notes.create(contactID, params)` → `ContactNote` — `POST /v1/contacts/{contactID}/notes`
156
+ - `client.contacts.notes.delete(noteID, params)` → `Contact` — `DELETE /v1/contacts/{contactID}/notes/{noteID}`
157
+
158
+ ### contacts.tags
159
+
160
+ - `client.contacts.tags.add(tagID, params)` → `Contact` — `PUT /v1/contacts/{contactID}/tags/{tagID}`
161
+ - `client.contacts.tags.remove(tagID, params)` → `Contact` — `DELETE /v1/contacts/{contactID}/tags/{tagID}`
162
+
163
+ ### contacts.opportunities
164
+
165
+ - `client.contacts.opportunities.list(contactID, params?)` → `ContactsOpportunitiesListResponse (paged)` — `GET /v1/contacts/{contactID}/opportunities`
166
+
167
+ ## customFields
168
+
169
+ - `client.customFields.list(params)` → `CustomFieldsListResponse (paged)` — `GET /v1/custom_fields`
170
+ - `client.customFields.create(params)` → `CustomFieldsCreateResponse` — `POST /v1/custom_fields`
171
+ - `client.customFields.update(customFieldID, params)` → `CustomField` — `PUT /v1/custom_fields/{customFieldID}`
172
+ - `client.customFields.archive(customFieldID, params)` → `CustomField` — `POST /v1/custom_fields/{customFieldID}/archive`
173
+ - `client.customFields.unarchive(customFieldID, params)` → `CustomField` — `POST /v1/custom_fields/{customFieldID}/unarchive`
174
+
175
+ ## members
176
+
177
+ - `client.members.list(params?)` → `MembersListResponse (paged)` — `GET /v1/members`
178
+ - `client.members.get(memberID)` → `Member` — `GET /v1/members/{memberID}`
179
+
180
+ ## pipelines
181
+
182
+ - `client.pipelines.list(params?)` → `PipelinesListResponse (paged)` — `GET /v1/pipelines`
183
+ - `client.pipelines.create(params)` → `Pipeline` — `POST /v1/pipelines`
184
+ - `client.pipelines.get(pipelineID)` → `Pipeline` — `GET /v1/pipelines/{pipelineID}`
185
+ - `client.pipelines.update(pipelineID, params)` → `Pipeline` — `PUT /v1/pipelines/{pipelineID}`
186
+ - `client.pipelines.archive(pipelineID, params)` → `Pipeline` — `POST /v1/pipelines/{pipelineID}/archive`
187
+
188
+ ### pipelines.stages
189
+
190
+ - `client.pipelines.stages.archive(stageID, params)` → `Pipeline` — `POST /v1/pipelines/{pipelineID}/stages/{stageID}/archive`
191
+
192
+ ## opportunities
193
+
194
+ - `client.opportunities.list(params)` → `OpportunitiesListResponse (paged)` — `GET /v1/opportunities`
195
+ - `client.opportunities.create(params)` → `Opportunity` — `POST /v1/opportunities`
196
+ - `client.opportunities.get(opportunityID)` → `Opportunity` — `GET /v1/opportunities/{opportunityID}`
197
+ - `client.opportunities.update(opportunityID, params)` → `Opportunity` — `PATCH /v1/opportunities/{opportunityID}`
198
+ - `client.opportunities.move(opportunityID, params)` → `Opportunity` — `POST /v1/opportunities/{opportunityID}/move`
199
+ - `client.opportunities.archive(opportunityID, params)` → `Opportunity` — `POST /v1/opportunities/{opportunityID}/archive`
200
+ - `client.opportunities.unarchive(opportunityID, params)` → `Opportunity` — `POST /v1/opportunities/{opportunityID}/unarchive`
201
+
202
+ ### opportunities.history
203
+
204
+ - `client.opportunities.history.list(opportunityID, params?)` → `OpportunitiesHistoryListResponse (paged)` — `GET /v1/opportunities/{opportunityID}/history`
205
+
206
+ ## tasks
207
+
208
+ - `client.tasks.list(params?)` → `TasksListResponse (paged)` — `GET /v1/tasks`
209
+ - `client.tasks.create(params)` → `Task` — `POST /v1/tasks`
210
+ - `client.tasks.update(taskID, params)` → `Task` — `PATCH /v1/tasks/{taskID}`
211
+ - `client.tasks.archive(taskID, params)` → `Task` — `POST /v1/tasks/{taskID}/archive`
212
+
213
+ ## inbox
214
+
215
+ ### inbox.accounts
216
+
217
+ - `client.inbox.accounts.list(params?)` → `InboxAccountsListResponse (paged)` — `GET /v1/inbox/accounts`
218
+ - `client.inbox.accounts.remove(connectionID, params?)` → `InboxAIRemoval` — `POST /v1/inbox/accounts/{connectionID}/remove`
219
+
220
+ #### inbox.accounts.ai
221
+
222
+ - `client.inbox.accounts.ai.create(connectionID, params)` → `InboxAI` — `POST /v1/inbox/accounts/{connectionID}/ai`
223
+
224
+ #### inbox.accounts.settings
225
+
226
+ - `client.inbox.accounts.settings.get(connectionID, params?)` → `InboxAccountSettings` — `GET /v1/inbox/accounts/{connectionID}/settings`
227
+ - `client.inbox.accounts.settings.update(connectionID, params)` → `InboxAccountSettings` — `PUT /v1/inbox/accounts/{connectionID}/settings`
228
+
229
+ ### inbox.templates
230
+
231
+ - `client.inbox.templates.list(params?)` → `InboxTemplatesListResponse (paged)` — `GET /v1/inbox/templates`
232
+
233
+ ### inbox.agents
234
+
235
+ - `client.inbox.agents.republish(agentID)` → `InboxAgentUpdate` — `POST /v1/inbox/agents/{agentID}/republish`
236
+
237
+ ## workflows
238
+
239
+ - `client.workflows.list(params?)` → `WorkflowsListResponse` — `GET /v1/workflows`
240
+ - `client.workflows.create(params)` → `WorkflowsCreateResponse` — `POST /v1/workflows`
241
+ - `client.workflows.batchGet(params)` → `WorkflowsBatchGetResponse` — `POST /v1/workflows/batch_get`
242
+ - `client.workflows.test(workflowID, params)` → `WorkflowRun` — `POST /v1/workflows/{workflowID}/test`
243
+ - `client.workflows.get(workflowID)` → `WorkflowsGetResponse` — `GET /v1/workflows/{workflowID}`
244
+ - `client.workflows.validate(workflowID)` → `WorkflowsValidateResponse` — `POST /v1/workflows/{workflowID}/validate`
245
+ - `client.workflows.publish(workflowID, params)` → `WorkflowsPublishResponse` — `POST /v1/workflows/{workflowID}/publish`
246
+ - `client.workflows.archive(workflowID, params)` → `WorkflowsArchiveResponse` — `POST /v1/workflows/{workflowID}/archive`
247
+ - `client.workflows.pause(workflowID)` → `WorkflowsPauseResponse` — `POST /v1/workflows/{workflowID}/pause`
248
+ - `client.workflows.resume(workflowID)` → `WorkflowsResumeResponse` — `POST /v1/workflows/{workflowID}/resume`
249
+
250
+ ### workflows.catalog
251
+
252
+ - `client.workflows.catalog.get()` → `WorkflowCatalogResponse` — `GET /v1/workflows/catalog`
253
+
254
+ ### workflows.templates
255
+
256
+ - `client.workflows.templates.list()` → `WorkflowsTemplatesListResponse` — `GET /v1/workflows/templates`
257
+ - `client.workflows.templates.instantiate(templateID, params)` → `WorkflowsTemplatesInstantiateResponse` — `POST /v1/workflows/templates/{templateID}/instantiate`
258
+
259
+ ### workflows.alertDestinations
260
+
261
+ - `client.workflows.alertDestinations.list()` → `WorkflowsAlertDestinationsListResponse` — `GET /v1/workflows/alert_destinations`
262
+ - `client.workflows.alertDestinations.create(params)` → `WorkflowFailureAlertDestination` — `POST /v1/workflows/alert_destinations`
263
+ - `client.workflows.alertDestinations.delete(alertDestinationID)` → `WorkflowsAlertDestinationsDeleteResponse` — `DELETE /v1/workflows/alert_destinations/{alertDestinationID}`
264
+
265
+ ### workflows.triggerFailures
266
+
267
+ - `client.workflows.triggerFailures.list(params?)` → `WorkflowsTriggerFailuresListResponse` — `GET /v1/workflows/trigger_failures`
268
+ - `client.workflows.triggerFailures.retry(triggerFailureID)` → `WorkflowsTriggerFailuresRetryResponse` — `POST /v1/workflows/trigger_failures/{triggerFailureID}/retry`
269
+
270
+ ### workflows.runs
271
+
272
+ - `client.workflows.runs.list(params?)` → `WorkflowsRunsListResponse` — `GET /v1/workflows/runs`
273
+ - `client.workflows.runs.get(workflowRunID)` → `WorkflowsRunsGetResponse` — `GET /v1/workflows/runs/{workflowRunID}`
274
+ - `client.workflows.runs.cancel(workflowRunID)` → `WorkflowRun` — `POST /v1/workflows/runs/{workflowRunID}/cancel`
275
+ - `client.workflows.runs.rerun(workflowRunID, params)` → `WorkflowRun` — `POST /v1/workflows/runs/{workflowRunID}/rerun`
276
+ - `client.workflows.runs.create(workflowID, params)` → `WorkflowRun` — `POST /v1/workflows/{workflowID}/runs`
277
+
278
+ #### workflows.runs.steps
279
+
280
+ - `client.workflows.runs.steps.get(stepID, params)` → `WorkflowActivationPayload` — `GET /v1/workflows/runs/{workflowRunID}/steps/{stepID}`
281
+ - `client.workflows.runs.steps.signal(stepID, params)` → `WorkflowsRunsStepsSignalResponse` — `POST /v1/workflows/runs/{workflowRunID}/steps/{stepID}/signal`
282
+
283
+ ### workflows.humanTasks
284
+
285
+ - `client.workflows.humanTasks.list(params?)` → `WorkflowsHumanTasksListResponse` — `GET /v1/workflows/human_tasks`
286
+ - `client.workflows.humanTasks.get(humanTaskID)` → `WorkflowHumanTask` — `GET /v1/workflows/human_tasks/{humanTaskID}`
287
+ - `client.workflows.humanTasks.resolve(humanTaskID, params)` → `WorkflowHumanTask` — `POST /v1/workflows/human_tasks/{humanTaskID}/resolve`
288
+
289
+ ### workflows.draft
290
+
291
+ - `client.workflows.draft.update(workflowID, params)` → `WorkflowsDraftUpdateResponse` — `PUT /v1/workflows/{workflowID}/draft`
292
+
293
+ ### workflows.webhook
294
+
295
+ - `client.workflows.webhook.get(workflowID)` → `WorkflowsWebhookGetResponse` — `GET /v1/workflows/{workflowID}/webhook`
296
+ - `client.workflows.webhook.rotate(workflowID, params)` → `WorkflowWebhookSecretReveal` — `POST /v1/workflows/{workflowID}/webhook/rotate`
297
+
298
+ ### workflows.versions
299
+
300
+ - `client.workflows.versions.list(workflowID, params?)` → `WorkflowsVersionsListResponse` — `GET /v1/workflows/{workflowID}/versions`
301
+ - `client.workflows.versions.get(workflowVersionID, params)` → `WorkflowVersionSnapshot` — `GET /v1/workflows/{workflowID}/versions/{workflowVersionID}`
302
+ - `client.workflows.versions.activate(workflowVersionID, params)` → `WorkflowsVersionsActivateResponse` — `POST /v1/workflows/{workflowID}/versions/{workflowVersionID}/activate`
303
+
304
+ ## agents
305
+
306
+ - `client.agents.list()` → `WorkflowAgentsResponse` — `GET /v1/agents`
307
+
308
+ ## receptionists
309
+
310
+ - `client.receptionists.list()` → `ReceptionistsListResponse` — `GET /v1/receptionists`
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What every method returns: a promise of the parsed answer that also hands over the raw response. The request starts
3
+ * when the method is called, like fetch; the body is parsed once, when the promise is first awaited.
4
+ */
5
+ export declare class APIPromise<T> extends Promise<T> {
6
+ #private;
7
+ private readonly response;
8
+ private readonly parse;
9
+ constructor(response: Promise<Response>, parse: (response: Response) => Promise<T>);
10
+ /** The raw response, its body unread. Await the promise or call withResponse instead to read the body. */
11
+ asResponse(): Promise<Response>;
12
+ /** The parsed answer with the response it came in and the request's ID. */
13
+ withResponse(): Promise<{
14
+ data: T;
15
+ response: Response;
16
+ requestID: string | null;
17
+ }>;
18
+ private parsed;
19
+ then<Result = T, Failure = never>(onfulfilled?: ((value: T) => Result | PromiseLike<Result>) | null, onrejected?: ((reason: unknown) => Failure | PromiseLike<Failure>) | null): Promise<Result | Failure>;
20
+ catch<Failure = never>(onrejected?: ((reason: unknown) => Failure | PromiseLike<Failure>) | null): Promise<T | Failure>;
21
+ finally(onfinally?: (() => void) | null): Promise<T>;
22
+ }
23
+ /**
24
+ * Reads the body of an answer the SDK parses. Your abort rejects with its reason; any other failure means the answer
25
+ * never arrived whole.
26
+ */
27
+ export declare function readBody<T>(read: Promise<T>, signal: AbortSignal | undefined): Promise<T>;