featurebase-node 0.11.0 → 0.13.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 +31 -0
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/feedback/comments.d.mts +340 -1
- package/resources/feedback/comments.d.mts.map +1 -1
- package/resources/feedback/comments.d.ts +340 -1
- package/resources/feedback/comments.d.ts.map +1 -1
- package/resources/feedback/comments.js +160 -0
- package/resources/feedback/comments.js.map +1 -1
- package/resources/feedback/comments.mjs +160 -0
- package/resources/feedback/comments.mjs.map +1 -1
- package/resources/feedback/feedback.d.mts +4 -4
- package/resources/feedback/feedback.d.mts.map +1 -1
- package/resources/feedback/feedback.d.ts +4 -4
- package/resources/feedback/feedback.d.ts.map +1 -1
- package/resources/feedback/feedback.js.map +1 -1
- package/resources/feedback/feedback.mjs.map +1 -1
- package/resources/feedback/index.d.mts +2 -2
- package/resources/feedback/index.d.mts.map +1 -1
- package/resources/feedback/index.d.ts +2 -2
- package/resources/feedback/index.d.ts.map +1 -1
- package/resources/feedback/index.js.map +1 -1
- package/resources/feedback/index.mjs.map +1 -1
- package/resources/feedback/posts/index.d.mts +1 -1
- package/resources/feedback/posts/index.d.mts.map +1 -1
- package/resources/feedback/posts/index.d.ts +1 -1
- package/resources/feedback/posts/index.d.ts.map +1 -1
- package/resources/feedback/posts/index.js.map +1 -1
- package/resources/feedback/posts/index.mjs.map +1 -1
- package/resources/feedback/posts/posts.d.mts +547 -1
- package/resources/feedback/posts/posts.d.mts.map +1 -1
- package/resources/feedback/posts/posts.d.ts +547 -1
- package/resources/feedback/posts/posts.d.ts.map +1 -1
- package/resources/feedback/posts/posts.js +181 -0
- package/resources/feedback/posts/posts.js.map +1 -1
- package/resources/feedback/posts/posts.mjs +181 -0
- package/resources/feedback/posts/posts.mjs.map +1 -1
- package/resources/help-center/articles.d.mts +407 -1
- package/resources/help-center/articles.d.mts.map +1 -1
- package/resources/help-center/articles.d.ts +407 -1
- package/resources/help-center/articles.d.ts.map +1 -1
- package/resources/help-center/articles.js +130 -0
- package/resources/help-center/articles.js.map +1 -1
- package/resources/help-center/articles.mjs +130 -0
- package/resources/help-center/articles.mjs.map +1 -1
- package/resources/help-center/help-center.d.mts +2 -2
- package/resources/help-center/help-center.d.mts.map +1 -1
- package/resources/help-center/help-center.d.ts +2 -2
- package/resources/help-center/help-center.d.ts.map +1 -1
- package/resources/help-center/help-center.js.map +1 -1
- package/resources/help-center/help-center.mjs.map +1 -1
- package/resources/help-center/index.d.mts +1 -1
- package/resources/help-center/index.d.mts.map +1 -1
- package/resources/help-center/index.d.ts +1 -1
- package/resources/help-center/index.d.ts.map +1 -1
- package/resources/help-center/index.js.map +1 -1
- package/resources/help-center/index.mjs.map +1 -1
- package/resources/support/conversations/conversations.d.mts +27 -19
- package/resources/support/conversations/conversations.d.mts.map +1 -1
- package/resources/support/conversations/conversations.d.ts +27 -19
- package/resources/support/conversations/conversations.d.ts.map +1 -1
- package/resources/support/conversations/conversations.js +20 -14
- package/resources/support/conversations/conversations.js.map +1 -1
- package/resources/support/conversations/conversations.mjs +20 -14
- package/resources/support/conversations/conversations.mjs.map +1 -1
- package/resources/users/companies/companies.d.mts +33 -20
- package/resources/users/companies/companies.d.mts.map +1 -1
- package/resources/users/companies/companies.d.ts +33 -20
- package/resources/users/companies/companies.d.ts.map +1 -1
- package/resources/users/companies/companies.js +28 -17
- package/resources/users/companies/companies.js.map +1 -1
- package/resources/users/companies/companies.mjs +28 -17
- package/resources/users/companies/companies.mjs.map +1 -1
- package/resources/users/contacts/contacts.d.mts +33 -21
- package/resources/users/contacts/contacts.d.mts.map +1 -1
- package/resources/users/contacts/contacts.d.ts +33 -21
- package/resources/users/contacts/contacts.d.ts.map +1 -1
- package/resources/users/contacts/contacts.js +27 -17
- package/resources/users/contacts/contacts.js.map +1 -1
- package/resources/users/contacts/contacts.mjs +27 -17
- package/resources/users/contacts/contacts.mjs.map +1 -1
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/feedback/comments.ts +396 -0
- package/src/resources/feedback/feedback.ts +8 -0
- package/src/resources/feedback/index.ts +4 -0
- package/src/resources/feedback/posts/index.ts +2 -0
- package/src/resources/feedback/posts/posts.ts +671 -0
- package/src/resources/help-center/articles.ts +686 -0
- package/src/resources/help-center/help-center.ts +4 -0
- package/src/resources/help-center/index.ts +2 -0
- package/src/resources/support/conversations/conversations.ts +27 -19
- package/src/resources/users/companies/companies.ts +38 -19
- package/src/resources/users/contacts/contacts.ts +40 -20
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -289,6 +289,187 @@ class Posts extends resource_1.APIResource {
|
|
|
289
289
|
]),
|
|
290
290
|
});
|
|
291
291
|
}
|
|
292
|
+
/**
|
|
293
|
+
* Search feedback posts with a structured filter AST, full-text search, sorting,
|
|
294
|
+
* and cursor pagination.
|
|
295
|
+
*
|
|
296
|
+
* ### Two modes (combinable)
|
|
297
|
+
*
|
|
298
|
+
* - **Filter mode** — pass a structured `query` AST (and/or `sort`) and the
|
|
299
|
+
* endpoint returns posts matching the filter, ordered by `sort` (default
|
|
300
|
+
* `createdAt:desc`). Same shape as `/v2/conversations/search`,
|
|
301
|
+
* `/v2/companies/search`, `/v2/contacts/search`.
|
|
302
|
+
* - **Search mode** — pass a top-level `search` string and the endpoint runs a
|
|
303
|
+
* hybrid full-text + vector search (BM25 + embeddings, semanticRatio 0.5) over
|
|
304
|
+
* post `title` and `content`, returning matches ranked by relevance. Optional:
|
|
305
|
+
* combine with `query` to constrain the search to a board / status / time
|
|
306
|
+
* window, and/or `sort` to override relevance ranking with chronological order.
|
|
307
|
+
*
|
|
308
|
+
* ```json
|
|
309
|
+
* {
|
|
310
|
+
* "search": "mobile dark mode",
|
|
311
|
+
* "query": {
|
|
312
|
+
* "operator": "AND",
|
|
313
|
+
* "value": [
|
|
314
|
+
* {
|
|
315
|
+
* "field": "boardId",
|
|
316
|
+
* "operator": "IN",
|
|
317
|
+
* "value": ["507f1f77bcf86cd799439011"]
|
|
318
|
+
* }
|
|
319
|
+
* ]
|
|
320
|
+
* },
|
|
321
|
+
* "limit": 20
|
|
322
|
+
* }
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* `search` is server-managed: no operators, no field selection, no special syntax
|
|
326
|
+
* — same plain-text contract as `/v2/conversations/search`. The string must be
|
|
327
|
+
* 1–500 characters; up to ~1024 BM25-tokenizer characters are forwarded to
|
|
328
|
+
* Turbopuffer (longer queries are truncated at a word boundary).
|
|
329
|
+
*
|
|
330
|
+
* ### Structured query AST
|
|
331
|
+
*
|
|
332
|
+
* Each clause has the shape `{ field, operator, value }`. You can pass a single
|
|
333
|
+
* clause or wrap up to 15 in a top-level `AND` group:
|
|
334
|
+
*
|
|
335
|
+
* ```json
|
|
336
|
+
* {
|
|
337
|
+
* "query": {
|
|
338
|
+
* "operator": "AND",
|
|
339
|
+
* "value": [
|
|
340
|
+
* {
|
|
341
|
+
* "field": "boardId",
|
|
342
|
+
* "operator": "IN",
|
|
343
|
+
* "value": ["507f1f77bcf86cd799439011"]
|
|
344
|
+
* },
|
|
345
|
+
* { "field": "upvotes", "operator": ">", "value": 10 }
|
|
346
|
+
* ]
|
|
347
|
+
* },
|
|
348
|
+
* "sort": "upvotes:desc",
|
|
349
|
+
* "limit": 20
|
|
350
|
+
* }
|
|
351
|
+
* ```
|
|
352
|
+
*
|
|
353
|
+
* To list every post a contact has upvoted (the inverse of
|
|
354
|
+
* `feedback.posts.voters.list(postId)`):
|
|
355
|
+
*
|
|
356
|
+
* ```json
|
|
357
|
+
* {
|
|
358
|
+
* "query": {
|
|
359
|
+
* "field": "voterId",
|
|
360
|
+
* "operator": "=",
|
|
361
|
+
* "value": "507f1f77bcf86cd799439011"
|
|
362
|
+
* },
|
|
363
|
+
* "sort": "upvotes:desc",
|
|
364
|
+
* "limit": 100
|
|
365
|
+
* }
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* Top-level `OR` groups and nested groups are not supported in this version.
|
|
369
|
+
*
|
|
370
|
+
* ### Supported fields and operators
|
|
371
|
+
*
|
|
372
|
+
* Field names are camelCase, matching the rest of the v2 public API. Snake_case
|
|
373
|
+
* names that this endpoint originally shipped with (`board_id`, `status_id`,
|
|
374
|
+
* `tag_id`, `author_id`, `voter_id`, `assignee_id`, `company_id`, `created_at`,
|
|
375
|
+
* `updated_at`, `comment_count`, `monthly_spend`, `opportunity_amount`,
|
|
376
|
+
* `in_review`, `is_pinned`) are still accepted for back-compat but are deprecated
|
|
377
|
+
* — please migrate to camelCase in new code.
|
|
378
|
+
*
|
|
379
|
+
* | Field | Type | Operators |
|
|
380
|
+
* | -------------------------------------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
381
|
+
* | `boardId` | id (categoryId) | `=`, `!=`, `IN`, `NIN` |
|
|
382
|
+
* | `statusId` | id (postStatus) | `=`, `!=`, `IN`, `NIN` |
|
|
383
|
+
* | `tagId` | id (postTags) | `=`, `!=`, `IN`, `NIN` |
|
|
384
|
+
* | `authorId` | string (user id) | `=`, `!=`, `IN`, `NIN` |
|
|
385
|
+
* | `voterId` | id (customer) | `=`, `IN` (use to list every post a contact has upvoted; only matches `type: customer` upvoters — guests/admins are not searchable here) |
|
|
386
|
+
* | `assigneeId` | id or null (admin) | `=`, `!=`, `IN`, `NIN` (use `null` for unassigned) |
|
|
387
|
+
* | `companyId` | string (external company id) | `=`, `!=`, `IN`, `NIN` |
|
|
388
|
+
* | `createdAt`, `updatedAt`, `eta` | unix seconds | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
389
|
+
* | `upvotes`, `commentCount`, `monthlySpend`, `opportunityAmount` | number | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
390
|
+
* | `inReview`, `isPinned` | boolean | `=`, `!=` |
|
|
391
|
+
*
|
|
392
|
+
* Use the top-level `search` field for full-text search across `title` and
|
|
393
|
+
* `content` (see "Search mode" above). The clause-level operators `~`, `!~`, `^`,
|
|
394
|
+
* `$` are reserved for future use and currently return `400`.
|
|
395
|
+
*
|
|
396
|
+
* A filter-mode query (no `search`) consisting only of `!=` or `NIN` clauses on
|
|
397
|
+
* unbounded fields is rejected with `query_too_broad` to prevent full-org scans.
|
|
398
|
+
* Combine the negation with at least one positive clause (`=`, `IN`, `>`, `<`)
|
|
399
|
+
* instead. Boolean fields (`inReview`, `isPinned`) are bounded so a standalone
|
|
400
|
+
* negation on them is allowed. Search mode (with `search` set) relaxes this — the
|
|
401
|
+
* FTS query itself acts as the positive constraint.
|
|
402
|
+
*
|
|
403
|
+
* ### Sort
|
|
404
|
+
*
|
|
405
|
+
* Allowed values:
|
|
406
|
+
*
|
|
407
|
+
* - `createdAt:desc` (default), `createdAt:asc`
|
|
408
|
+
* - `updatedAt:desc`, `updatedAt:asc`
|
|
409
|
+
* - `upvotes:desc`, `upvotes:asc`
|
|
410
|
+
* - `eta:desc`, `eta:asc`
|
|
411
|
+
* - `monthlySpend:desc`, `monthlySpend:asc` (sum of upvoters' monthly spend)
|
|
412
|
+
* - `opportunityAmount:desc`, `opportunityAmount:asc` (linked HubSpot/Salesforce
|
|
413
|
+
* value)
|
|
414
|
+
* - `commentCount:desc`, `commentCount:asc`
|
|
415
|
+
*
|
|
416
|
+
* Snake_case sort axes (`created_at:desc`, `monthly_spend:asc`, etc.) are accepted
|
|
417
|
+
* for back-compat — the cursor encodes the canonical camelCase identity, so a
|
|
418
|
+
* caller can switch naming conventions mid-pagination without restarting.
|
|
419
|
+
*
|
|
420
|
+
* When `search` is set, results are ranked by relevance unless `sort` is also set,
|
|
421
|
+
* in which case the matching posts are returned in the requested order. The chosen
|
|
422
|
+
* sort axis (or relevance) is encoded in the cursor; switching `sort` (or toggling
|
|
423
|
+
* `search` on/off) mid-pagination returns `400 invalid_cursor`. Restart pagination
|
|
424
|
+
* without a cursor when changing the sort or search shape.
|
|
425
|
+
*
|
|
426
|
+
* ### Pagination
|
|
427
|
+
*
|
|
428
|
+
* Cursor-based, `limit` between 1 and 100 (default 10). In filter mode,
|
|
429
|
+
* `totalCount` is approximate and capped at 5000; `totalCountCapped` is `true`
|
|
430
|
+
* when the real count may be higher. In search mode, `totalCount` reflects the
|
|
431
|
+
* matching survivor set after the AST filter and is capped at 200 (the Turbopuffer
|
|
432
|
+
* top-K).
|
|
433
|
+
*
|
|
434
|
+
* ### Server-side guards
|
|
435
|
+
*
|
|
436
|
+
* These exclusions are always applied and CANNOT be disabled via the AST:
|
|
437
|
+
*
|
|
438
|
+
* - Spam posts (`isSpam: true`) are excluded.
|
|
439
|
+
* - Merged posts (those rolled into another post) are excluded — the canonical row
|
|
440
|
+
* is what's returned.
|
|
441
|
+
* - Support-board (ticket) categories are excluded — tickets have their own
|
|
442
|
+
* `/v2/tickets` surface.
|
|
443
|
+
*
|
|
444
|
+
* ### Response
|
|
445
|
+
*
|
|
446
|
+
* Returns a standard list envelope with post rows identical to
|
|
447
|
+
* `GET /v2/posts/{id}`.
|
|
448
|
+
*
|
|
449
|
+
* ### Version Availability
|
|
450
|
+
*
|
|
451
|
+
* This endpoint is only available in API version 2026-01-01.nova and newer.
|
|
452
|
+
*
|
|
453
|
+
* @example
|
|
454
|
+
* ```ts
|
|
455
|
+
* const response = await client.feedback.posts.search();
|
|
456
|
+
* ```
|
|
457
|
+
*/
|
|
458
|
+
search(params, options) {
|
|
459
|
+
const { 'Featurebase-Version': featurebaseVersion, ...body } = params;
|
|
460
|
+
return this._client.post('/v2/posts/search', {
|
|
461
|
+
body,
|
|
462
|
+
...options,
|
|
463
|
+
headers: (0, headers_1.buildHeaders)([
|
|
464
|
+
{
|
|
465
|
+
...(featurebaseVersion?.toString() != null ?
|
|
466
|
+
{ 'Featurebase-Version': featurebaseVersion?.toString() }
|
|
467
|
+
: undefined),
|
|
468
|
+
},
|
|
469
|
+
options?.headers,
|
|
470
|
+
]),
|
|
471
|
+
});
|
|
472
|
+
}
|
|
292
473
|
}
|
|
293
474
|
exports.Posts = Posts;
|
|
294
475
|
Posts.Voters = voters_1.Voters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posts.js","sourceRoot":"","sources":["../../../src/resources/feedback/posts/posts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AAErD,+DAAsC;AACtC,wCASkB;AAGlB,4DAA0F;AAC1F,0DAAyD;AAEzD,0DAAoD;AAEpD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"posts.js","sourceRoot":"","sources":["../../../src/resources/feedback/posts/posts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AAErD,+DAAsC;AACtC,wCASkB;AAGlB,4DAA0F;AAC1F,0DAAyD;AAEzD,0DAAoD;AAEpD;;GAEG;AACH,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAudhE,CAAC;IArdC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkDG;IACH,MAAM,CAAC,MAAwB,EAAE,OAAwB;QACvD,MAAM,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;YACpC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CA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AAC;iBACb;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqKG;IACH,MAAM,CAAC,MAAwB,EAAE,OAAwB;QACvD,MAAM,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC3C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,kBAAkB,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC;wBAC1C,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,EAAE;wBAC3D,CAAC,CAAC,SAAS,CAAC;iBACb;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAxdD,sBAwdC;AA8mCD,KAAK,CAAC,MAAM,GAAG,eAAM,CAAC"}
|
|
@@ -285,6 +285,187 @@ export class Posts extends APIResource {
|
|
|
285
285
|
]),
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
|
+
/**
|
|
289
|
+
* Search feedback posts with a structured filter AST, full-text search, sorting,
|
|
290
|
+
* and cursor pagination.
|
|
291
|
+
*
|
|
292
|
+
* ### Two modes (combinable)
|
|
293
|
+
*
|
|
294
|
+
* - **Filter mode** — pass a structured `query` AST (and/or `sort`) and the
|
|
295
|
+
* endpoint returns posts matching the filter, ordered by `sort` (default
|
|
296
|
+
* `createdAt:desc`). Same shape as `/v2/conversations/search`,
|
|
297
|
+
* `/v2/companies/search`, `/v2/contacts/search`.
|
|
298
|
+
* - **Search mode** — pass a top-level `search` string and the endpoint runs a
|
|
299
|
+
* hybrid full-text + vector search (BM25 + embeddings, semanticRatio 0.5) over
|
|
300
|
+
* post `title` and `content`, returning matches ranked by relevance. Optional:
|
|
301
|
+
* combine with `query` to constrain the search to a board / status / time
|
|
302
|
+
* window, and/or `sort` to override relevance ranking with chronological order.
|
|
303
|
+
*
|
|
304
|
+
* ```json
|
|
305
|
+
* {
|
|
306
|
+
* "search": "mobile dark mode",
|
|
307
|
+
* "query": {
|
|
308
|
+
* "operator": "AND",
|
|
309
|
+
* "value": [
|
|
310
|
+
* {
|
|
311
|
+
* "field": "boardId",
|
|
312
|
+
* "operator": "IN",
|
|
313
|
+
* "value": ["507f1f77bcf86cd799439011"]
|
|
314
|
+
* }
|
|
315
|
+
* ]
|
|
316
|
+
* },
|
|
317
|
+
* "limit": 20
|
|
318
|
+
* }
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* `search` is server-managed: no operators, no field selection, no special syntax
|
|
322
|
+
* — same plain-text contract as `/v2/conversations/search`. The string must be
|
|
323
|
+
* 1–500 characters; up to ~1024 BM25-tokenizer characters are forwarded to
|
|
324
|
+
* Turbopuffer (longer queries are truncated at a word boundary).
|
|
325
|
+
*
|
|
326
|
+
* ### Structured query AST
|
|
327
|
+
*
|
|
328
|
+
* Each clause has the shape `{ field, operator, value }`. You can pass a single
|
|
329
|
+
* clause or wrap up to 15 in a top-level `AND` group:
|
|
330
|
+
*
|
|
331
|
+
* ```json
|
|
332
|
+
* {
|
|
333
|
+
* "query": {
|
|
334
|
+
* "operator": "AND",
|
|
335
|
+
* "value": [
|
|
336
|
+
* {
|
|
337
|
+
* "field": "boardId",
|
|
338
|
+
* "operator": "IN",
|
|
339
|
+
* "value": ["507f1f77bcf86cd799439011"]
|
|
340
|
+
* },
|
|
341
|
+
* { "field": "upvotes", "operator": ">", "value": 10 }
|
|
342
|
+
* ]
|
|
343
|
+
* },
|
|
344
|
+
* "sort": "upvotes:desc",
|
|
345
|
+
* "limit": 20
|
|
346
|
+
* }
|
|
347
|
+
* ```
|
|
348
|
+
*
|
|
349
|
+
* To list every post a contact has upvoted (the inverse of
|
|
350
|
+
* `feedback.posts.voters.list(postId)`):
|
|
351
|
+
*
|
|
352
|
+
* ```json
|
|
353
|
+
* {
|
|
354
|
+
* "query": {
|
|
355
|
+
* "field": "voterId",
|
|
356
|
+
* "operator": "=",
|
|
357
|
+
* "value": "507f1f77bcf86cd799439011"
|
|
358
|
+
* },
|
|
359
|
+
* "sort": "upvotes:desc",
|
|
360
|
+
* "limit": 100
|
|
361
|
+
* }
|
|
362
|
+
* ```
|
|
363
|
+
*
|
|
364
|
+
* Top-level `OR` groups and nested groups are not supported in this version.
|
|
365
|
+
*
|
|
366
|
+
* ### Supported fields and operators
|
|
367
|
+
*
|
|
368
|
+
* Field names are camelCase, matching the rest of the v2 public API. Snake_case
|
|
369
|
+
* names that this endpoint originally shipped with (`board_id`, `status_id`,
|
|
370
|
+
* `tag_id`, `author_id`, `voter_id`, `assignee_id`, `company_id`, `created_at`,
|
|
371
|
+
* `updated_at`, `comment_count`, `monthly_spend`, `opportunity_amount`,
|
|
372
|
+
* `in_review`, `is_pinned`) are still accepted for back-compat but are deprecated
|
|
373
|
+
* — please migrate to camelCase in new code.
|
|
374
|
+
*
|
|
375
|
+
* | Field | Type | Operators |
|
|
376
|
+
* | -------------------------------------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
377
|
+
* | `boardId` | id (categoryId) | `=`, `!=`, `IN`, `NIN` |
|
|
378
|
+
* | `statusId` | id (postStatus) | `=`, `!=`, `IN`, `NIN` |
|
|
379
|
+
* | `tagId` | id (postTags) | `=`, `!=`, `IN`, `NIN` |
|
|
380
|
+
* | `authorId` | string (user id) | `=`, `!=`, `IN`, `NIN` |
|
|
381
|
+
* | `voterId` | id (customer) | `=`, `IN` (use to list every post a contact has upvoted; only matches `type: customer` upvoters — guests/admins are not searchable here) |
|
|
382
|
+
* | `assigneeId` | id or null (admin) | `=`, `!=`, `IN`, `NIN` (use `null` for unassigned) |
|
|
383
|
+
* | `companyId` | string (external company id) | `=`, `!=`, `IN`, `NIN` |
|
|
384
|
+
* | `createdAt`, `updatedAt`, `eta` | unix seconds | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
385
|
+
* | `upvotes`, `commentCount`, `monthlySpend`, `opportunityAmount` | number | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
386
|
+
* | `inReview`, `isPinned` | boolean | `=`, `!=` |
|
|
387
|
+
*
|
|
388
|
+
* Use the top-level `search` field for full-text search across `title` and
|
|
389
|
+
* `content` (see "Search mode" above). The clause-level operators `~`, `!~`, `^`,
|
|
390
|
+
* `$` are reserved for future use and currently return `400`.
|
|
391
|
+
*
|
|
392
|
+
* A filter-mode query (no `search`) consisting only of `!=` or `NIN` clauses on
|
|
393
|
+
* unbounded fields is rejected with `query_too_broad` to prevent full-org scans.
|
|
394
|
+
* Combine the negation with at least one positive clause (`=`, `IN`, `>`, `<`)
|
|
395
|
+
* instead. Boolean fields (`inReview`, `isPinned`) are bounded so a standalone
|
|
396
|
+
* negation on them is allowed. Search mode (with `search` set) relaxes this — the
|
|
397
|
+
* FTS query itself acts as the positive constraint.
|
|
398
|
+
*
|
|
399
|
+
* ### Sort
|
|
400
|
+
*
|
|
401
|
+
* Allowed values:
|
|
402
|
+
*
|
|
403
|
+
* - `createdAt:desc` (default), `createdAt:asc`
|
|
404
|
+
* - `updatedAt:desc`, `updatedAt:asc`
|
|
405
|
+
* - `upvotes:desc`, `upvotes:asc`
|
|
406
|
+
* - `eta:desc`, `eta:asc`
|
|
407
|
+
* - `monthlySpend:desc`, `monthlySpend:asc` (sum of upvoters' monthly spend)
|
|
408
|
+
* - `opportunityAmount:desc`, `opportunityAmount:asc` (linked HubSpot/Salesforce
|
|
409
|
+
* value)
|
|
410
|
+
* - `commentCount:desc`, `commentCount:asc`
|
|
411
|
+
*
|
|
412
|
+
* Snake_case sort axes (`created_at:desc`, `monthly_spend:asc`, etc.) are accepted
|
|
413
|
+
* for back-compat — the cursor encodes the canonical camelCase identity, so a
|
|
414
|
+
* caller can switch naming conventions mid-pagination without restarting.
|
|
415
|
+
*
|
|
416
|
+
* When `search` is set, results are ranked by relevance unless `sort` is also set,
|
|
417
|
+
* in which case the matching posts are returned in the requested order. The chosen
|
|
418
|
+
* sort axis (or relevance) is encoded in the cursor; switching `sort` (or toggling
|
|
419
|
+
* `search` on/off) mid-pagination returns `400 invalid_cursor`. Restart pagination
|
|
420
|
+
* without a cursor when changing the sort or search shape.
|
|
421
|
+
*
|
|
422
|
+
* ### Pagination
|
|
423
|
+
*
|
|
424
|
+
* Cursor-based, `limit` between 1 and 100 (default 10). In filter mode,
|
|
425
|
+
* `totalCount` is approximate and capped at 5000; `totalCountCapped` is `true`
|
|
426
|
+
* when the real count may be higher. In search mode, `totalCount` reflects the
|
|
427
|
+
* matching survivor set after the AST filter and is capped at 200 (the Turbopuffer
|
|
428
|
+
* top-K).
|
|
429
|
+
*
|
|
430
|
+
* ### Server-side guards
|
|
431
|
+
*
|
|
432
|
+
* These exclusions are always applied and CANNOT be disabled via the AST:
|
|
433
|
+
*
|
|
434
|
+
* - Spam posts (`isSpam: true`) are excluded.
|
|
435
|
+
* - Merged posts (those rolled into another post) are excluded — the canonical row
|
|
436
|
+
* is what's returned.
|
|
437
|
+
* - Support-board (ticket) categories are excluded — tickets have their own
|
|
438
|
+
* `/v2/tickets` surface.
|
|
439
|
+
*
|
|
440
|
+
* ### Response
|
|
441
|
+
*
|
|
442
|
+
* Returns a standard list envelope with post rows identical to
|
|
443
|
+
* `GET /v2/posts/{id}`.
|
|
444
|
+
*
|
|
445
|
+
* ### Version Availability
|
|
446
|
+
*
|
|
447
|
+
* This endpoint is only available in API version 2026-01-01.nova and newer.
|
|
448
|
+
*
|
|
449
|
+
* @example
|
|
450
|
+
* ```ts
|
|
451
|
+
* const response = await client.feedback.posts.search();
|
|
452
|
+
* ```
|
|
453
|
+
*/
|
|
454
|
+
search(params, options) {
|
|
455
|
+
const { 'Featurebase-Version': featurebaseVersion, ...body } = params;
|
|
456
|
+
return this._client.post('/v2/posts/search', {
|
|
457
|
+
body,
|
|
458
|
+
...options,
|
|
459
|
+
headers: buildHeaders([
|
|
460
|
+
{
|
|
461
|
+
...(featurebaseVersion?.toString() != null ?
|
|
462
|
+
{ 'Featurebase-Version': featurebaseVersion?.toString() }
|
|
463
|
+
: undefined),
|
|
464
|
+
},
|
|
465
|
+
options?.headers,
|
|
466
|
+
]),
|
|
467
|
+
});
|
|
468
|
+
}
|
|
288
469
|
}
|
|
289
470
|
Posts.Voters = Voters;
|
|
290
471
|
//# sourceMappingURL=posts.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posts.mjs","sourceRoot":"","sources":["../../../src/resources/feedback/posts/posts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,SAAS;OACd,EAQL,MAAM,GACP;OAGM,EAAE,UAAU,EAAsC;OAClD,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"posts.mjs","sourceRoot":"","sources":["../../../src/resources/feedback/posts/posts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,SAAS;OACd,EAQL,MAAM,GACP;OAGM,EAAE,UAAU,EAAsC;OAClD,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,WAAM,GAAqB,IAAI,SAAS,CAAC,MAAM,CAAC,I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