unitpost 0.5.0 → 0.6.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 +5 -0
- package/dist/index.cjs +20 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -8
- package/dist/index.d.ts +91 -8
- package/dist/index.js +20 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,11 @@ change that bumps the version (docs/sdk/RELEASING.md).
|
|
|
9
9
|
|
|
10
10
|
## Unreleased
|
|
11
11
|
|
|
12
|
+
## 0.6.0
|
|
13
|
+
|
|
14
|
+
- Set one custom field on many contacts: `contacts.setField(body, { idempotencyKey })` (`ContactSetField`: `key`, `value`, (exactly one of `contact_ids` or `emails`, up to 1,000, or `segment_id`; `only_empty` keeps the values contacts already have). It answers the job (202); follow it with `jobs.get(id)`. The SDK mints an idempotency key when you pass none, so a retry answers the same job. Needs `contacts:write` (a segment also `segments:read`).
|
|
15
|
+
- `segments.addMember` also takes a list (`{ contact_ids }` or `{ emails }`, up to 1,000), which answers `SegmentMembersAdded` (each listed contact's membership and `added`); `{ contact }` and a body typed as `Models.SegmentMemberAdd` (still the single-contact body, `contact` required) answer `SegmentMember`, so code written before lists compiles unchanged. The list body is `Models.SegmentMembersAdd`; a body that could be either (`Models.SegmentMemberAddBody`, the request's combined shape) answers the union.
|
|
16
|
+
|
|
12
17
|
## 0.5.0
|
|
13
18
|
|
|
14
19
|
- `UnitpostOrganization` gains `sharedPlan`: `get`, `listWorkspaces`, `addWorkspace`, `updateWorkspace`, `removeWorkspace` (the organization's shared plan; adding and removing take an optional idempotency key, or the SDK mints one). Reads need `organizations:read`; the three writes need `organizations:billing`. Buying, upgrading or ending the shared plan stays in the dashboard.
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var crypto = require('crypto');
|
|
|
6
6
|
var API_VERSION = "v1";
|
|
7
7
|
|
|
8
8
|
// src/http.ts
|
|
9
|
-
var SDK_VERSION = "0.
|
|
9
|
+
var SDK_VERSION = "0.6.0";
|
|
10
10
|
var DEFAULT_BASE_URL = "https://www.unitpost.com";
|
|
11
11
|
var UnitpostError = class extends Error {
|
|
12
12
|
code;
|
|
@@ -1209,6 +1209,25 @@ var Contacts = class extends Resource {
|
|
|
1209
1209
|
export(body = {}) {
|
|
1210
1210
|
return this.http.request({ method: "POST", path: "/contacts/export", body });
|
|
1211
1211
|
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Set one custom field to the same value on many contacts, as the Contacts
|
|
1214
|
+
* page's Set field does, as a background job (202, the `Job`): `key`,
|
|
1215
|
+
* `value` (typed against the field; `null` clears it), optional
|
|
1216
|
+
* `only_empty`, and exactly one of `contact_ids` or `emails` (up to 1,000,
|
|
1217
|
+
* each a contact of this workspace) or `segment_id` (every member, however
|
|
1218
|
+
* many; also needs `segments:read`). Each contact whose value changes gets
|
|
1219
|
+
* `contact.updated`; consent is never touched. Follow it with
|
|
1220
|
+
* `jobs.get(id)`. Pass an `idempotencyKey` so a retry answers the same job;
|
|
1221
|
+
* one is generated when you don't.
|
|
1222
|
+
*/
|
|
1223
|
+
setField(body, opts = {}) {
|
|
1224
|
+
return this.http.request({
|
|
1225
|
+
method: "POST",
|
|
1226
|
+
path: "/contacts/set-field",
|
|
1227
|
+
body,
|
|
1228
|
+
idempotencyKey: opts.idempotencyKey ?? crypto.randomUUID()
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1212
1231
|
};
|
|
1213
1232
|
var ContactFields = class extends Resource {
|
|
1214
1233
|
list(params = {}) {
|
|
@@ -1307,7 +1326,6 @@ var Segments = class extends Resource {
|
|
|
1307
1326
|
listMembers(id, params = {}) {
|
|
1308
1327
|
return this.http.request({ method: "GET", path: `/segments/${enc(id)}/contacts`, query: params });
|
|
1309
1328
|
}
|
|
1310
|
-
/** Add a contact (by id or email) to the segment. Idempotent. */
|
|
1311
1329
|
addMember(id, body) {
|
|
1312
1330
|
return this.http.request({ method: "POST", path: `/segments/${enc(id)}/contacts`, body });
|
|
1313
1331
|
}
|