@curviate/sdk 0.16.0 → 0.18.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 +25 -0
- package/dist/index.d.ts +545 -36
- package/dist/index.js +62 -0
- package/package.json +1 -1
- package/src/generated/types.ts +480 -31
package/dist/index.js
CHANGED
|
@@ -2279,6 +2279,26 @@ var CompaniesResource = class {
|
|
|
2279
2279
|
...params ? { query: params } : {}
|
|
2280
2280
|
});
|
|
2281
2281
|
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Invite the connected account's 1st-degree connections to follow the
|
|
2284
|
+
* company page. `POST /v1/{account_id}/companies/{identifier}/follow-invite`
|
|
2285
|
+
*
|
|
2286
|
+
* The account must administer the page with the invite-to-follow
|
|
2287
|
+
* entitlement (see `managed()`). `identifier` must be the company's numeric
|
|
2288
|
+
* provider_id. Pass the `AC…` member ids from an `invitableFollowers()`
|
|
2289
|
+
* read. All-or-nothing: for an all-valid request, resolves to one outcome
|
|
2290
|
+
* per requested invitee, in request order. If any invitee id is invalid,
|
|
2291
|
+
* the whole request rejects with a 404, not a partial result.
|
|
2292
|
+
* Re-inviting an already-invited member is a safe no-op, the same
|
|
2293
|
+
* invitation id, never a duplicate.
|
|
2294
|
+
*/
|
|
2295
|
+
followInvite(identifier, body) {
|
|
2296
|
+
return this.ctx.request({
|
|
2297
|
+
method: "POST",
|
|
2298
|
+
path: `/v1/{account_id}/companies/${identifier}/follow-invite`,
|
|
2299
|
+
body
|
|
2300
|
+
});
|
|
2301
|
+
}
|
|
2282
2302
|
/**
|
|
2283
2303
|
* List the conversations in a company page's admin message inbox,
|
|
2284
2304
|
* newest-activity-first.
|
|
@@ -2351,6 +2371,48 @@ var CompaniesResource = class {
|
|
|
2351
2371
|
...params ? { query: params } : {}
|
|
2352
2372
|
});
|
|
2353
2373
|
}
|
|
2374
|
+
/**
|
|
2375
|
+
* Reply to a company-inbox conversation, AS THE PAGE.
|
|
2376
|
+
* `POST /v1/{account_id}/companies/{identifier}/chats/{chat_id}/messages`
|
|
2377
|
+
*
|
|
2378
|
+
* `chatId` must be the send-ready `COMPANY_` chat id, not the `2-…` id
|
|
2379
|
+
* `chats()`/`chat()`/`searchChats()` return. Get the `COMPANY_` id from
|
|
2380
|
+
* `inboxes.listChats()` (`GET /v1/{account_id}/inboxes/{inbox_id}/chats`).
|
|
2381
|
+
* A `2-…` or personal chat id is rejected with a guiding 400 that names
|
|
2382
|
+
* the required form and its source.
|
|
2383
|
+
*
|
|
2384
|
+
* Reply-only: this method can only answer an existing conversation, it
|
|
2385
|
+
* cannot start a new one on the page's behalf. The connected account
|
|
2386
|
+
* must administer the page (`managed()`). `attachments[]`, when
|
|
2387
|
+
* supplied, carry base64-encoded file bytes, always sent as JSON, never
|
|
2388
|
+
* multipart. At least one of `text`/`attachments` is required (enforced
|
|
2389
|
+
* server-side). Message content passes through verbatim and is never
|
|
2390
|
+
* stored.
|
|
2391
|
+
*
|
|
2392
|
+
* The response echoes `sent_as`, the acting identity actually used:
|
|
2393
|
+
* `{ kind: "company", company_id, name }` (`company_id` is `null` when
|
|
2394
|
+
* the page could not be correlated to a managed page on Curviate).
|
|
2395
|
+
*
|
|
2396
|
+
* @example
|
|
2397
|
+
* const acc = curviate.account("acc_YOUR_ACCOUNT_ID");
|
|
2398
|
+
* const { items: inboxes } = await acc.inboxes.list({ kind: "company" });
|
|
2399
|
+
* const pageInbox = inboxes[0]!; // e.g. id "COMPANY_83734124_PRIMARY"
|
|
2400
|
+
*
|
|
2401
|
+
* const { items: chats } = await acc.inboxes.listChats(pageInbox.id);
|
|
2402
|
+
* const chatId = chats[0]!.id as string; // e.g. "COMPANY_83734124_2-YTQ3ODU3Njgt"
|
|
2403
|
+
*
|
|
2404
|
+
* const result = await acc.companies.sendMessage("112013061", chatId, {
|
|
2405
|
+
* text: "Thanks for reaching out, happy to help!",
|
|
2406
|
+
* });
|
|
2407
|
+
* console.log(result.sent_as); // { kind: "company", company_id: "112013061", name: "RedHire" }
|
|
2408
|
+
*/
|
|
2409
|
+
sendMessage(identifier, chatId, body) {
|
|
2410
|
+
return this.ctx.request({
|
|
2411
|
+
method: "POST",
|
|
2412
|
+
path: `/v1/{account_id}/companies/${identifier}/chats/${chatId}/messages`,
|
|
2413
|
+
body
|
|
2414
|
+
});
|
|
2415
|
+
}
|
|
2354
2416
|
};
|
|
2355
2417
|
|
|
2356
2418
|
// src/resources/webhooks.ts
|