@curviate/sdk 0.31.0 → 0.33.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/dist/index.js CHANGED
@@ -55,10 +55,11 @@ var ERROR_CODES = [
55
55
  "PLATFORM_RATE_LIMIT",
56
56
  // Curviate's OWN account-safety ceiling, not a request-rate limit and not
57
57
  // LinkedIn refusing. A 429 that never reached LinkedIn and spent nothing:
58
- // the budget row named by `budgetRow` is at the ceiling configured on
59
- // `PATCH /v1/{account_id}/safety-policy`, or the account is outside its
60
- // activity window. Deliberately absent from RETRYABLE_CODES: a monthly
61
- // row's reset can be weeks out, so backing off is the wrong recovery.
58
+ // the budget row named by `budgetRow` is at its ceiling, set by the account's
59
+ // safety policy or else the tenant default (`GET`/`PATCH /v1/safety-policy`),
60
+ // or the account is outside its activity window. Deliberately absent from
61
+ // RETRYABLE_CODES: a monthly row's reset can be weeks out, so backing off
62
+ // is the wrong recovery.
62
63
  // Read `resetAt`, `safetyReason` and `safetyHint` instead.
63
64
  "BUDGET_EXHAUSTED",
64
65
  // Platform errors
@@ -511,6 +512,28 @@ var AccountsResource = class {
511
512
  ...params !== void 0 ? { query: params } : {}
512
513
  });
513
514
  }
515
+ /**
516
+ * List the workspace's live seats: each `seat_id`, whether an account
517
+ * `occupied` it, and that `account_id` (`null` when free). Not paginated.
518
+ *
519
+ * Only live seats are listed, and an empty seat is listed only when
520
+ * connecting an account to it would be accepted right now. So an empty seat
521
+ * that is provisional, cancelling, on an ended trial, or blocked by billing
522
+ * does not appear, and `items` can be `[]` even though the workspace has
523
+ * seats. Any seat with `occupied: false` is a valid `seat_id` for connecting
524
+ * a new account with `auth.intent`. Carries no billing fields.
525
+ *
526
+ * @returns `{ object: "seat_list", items: { seat_id, occupied, account_id }[] }`.
527
+ *
528
+ * @example
529
+ * const { items } = await curviate.accounts.listSeats();
530
+ * const free = items.find((seat) => !seat.occupied);
531
+ * if (!free) throw new Error("No seat is free to connect to right now (add a seat, or check billing).");
532
+ * await curviate.auth.intent({ seat_id: free.seat_id, auth_method: "cookie", cookie: { li_at }, user_agent });
533
+ */
534
+ listSeats() {
535
+ return this.ctx.request({ method: "GET", path: "/v1/accounts/seats" });
536
+ }
514
537
  /**
515
538
  * Return metadata and current state for one connected account, including the
516
539
  * central `quotas[]` account-safety view, `account_states[]` and `seat_id`
@@ -587,7 +610,8 @@ var AuthResource = class {
587
610
  /**
588
611
  * Authenticate a LinkedIn account with credentials or a session cookie.
589
612
  *
590
- * Omit `account_id` to connect a NEW account into an empty seat; include it
613
+ * Omit `account_id` to connect a NEW account into an empty seat (find one
614
+ * with `accounts.listSeats()`: any seat with `occupied: false`); include it
591
615
  * to re-authenticate an EXISTING account in place. Returns the account on
592
616
  * success (200 re-authenticated in place / 201 new), or a checkpoint
593
617
  * challenge (202) when LinkedIn requires verification; resolve it with
@@ -761,6 +785,19 @@ var MessagingResource = class {
761
785
  /**
762
786
  * List messages in a chat, cursor-paginated.
763
787
  * `GET /v1/{account_id}/chats/{chat_id}/messages`
788
+ *
789
+ * An InMail thread's subject line arrives on a MESSAGE, as
790
+ * `message.specifics.subject`, carried by the thread's opening message. The
791
+ * chat object has no subject of its own, and `chat.name` is the counterpart's
792
+ * display name rather than a folded-in subject, so read the subject from the
793
+ * first message rather than from the chat. Ordinary (non-InMail) messages
794
+ * return `specifics: {}`.
795
+ *
796
+ * A CHAT READ CARRIES NO SUBJECT AT ALL, including on its embedded
797
+ * `last_message`: the preview is deliberately narrower than a message read, so
798
+ * that a chat read returns the same fields whether it was answered from
799
+ * LinkedIn or from Curviate's stored copy. Getting a subject means reading the
800
+ * chat's messages.
764
801
  */
765
802
  listMessages(chatId, params) {
766
803
  return this.ctx.request({
@@ -807,6 +844,11 @@ var MessagingResource = class {
807
844
  /**
808
845
  * Get a single message by ID, re-homed under its chat.
809
846
  * `GET /v1/{account_id}/chats/{chat_id}/messages/{message_id}`
847
+ *
848
+ * `specifics` carries the InMail subject when the platform set one on this
849
+ * message (`specifics.subject`), and is `{}` otherwise. It is narrowed to
850
+ * that one field on purpose: the platform's other `specifics` keys are not
851
+ * part of the published surface.
810
852
  */
811
853
  getMessage(chatId, messageId) {
812
854
  return this.ctx.request({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curviate/sdk",
3
- "version": "0.31.0",
3
+ "version": "0.33.0",
4
4
  "private": false,
5
5
  "description": "TypeScript SDK for the Curviate API.",
6
6
  "license": "MIT",