@arbol-ai/sdk 1.20261019.4056 → 2.2.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/README.md +38 -23
- package/dist/raiz/agents/client.js +2 -2
- package/dist/raiz/agents/index.d.ts +1 -1
- package/dist/raiz/agents/models.d.ts +1 -46
- package/dist/raiz/agents/models.js +1 -5
- package/dist/raiz/bulletins/client.d.ts +182 -0
- package/dist/raiz/bulletins/client.js +53 -0
- package/dist/raiz/bulletins/index.d.ts +5 -0
- package/dist/raiz/bulletins/index.js +4 -0
- package/dist/raiz/bulletins/models.d.ts +53 -0
- package/dist/raiz/bulletins/models.js +12 -0
- package/dist/raiz/campaigns/client.js +2 -2
- package/dist/raiz/campaigns/index.d.ts +1 -1
- package/dist/raiz/campaigns/models.d.ts +6 -57
- package/dist/raiz/campaigns/models.js +1 -9
- package/dist/raiz/changes/client.js +1 -1
- package/dist/raiz/changes/models.d.ts +2 -2
- package/dist/raiz/channels/client.d.ts +2 -2
- package/dist/raiz/channels/client.js +3 -3
- package/dist/raiz/channels/index.d.ts +1 -1
- package/dist/raiz/channels/models.d.ts +23 -96
- package/dist/raiz/channels/models.js +2 -8
- package/dist/raiz/client.d.ts +2 -0
- package/dist/raiz/client.js +5 -0
- package/dist/raiz/contacts/client.js +6 -6
- package/dist/raiz/contacts/index.d.ts +1 -1
- package/dist/raiz/contacts/models.d.ts +4 -40
- package/dist/raiz/contacts/models.js +2 -8
- package/dist/raiz/conversations/client.d.ts +17 -11
- package/dist/raiz/conversations/client.js +5 -5
- package/dist/raiz/conversations/index.d.ts +1 -1
- package/dist/raiz/conversations/models.d.ts +17 -103
- package/dist/raiz/conversations/models.js +5 -12
- package/dist/raiz/definitions/client.js +2 -2
- package/dist/raiz/evalCases/client.js +2 -2
- package/dist/raiz/evalRuns/client.js +1 -1
- package/dist/raiz/facts/client.js +1 -1
- package/dist/raiz/index.d.ts +1 -1
- package/dist/raiz/knowledge/client.d.ts +3 -2
- package/dist/raiz/knowledge/client.js +4 -4
- package/dist/raiz/knowledge/index.d.ts +1 -1
- package/dist/raiz/knowledge/models.d.ts +1 -42
- package/dist/raiz/knowledge/models.js +1 -6
- package/dist/raiz/members/client.d.ts +3 -2
- package/dist/raiz/models.d.ts +17 -0
- package/dist/raiz/organization/client.d.ts +4 -2
- package/dist/raiz/organization/client.js +2 -2
- package/dist/raiz/organization/index.d.ts +1 -1
- package/dist/raiz/organization/models.d.ts +6 -4
- package/dist/raiz/profiles/client.js +2 -2
- package/dist/raiz/reports/client.d.ts +10 -9
- package/dist/raiz/reports/client.js +1 -1
- package/dist/raiz/reports/models.d.ts +2 -0
- package/dist/raiz/suppressions/client.d.ts +2 -1
- package/dist/raiz/suppressions/client.js +1 -1
- package/dist/raiz/tasks/client.js +4 -4
- package/dist/raiz/templates/client.d.ts +2 -1
- package/dist/raiz/voices/client.js +1 -1
- package/package.json +9 -3
package/README.md
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
The Arbol API for TypeScript and JavaScript, generated by
|
|
4
4
|
[Cloudflare Forge](https://github.com/cloudflare/forge) from the platform's public OpenAPI,
|
|
5
5
|
[`https://api.getarbol.com/openapi.json`](https://api.getarbol.com/openapi.json). Everything in `src/`
|
|
6
|
-
is Forge's TypeScript output, unedited, and
|
|
7
|
-
from (`
|
|
6
|
+
is Forge's TypeScript output, unedited. Versions are semver, and each one records the OpenAPI it was
|
|
7
|
+
generated from: `npm view @arbol-ai/sdk@<version> arbol.openapi` prints its `release` (`info.version`)
|
|
8
|
+
and content hash (`sha256`).
|
|
8
9
|
|
|
9
10
|
```sh
|
|
10
11
|
npm install @arbol-ai/sdk
|
|
@@ -56,49 +57,63 @@ The server authorizes every call: a method in the client is not a grant.
|
|
|
56
57
|
bun install
|
|
57
58
|
bun run forge # build the pinned Cloudflare Forge with cargo into .forge/ (once; needs Rust)
|
|
58
59
|
bun run openapi # download https://api.getarbol.com/openapi.json
|
|
59
|
-
bun run generate # src/ from openapi.json with `forge --target ts`;
|
|
60
|
+
bun run generate # src/ from openapi.json with `forge --target ts`; its release and hash in arbol.openapi
|
|
60
61
|
bun run hash # the OpenAPI's content hash (see Releases)
|
|
61
62
|
bun run verify # typecheck and build dist/
|
|
62
63
|
```
|
|
63
64
|
|
|
64
|
-
`openapi.json` is downloaded at generation time and not committed
|
|
65
|
-
OpenAPI
|
|
66
|
-
|
|
65
|
+
`openapi.json` is downloaded at generation time and not committed. `package.json`'s `arbol.openapi`
|
|
66
|
+
records the OpenAPI `src/` was generated from, its `info.version` as `release` and its content hash as
|
|
67
|
+
`sha256`; `version` and `arbol` are release metadata the workflows set. Forge is pinned to its commit
|
|
67
68
|
`7f86447210b7bea3779bfdab3cd5655eade0eadb` (0.1.0) in the `forge` script.
|
|
68
69
|
|
|
69
70
|
## Releases
|
|
70
71
|
|
|
71
|
-
|
|
72
|
+
Versions are semver, independent of the OpenAPI's release number. The 1.x versions (`1.YYYYMMDD.n`)
|
|
73
|
+
were the OpenAPI's date releases; 2.x starts at 2.1.0.
|
|
74
|
+
|
|
75
|
+
Releases of a new OpenAPI are automatic, from the API down to the CLI:
|
|
72
76
|
|
|
73
77
|
1. **Gateway.** When the Arbol API ships an OpenAPI release, the gateway sends this repository a
|
|
74
78
|
`repository_dispatch` `openapi-release` with `{ "version": "<release>" }`.
|
|
75
79
|
2. **SDK (this repository).** [Generate](.github/workflows/generate.yml) runs on that dispatch, every
|
|
76
80
|
six hours, and by hand. It downloads the OpenAPI (waiting until the API serves the announced release)
|
|
77
|
-
and hashes its content. When the hash differs from
|
|
78
|
-
with Forge,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
and hashes its content. When the hash differs from `arbol.openapi.sha256` in `package.json`, it
|
|
82
|
+
regenerates `src/` with Forge, records the OpenAPI in `arbol.openapi`, and takes the highest version
|
|
83
|
+
on npm with the minor raised and the patch at 0 (2.1.0, 2.2.0, 2.3.0, …). It verifies the result,
|
|
84
|
+
commits `Release <version>` to `main` as Arbol, and publishes `@arbol-ai/sdk` to npm with
|
|
85
|
+
[Publish](.github/workflows/publish.yml), with a provenance statement.
|
|
86
|
+
3. **CLI.** After publishing, Publish sends
|
|
81
87
|
[project-arbol-cli](https://github.com/getarbol/project-arbol-cli) a `repository_dispatch`
|
|
82
|
-
`sdk-release` with `{ "version": "<published version>", "
|
|
83
|
-
releases itself on it.
|
|
88
|
+
`sdk-release` with `{ "version": "<published version>", "openapi": { "release": "…", "sha256": "…" } }`,
|
|
89
|
+
the published `version` and `arbol.openapi`, and the CLI releases itself on it.
|
|
84
90
|
|
|
85
91
|
The hash ([`scripts/release.ts`](scripts/release.ts)) is the SHA-256 hex of the OpenAPI's canonical
|
|
86
92
|
JSON (object keys sorted recursively, arrays in order, no whitespace) with `info.version` removed. A new
|
|
87
|
-
release number with an identical API hashes the same, so
|
|
88
|
-
A version on `main` that is not on npm yet, such as one a failed run left behind, is published
|
|
89
|
-
next run.
|
|
93
|
+
release number with an identical API hashes the same, so Generate commits, publishes, and announces
|
|
94
|
+
nothing. A version on `main` that is not on npm yet, such as one a failed run left behind, is published
|
|
95
|
+
by the next run.
|
|
96
|
+
|
|
97
|
+
Changes to the SDK itself, such as a new Forge pin, are released by hand: commit them to `main`
|
|
98
|
+
(regenerated with `bun run generate` when they change `src/`), then run Publish on `main` with `bump`
|
|
99
|
+
`patch` (the default), `minor` or `major`:
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
gh workflow run publish.yml --repo getarbol/project-arbol-sdk-js --ref main -f bump=patch
|
|
103
|
+
```
|
|
90
104
|
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
It raises that part of the highest version on npm (while no 2.x version is published, the result is
|
|
106
|
+
2.1.0 whatever the bump), commits `Release <version>` to `main`, publishes it, and announces it to the
|
|
107
|
+
CLI like Generate. It refuses when `main`'s version is not on npm yet (run Generate, which publishes it),
|
|
108
|
+
and when nothing that goes into the package (`src/`, `package.json`, `tsconfig.json`, `bun.lock`,
|
|
109
|
+
`README.md`, `LICENSE`) changed since the commit that released `main`'s version, so the same SDK is
|
|
110
|
+
never published twice. A manual release and Generate wait for each other.
|
|
93
111
|
|
|
94
|
-
Generate
|
|
95
|
-
[Verify](.github/workflows/verify.yml).
|
|
112
|
+
Generate and Publish push and dispatch as the Arbol Bot GitHub App, so their commits to `main` run
|
|
113
|
+
[Verify](.github/workflows/verify.yml). They need the organization variable `ARBOL_BOT_APP_ID`, the
|
|
96
114
|
organization secret `ARBOL_BOT_PRIVATE_KEY`, and the App installed with contents write access to this
|
|
97
115
|
repository and project-arbol-cli. npm publishing uses the organization secret `NPM_TOKEN`.
|
|
98
116
|
|
|
99
|
-
Run Publish by hand on `main` to publish the version in `package.json`; a version that is already on npm
|
|
100
|
-
is left untouched.
|
|
101
|
-
|
|
102
117
|
## License
|
|
103
118
|
|
|
104
119
|
[Apache License 2.0](LICENSE)
|
|
@@ -26,14 +26,14 @@ const GetOperation = {
|
|
|
26
26
|
route: "/v1/raiz/agents/get",
|
|
27
27
|
query: { agentId: "agentId" },
|
|
28
28
|
response: object([["data", null, () => RaizAgentCodec]]),
|
|
29
|
-
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "
|
|
29
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
30
30
|
};
|
|
31
31
|
const ListOperation = {
|
|
32
32
|
method: "GET",
|
|
33
33
|
route: "/v1/raiz/agents",
|
|
34
34
|
query: { cursor: "cursor", direction: "direction", limit: "limit", modality: "modality", q: "q", status: "status" },
|
|
35
35
|
response: object([["data", null, () => RaizAgentPageCodec]]),
|
|
36
|
-
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "
|
|
36
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
37
37
|
};
|
|
38
38
|
const UpdateOperation = {
|
|
39
39
|
method: "PATCH",
|
|
@@ -2,4 +2,4 @@ export { ApiError } from "../../_/index.js";
|
|
|
2
2
|
export type { RequestOptions } from "../../_/index.js";
|
|
3
3
|
export { createClient } from "./client.js";
|
|
4
4
|
export type { Client, ClientOptions, CreateRequest, CreateResponse, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
|
|
5
|
-
export type { RaizAgent, RaizAgentGreeting, RaizAgentIntegrationToolInput, RaizAgentModelTrial, RaizAgentPage, RaizAgentSettings, RaizAgentSettingsInput,
|
|
5
|
+
export type { RaizAgent, RaizAgentGreeting, RaizAgentIntegrationToolInput, RaizAgentModelTrial, RaizAgentPage, RaizAgentSettings, RaizAgentSettingsInput, RaizAgentTurnPolicy, RaizAgentVoiceSettings, } from "./models.js";
|
|
@@ -126,7 +126,7 @@ export interface RaizAgentPage {
|
|
|
126
126
|
/**
|
|
127
127
|
* Items admitted by this resource contract within the verified organization.
|
|
128
128
|
*/
|
|
129
|
-
data:
|
|
129
|
+
data: RaizAgent[];
|
|
130
130
|
/**
|
|
131
131
|
* Discriminator for a resource list response.
|
|
132
132
|
*/
|
|
@@ -181,50 +181,6 @@ export interface RaizAgentSettingsInput {
|
|
|
181
181
|
toolDiscovery?: boolean | null;
|
|
182
182
|
voice?: RaizAgentVoiceSettings | null;
|
|
183
183
|
}
|
|
184
|
-
export interface RaizAgentSummary {
|
|
185
|
-
channelCount: number;
|
|
186
|
-
/**
|
|
187
|
-
* An instant in RFC 3339 format, in UTC.
|
|
188
|
-
*/
|
|
189
|
-
createdAt: Temporal.Instant;
|
|
190
|
-
description: string | null;
|
|
191
|
-
firstMessage: string | null;
|
|
192
|
-
/**
|
|
193
|
-
* Agent id.
|
|
194
|
-
*/
|
|
195
|
-
id: string;
|
|
196
|
-
/**
|
|
197
|
-
* BCP 47 language tag.
|
|
198
|
-
*/
|
|
199
|
-
language: string;
|
|
200
|
-
/**
|
|
201
|
-
* `voice`: phone calls. `text`: WhatsApp and web chat.
|
|
202
|
-
*/
|
|
203
|
-
modality: "voice" | "text";
|
|
204
|
-
name: string;
|
|
205
|
-
/**
|
|
206
|
-
* Whether the Agent can hold conversations: active, with instructions and,
|
|
207
|
-
* for voice, published for calls.
|
|
208
|
-
*/
|
|
209
|
-
ready: boolean;
|
|
210
|
-
/**
|
|
211
|
-
* A paused Agent answers nothing and places no calls.
|
|
212
|
-
*/
|
|
213
|
-
status: "active" | "paused";
|
|
214
|
-
syncErrorCode: string | null;
|
|
215
|
-
/**
|
|
216
|
-
* Whether calls already use the current version (it is published on the
|
|
217
|
-
* Agent's voice channels). Always true for text Agents.
|
|
218
|
-
*/
|
|
219
|
-
synced: boolean;
|
|
220
|
-
timeZone: string | null;
|
|
221
|
-
toolCount: number;
|
|
222
|
-
/**
|
|
223
|
-
* An instant in RFC 3339 format, in UTC.
|
|
224
|
-
*/
|
|
225
|
-
updatedAt: Temporal.Instant;
|
|
226
|
-
version: number;
|
|
227
|
-
}
|
|
228
184
|
export interface RaizAgentTurnPolicy {
|
|
229
185
|
/**
|
|
230
186
|
* Output tokens per model call, reasoning included. Default 4096.
|
|
@@ -282,4 +238,3 @@ export interface RaizAgentVoiceSettings {
|
|
|
282
238
|
export declare const RaizAgentCodec: import("../../_/codec.js").Codec;
|
|
283
239
|
export declare const RaizAgentPageCodec: import("../../_/codec.js").Codec;
|
|
284
240
|
export declare const RaizAgentSettingsInputCodec: import("../../_/codec.js").Codec;
|
|
285
|
-
export declare const RaizAgentSummaryCodec: import("../../_/codec.js").Codec;
|
|
@@ -7,12 +7,8 @@ export const RaizAgentCodec = object([
|
|
|
7
7
|
["updatedAt", null, instant],
|
|
8
8
|
]);
|
|
9
9
|
export const RaizAgentPageCodec = object([
|
|
10
|
-
["data", null, array(() =>
|
|
10
|
+
["data", null, array(() => RaizAgentCodec)],
|
|
11
11
|
]);
|
|
12
12
|
export const RaizAgentSettingsInputCodec = object([
|
|
13
13
|
["businessHours", null, () => RaizBusinessHoursCodec],
|
|
14
14
|
]);
|
|
15
|
-
export const RaizAgentSummaryCodec = object([
|
|
16
|
-
["createdAt", null, instant],
|
|
17
|
-
["updatedAt", null, instant],
|
|
18
|
-
]);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
|
|
2
|
+
import type { DeletedObject, ResponseMetadata } from "../../models.js";
|
|
3
|
+
import { type RaizBulletin, type RaizBulletinPage } from "./models.js";
|
|
4
|
+
export interface ClientOptions extends BaseClientOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The URL the paths of the API are relative to.
|
|
7
|
+
*/
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Client {
|
|
11
|
+
/**
|
|
12
|
+
* Post a bulletin
|
|
13
|
+
*
|
|
14
|
+
* Post a bulletin: something happening now that the organization's Agents
|
|
15
|
+
* must apply on calls, WhatsApp and web chat while it lasts (for example:
|
|
16
|
+
* there is no nutrition service; no appointments at the North site for four
|
|
17
|
+
* days; closed on Monday the 26th; a promotion). Write `text` as you would
|
|
18
|
+
* tell the Agents, including what they should offer instead. Omit `agentId`
|
|
19
|
+
* for every Agent, or name one Agent. Agents apply it from their next reply
|
|
20
|
+
* or call once `startsAt` (default now) is reached, until `endsAt` (omit it
|
|
21
|
+
* for no end). Resolve phrases such as 'for four days' or 'until Friday' in
|
|
22
|
+
* the organization's time zone (`get_organization`), ending whole days at
|
|
23
|
+
* local midnight. No Agent reads a bulletin before it starts: for Agents to
|
|
24
|
+
* know ahead (so they book nothing on a closed day), start it now and write
|
|
25
|
+
* the dates in the text. Fails with BULLETIN_PERIOD_INVALID when it would end
|
|
26
|
+
* before it starts or is already over, and BULLETIN_LIMIT_REACHED at 30
|
|
27
|
+
* bulletins in force or scheduled.
|
|
28
|
+
*/
|
|
29
|
+
create(request: CreateRequest, options?: RequestOptions): Promise<CreateResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* Delete a bulletin
|
|
32
|
+
*
|
|
33
|
+
* Delete a bulletin that was a mistake or is no longer wanted: Agents stop
|
|
34
|
+
* applying it from their next reply or call. The history keeps who deleted it
|
|
35
|
+
* and when. To keep it listed as ended instead, set its `endsAt` to now with
|
|
36
|
+
* `update_bulletin`.
|
|
37
|
+
*/
|
|
38
|
+
delete(request: DeleteRequest, options?: RequestOptions): Promise<DeleteResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* Get a bulletin
|
|
41
|
+
*
|
|
42
|
+
* Read one bulletin: its text, the Agent that applies it (null for every
|
|
43
|
+
* Agent), its period and its status.
|
|
44
|
+
*/
|
|
45
|
+
get(request: GetRequest, options?: RequestOptions): Promise<GetResponse>;
|
|
46
|
+
/**
|
|
47
|
+
* List bulletins
|
|
48
|
+
*
|
|
49
|
+
* List the organization's bulletins (Settings → Bulletins in the Dashboard;
|
|
50
|
+
* people may call them novedades, avisos or eventos): what is happening now
|
|
51
|
+
* that its Agents apply while it lasts, such as a service that is not
|
|
52
|
+
* available, days without appointments at a site, a closed day or a
|
|
53
|
+
* promotion. Default: those in force (`active`) and those not started yet
|
|
54
|
+
* (`scheduled`); `status=ended` lists ended ones. `agentId` lists what one
|
|
55
|
+
* Agent applies (its own and those for every Agent); `q` searches the text.
|
|
56
|
+
* Use it to find the bulletin a person means before changing or deleting it.
|
|
57
|
+
*/
|
|
58
|
+
list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* Update a bulletin
|
|
61
|
+
*
|
|
62
|
+
* Change a bulletin: its text, its Agent (null for every Agent), its start or
|
|
63
|
+
* its end. Omitted fields stay. To end one now, set `endsAt` to the current
|
|
64
|
+
* instant; a scheduled one is deleted instead. Agents apply the change from
|
|
65
|
+
* their next reply or call.
|
|
66
|
+
*/
|
|
67
|
+
update(request: UpdateRequest, options?: RequestOptions): Promise<UpdateResponse>;
|
|
68
|
+
}
|
|
69
|
+
export declare function createClient(options: ClientOptions): Client;
|
|
70
|
+
export declare function bind(transport: Transport): Client;
|
|
71
|
+
export interface CreateRequest {
|
|
72
|
+
agentId?: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* When Agents stop applying it, later than its start and than now. Omit it or
|
|
75
|
+
* send null to keep it until it is deleted.
|
|
76
|
+
*/
|
|
77
|
+
endsAt?: Temporal.Instant | null;
|
|
78
|
+
/**
|
|
79
|
+
* When Agents start applying it; default now. No Agent reads it before. For
|
|
80
|
+
* Agents to know ahead (so they book no appointment on a closed day), start
|
|
81
|
+
* it now and write the dates in the text.
|
|
82
|
+
*/
|
|
83
|
+
startsAt?: Temporal.Instant;
|
|
84
|
+
/**
|
|
85
|
+
* What is happening and what the Agents should do about it, written as you
|
|
86
|
+
* would tell them. One situation per bulletin; long reference material
|
|
87
|
+
* belongs in Knowledge.
|
|
88
|
+
*/
|
|
89
|
+
text: string;
|
|
90
|
+
}
|
|
91
|
+
export interface CreateResponse {
|
|
92
|
+
data: RaizBulletin;
|
|
93
|
+
error: null;
|
|
94
|
+
metadata: ResponseMetadata;
|
|
95
|
+
success: true;
|
|
96
|
+
}
|
|
97
|
+
export interface DeleteRequest {
|
|
98
|
+
/**
|
|
99
|
+
* Bulletin id.
|
|
100
|
+
*/
|
|
101
|
+
bulletinId: string;
|
|
102
|
+
}
|
|
103
|
+
export interface DeleteResponse {
|
|
104
|
+
data: DeletedObject;
|
|
105
|
+
error: null;
|
|
106
|
+
metadata: ResponseMetadata;
|
|
107
|
+
success: true;
|
|
108
|
+
}
|
|
109
|
+
export interface GetRequest {
|
|
110
|
+
/**
|
|
111
|
+
* Bulletin id.
|
|
112
|
+
*/
|
|
113
|
+
bulletinId: string;
|
|
114
|
+
}
|
|
115
|
+
export interface GetResponse {
|
|
116
|
+
data: RaizBulletin;
|
|
117
|
+
error: null;
|
|
118
|
+
metadata: ResponseMetadata;
|
|
119
|
+
success: true;
|
|
120
|
+
}
|
|
121
|
+
export interface ListRequest {
|
|
122
|
+
/**
|
|
123
|
+
* Opaque cursor returned by pageInfo; omit it to request the first page.
|
|
124
|
+
*/
|
|
125
|
+
cursor?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Direction to traverse the stable keyset ordering from the supplied cursor.
|
|
128
|
+
*/
|
|
129
|
+
direction?: "forward" | "backward";
|
|
130
|
+
/**
|
|
131
|
+
* Maximum items returned in one page. Defaults to 25; larger reads require
|
|
132
|
+
* another cursor.
|
|
133
|
+
*/
|
|
134
|
+
limit?: number;
|
|
135
|
+
/**
|
|
136
|
+
* Only the bulletins this Agent applies: its own and those for every Agent.
|
|
137
|
+
*/
|
|
138
|
+
agentId?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Text in the bulletin, ignoring case.
|
|
141
|
+
*/
|
|
142
|
+
q?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Comma-separated statuses to list. Default `scheduled,active`; ended
|
|
145
|
+
* bulletins appear only when asked for.
|
|
146
|
+
*/
|
|
147
|
+
status?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface ListResponse {
|
|
150
|
+
data: RaizBulletinPage;
|
|
151
|
+
error: null;
|
|
152
|
+
metadata: ResponseMetadata;
|
|
153
|
+
success: true;
|
|
154
|
+
}
|
|
155
|
+
export interface UpdateRequest {
|
|
156
|
+
agentId?: string | null;
|
|
157
|
+
/**
|
|
158
|
+
* Bulletin id.
|
|
159
|
+
*/
|
|
160
|
+
bulletinId: string;
|
|
161
|
+
/**
|
|
162
|
+
* When Agents stop applying it, later than its start; send the current
|
|
163
|
+
* instant to end it now, or null to keep it until it is deleted.
|
|
164
|
+
*/
|
|
165
|
+
endsAt?: Temporal.Instant | null;
|
|
166
|
+
/**
|
|
167
|
+
* When Agents start applying it.
|
|
168
|
+
*/
|
|
169
|
+
startsAt?: Temporal.Instant;
|
|
170
|
+
/**
|
|
171
|
+
* What is happening and what the Agents should do about it, written as you
|
|
172
|
+
* would tell them. One situation per bulletin; long reference material
|
|
173
|
+
* belongs in Knowledge.
|
|
174
|
+
*/
|
|
175
|
+
text?: string;
|
|
176
|
+
}
|
|
177
|
+
export interface UpdateResponse {
|
|
178
|
+
data: RaizBulletin;
|
|
179
|
+
error: null;
|
|
180
|
+
metadata: ResponseMetadata;
|
|
181
|
+
success: true;
|
|
182
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Code generated by forge. DO NOT EDIT.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { Transport, instant, object, } from "../../_/index.js";
|
|
4
|
+
import { RaizBulletinCodec, RaizBulletinPageCodec, } from "./models.js";
|
|
5
|
+
export function createClient(options) {
|
|
6
|
+
return bind(new Transport(options));
|
|
7
|
+
}
|
|
8
|
+
export function bind(transport) {
|
|
9
|
+
return {
|
|
10
|
+
create: (request, options) => transport.send(CreateOperation, request, options),
|
|
11
|
+
delete: (request, options) => transport.send(DeleteOperation, request, options),
|
|
12
|
+
get: (request, options) => transport.send(GetOperation, request, options),
|
|
13
|
+
list: (request, options) => transport.send(ListOperation, request, options),
|
|
14
|
+
update: (request, options) => transport.send(UpdateOperation, request, options),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const CreateOperation = {
|
|
18
|
+
method: "POST",
|
|
19
|
+
route: "/v1/raiz/bulletins/create",
|
|
20
|
+
body: "flat",
|
|
21
|
+
request: object([["endsAt", null, instant], ["startsAt", null, instant]]),
|
|
22
|
+
response: object([["data", null, () => RaizBulletinCodec]]),
|
|
23
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "409": true, "413": true, "415": true, "422": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
24
|
+
};
|
|
25
|
+
const DeleteOperation = {
|
|
26
|
+
method: "DELETE",
|
|
27
|
+
route: "/v1/raiz/bulletins/delete",
|
|
28
|
+
body: "flat",
|
|
29
|
+
response: null,
|
|
30
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
31
|
+
};
|
|
32
|
+
const GetOperation = {
|
|
33
|
+
method: "GET",
|
|
34
|
+
route: "/v1/raiz/bulletins/get",
|
|
35
|
+
query: { bulletinId: "bulletinId" },
|
|
36
|
+
response: object([["data", null, () => RaizBulletinCodec]]),
|
|
37
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
38
|
+
};
|
|
39
|
+
const ListOperation = {
|
|
40
|
+
method: "GET",
|
|
41
|
+
route: "/v1/raiz/bulletins",
|
|
42
|
+
query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", q: "q", status: "status" },
|
|
43
|
+
response: object([["data", null, () => RaizBulletinPageCodec]]),
|
|
44
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
45
|
+
};
|
|
46
|
+
const UpdateOperation = {
|
|
47
|
+
method: "PATCH",
|
|
48
|
+
route: "/v1/raiz/bulletins/update",
|
|
49
|
+
body: "flat",
|
|
50
|
+
request: object([["endsAt", null, instant], ["startsAt", null, instant]]),
|
|
51
|
+
response: object([["data", null, () => RaizBulletinCodec]]),
|
|
52
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "409": true, "413": true, "415": true, "422": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
53
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ApiError } from "../../_/index.js";
|
|
2
|
+
export type { RequestOptions } from "../../_/index.js";
|
|
3
|
+
export { createClient } from "./client.js";
|
|
4
|
+
export type { Client, ClientOptions, CreateRequest, CreateResponse, DeleteRequest, DeleteResponse, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
|
|
5
|
+
export type { RaizBulletin, RaizBulletinAgent, RaizBulletinPage, } from "./models.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { PageInfo } from "../../models.js";
|
|
2
|
+
export interface RaizBulletin {
|
|
3
|
+
agent: RaizBulletinAgent | null;
|
|
4
|
+
/**
|
|
5
|
+
* An instant in RFC 3339 format, in UTC.
|
|
6
|
+
*/
|
|
7
|
+
createdAt: Temporal.Instant;
|
|
8
|
+
endsAt: Temporal.Instant | null;
|
|
9
|
+
/**
|
|
10
|
+
* Bulletin id.
|
|
11
|
+
*/
|
|
12
|
+
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* When Agents start applying it.
|
|
15
|
+
*/
|
|
16
|
+
startsAt: Temporal.Instant;
|
|
17
|
+
/**
|
|
18
|
+
* `scheduled`: it has not started and no Agent reads it yet. `active`: Agents
|
|
19
|
+
* apply it. `ended`: its period is over and no Agent reads it.
|
|
20
|
+
*/
|
|
21
|
+
status: "scheduled" | "active" | "ended";
|
|
22
|
+
/**
|
|
23
|
+
* What is happening, in the words the Agents read.
|
|
24
|
+
*/
|
|
25
|
+
text: string;
|
|
26
|
+
/**
|
|
27
|
+
* An instant in RFC 3339 format, in UTC.
|
|
28
|
+
*/
|
|
29
|
+
updatedAt: Temporal.Instant;
|
|
30
|
+
}
|
|
31
|
+
export interface RaizBulletinAgent {
|
|
32
|
+
/**
|
|
33
|
+
* Agent id.
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
export interface RaizBulletinPage {
|
|
39
|
+
/**
|
|
40
|
+
* Items admitted by this resource contract within the verified organization.
|
|
41
|
+
*/
|
|
42
|
+
data: RaizBulletin[];
|
|
43
|
+
/**
|
|
44
|
+
* Discriminator for a resource list response.
|
|
45
|
+
*/
|
|
46
|
+
object: "list";
|
|
47
|
+
/**
|
|
48
|
+
* Opaque navigation cursors for this page’s stable keyset order.
|
|
49
|
+
*/
|
|
50
|
+
pageInfo: PageInfo;
|
|
51
|
+
}
|
|
52
|
+
export declare const RaizBulletinCodec: import("../../_/codec.js").Codec;
|
|
53
|
+
export declare const RaizBulletinPageCodec: import("../../_/codec.js").Codec;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Code generated by forge. DO NOT EDIT.
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
import { array, instant, object } from "../../_/index.js";
|
|
4
|
+
export const RaizBulletinCodec = object([
|
|
5
|
+
["createdAt", null, instant],
|
|
6
|
+
["endsAt", null, instant],
|
|
7
|
+
["startsAt", null, instant],
|
|
8
|
+
["updatedAt", null, instant],
|
|
9
|
+
]);
|
|
10
|
+
export const RaizBulletinPageCodec = object([
|
|
11
|
+
["data", null, array(() => RaizBulletinCodec)],
|
|
12
|
+
]);
|
|
@@ -26,14 +26,14 @@ const GetOperation = {
|
|
|
26
26
|
route: "/v1/raiz/campaigns/get",
|
|
27
27
|
query: { campaignId: "campaignId", expand: "expand", recipientsCursor: "recipientsCursor", recipientsDirection: "recipientsDirection", recipientsLimit: "recipientsLimit" },
|
|
28
28
|
response: object([["data", null, () => RaizCampaignCodec]]),
|
|
29
|
-
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "
|
|
29
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
30
30
|
};
|
|
31
31
|
const ListOperation = {
|
|
32
32
|
method: "GET",
|
|
33
33
|
route: "/v1/raiz/campaigns",
|
|
34
34
|
query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", status: "status" },
|
|
35
35
|
response: object([["data", null, () => RaizCampaignPageCodec]]),
|
|
36
|
-
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "
|
|
36
|
+
errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
|
|
37
37
|
};
|
|
38
38
|
const UpdateOperation = {
|
|
39
39
|
method: "PATCH",
|
|
@@ -2,4 +2,4 @@ export { ApiError } from "../../_/index.js";
|
|
|
2
2
|
export type { RequestOptions } from "../../_/index.js";
|
|
3
3
|
export { createClient } from "./client.js";
|
|
4
4
|
export type { Client, ClientOptions, CreateRequest, CreateResponse, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
|
|
5
|
-
export type { RaizCampaign, RaizCampaignPage, RaizCampaignProgress, RaizCampaignRecipientInput, RaizCampaignRecipientPage,
|
|
5
|
+
export type { RaizCampaign, RaizCampaignPage, RaizCampaignProgress, RaizCampaignRecipientInput, RaizCampaignRecipientPage, } from "./models.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PageInfo } from "../../models.js";
|
|
2
|
-
import type { RaizContactHoursWindow } from "../models.js";
|
|
2
|
+
import type { RaizContactHoursWindow, RaizPhoneNumber } from "../models.js";
|
|
3
3
|
export interface RaizCampaign {
|
|
4
4
|
/**
|
|
5
5
|
* Agent id.
|
|
@@ -61,7 +61,7 @@ export interface RaizCampaignPage {
|
|
|
61
61
|
/**
|
|
62
62
|
* Items admitted by this resource contract within the verified organization.
|
|
63
63
|
*/
|
|
64
|
-
data:
|
|
64
|
+
data: RaizCampaign[];
|
|
65
65
|
/**
|
|
66
66
|
* Discriminator for a resource list response.
|
|
67
67
|
*/
|
|
@@ -86,7 +86,7 @@ export interface RaizCampaignRecipientInput {
|
|
|
86
86
|
/**
|
|
87
87
|
* Phone number in E.164 format.
|
|
88
88
|
*/
|
|
89
|
-
address:
|
|
89
|
+
address: RaizPhoneNumber;
|
|
90
90
|
/**
|
|
91
91
|
* The contact the call is about. Omitted: the contact that owns `address`,
|
|
92
92
|
* created when the organization has none.
|
|
@@ -97,7 +97,9 @@ export interface RaizCampaignRecipientInput {
|
|
|
97
97
|
/**
|
|
98
98
|
* Values for the `{{name}}` variables the Agent's instructions, first message
|
|
99
99
|
* or this campaign's texts reference. Raíz always provides `contact_name`,
|
|
100
|
-
* `contact_given_name`, `contact_id`, `contact_phone` and
|
|
100
|
+
* `contact_given_name`, `contact_id`, `contact_phone`, `conversation_id` and
|
|
101
|
+
* `bulletins` (the business bulletins in force), which a recipient's values
|
|
102
|
+
* never replace.
|
|
101
103
|
*/
|
|
102
104
|
variables?: {
|
|
103
105
|
[key: string]: unknown;
|
|
@@ -138,59 +140,6 @@ export interface RaizCampaignRecipientPage {
|
|
|
138
140
|
*/
|
|
139
141
|
pageInfo: PageInfo;
|
|
140
142
|
}
|
|
141
|
-
export interface RaizCampaignSummary {
|
|
142
|
-
/**
|
|
143
|
-
* Agent id.
|
|
144
|
-
*/
|
|
145
|
-
agentId: string;
|
|
146
|
-
channelId: string | null;
|
|
147
|
-
/**
|
|
148
|
-
* When calls may start, in the campaign's time zone. Empty: any time.
|
|
149
|
-
*/
|
|
150
|
-
contactHours: RaizContactHoursWindow[];
|
|
151
|
-
/**
|
|
152
|
-
* An instant in RFC 3339 format, in UTC.
|
|
153
|
-
*/
|
|
154
|
-
createdAt: Temporal.Instant;
|
|
155
|
-
endedAt: Temporal.Instant | null;
|
|
156
|
-
firstMessage: string | null;
|
|
157
|
-
/**
|
|
158
|
-
* Campaign id.
|
|
159
|
-
*/
|
|
160
|
-
id: string;
|
|
161
|
-
instructions: string | null;
|
|
162
|
-
maxAttempts: number;
|
|
163
|
-
/**
|
|
164
|
-
* Your own keys and labels for this resource (up to 50 keys of 40 characters;
|
|
165
|
-
* values up to 500 characters). Raíz never interprets them.
|
|
166
|
-
*/
|
|
167
|
-
metadata: {
|
|
168
|
-
[key: string]: unknown;
|
|
169
|
-
};
|
|
170
|
-
name: string;
|
|
171
|
-
/**
|
|
172
|
-
* How many recipients are in each state.
|
|
173
|
-
*/
|
|
174
|
-
progress: RaizCampaignProgress;
|
|
175
|
-
retryAfterMinutes: number;
|
|
176
|
-
retryOn: ("no_answer" | "failure")[];
|
|
177
|
-
scheduledEndAt: Temporal.Instant | null;
|
|
178
|
-
scheduledStartAt: Temporal.Instant | null;
|
|
179
|
-
startedAt: Temporal.Instant | null;
|
|
180
|
-
/**
|
|
181
|
-
* `queued`: not started yet (or its start is scheduled). `running`: calling
|
|
182
|
-
* due recipients. `paused`: started, then paused; calls in progress finish.
|
|
183
|
-
* `completed`: no recipient is left to call.
|
|
184
|
-
*/
|
|
185
|
-
status: "queued" | "running" | "paused" | "completed" | "cancelled" | "failed";
|
|
186
|
-
timeZone: string;
|
|
187
|
-
/**
|
|
188
|
-
* An instant in RFC 3339 format, in UTC.
|
|
189
|
-
*/
|
|
190
|
-
updatedAt: Temporal.Instant;
|
|
191
|
-
version: number;
|
|
192
|
-
}
|
|
193
143
|
export declare const RaizCampaignCodec: import("../../_/codec.js").Codec;
|
|
194
144
|
export declare const RaizCampaignPageCodec: import("../../_/codec.js").Codec;
|
|
195
145
|
export declare const RaizCampaignRecipientPageCodec: import("../../_/codec.js").Codec;
|
|
196
|
-
export declare const RaizCampaignSummaryCodec: import("../../_/codec.js").Codec;
|
|
@@ -11,16 +11,8 @@ export const RaizCampaignCodec = object([
|
|
|
11
11
|
["updatedAt", null, instant],
|
|
12
12
|
]);
|
|
13
13
|
export const RaizCampaignPageCodec = object([
|
|
14
|
-
["data", null, array(() =>
|
|
14
|
+
["data", null, array(() => RaizCampaignCodec)],
|
|
15
15
|
]);
|
|
16
16
|
export const RaizCampaignRecipientPageCodec = object([
|
|
17
17
|
["data", null, array(object([["createdAt", null, instant], ["lastAttempt", null, object([["startedAt", null, instant]])], ["nextAttemptAt", null, instant], ["updatedAt", null, instant]]))],
|
|
18
18
|
]);
|
|
19
|
-
export const RaizCampaignSummaryCodec = object([
|
|
20
|
-
["createdAt", null, instant],
|
|
21
|
-
["endedAt", null, instant],
|
|
22
|
-
["scheduledEndAt", null, instant],
|
|
23
|
-
["scheduledStartAt", null, instant],
|
|
24
|
-
["startedAt", null, instant],
|
|
25
|
-
["updatedAt", null, instant],
|
|
26
|
-
]);
|