featurebase-node 0.12.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 +18 -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 +2 -2
- package/resources/feedback/feedback.d.mts.map +1 -1
- package/resources/feedback/feedback.d.ts +2 -2
- 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 +1 -1
- package/resources/feedback/index.d.mts.map +1 -1
- package/resources/feedback/index.d.ts +1 -1
- 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/posts.d.mts +51 -24
- package/resources/feedback/posts/posts.d.mts.map +1 -1
- package/resources/feedback/posts/posts.d.ts +51 -24
- package/resources/feedback/posts/posts.d.ts.map +1 -1
- package/resources/feedback/posts/posts.js +47 -21
- package/resources/feedback/posts/posts.js.map +1 -1
- package/resources/feedback/posts/posts.mjs +47 -21
- package/resources/feedback/posts/posts.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 +4 -0
- package/src/resources/feedback/index.ts +2 -0
- package/src/resources/feedback/posts/posts.ts +64 -29
- 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
|
@@ -438,6 +438,167 @@ export class Comments extends APIResource {
|
|
|
438
438
|
]),
|
|
439
439
|
});
|
|
440
440
|
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Search comments with a structured filter AST, full-text search, sorting, and
|
|
444
|
+
* cursor pagination.
|
|
445
|
+
*
|
|
446
|
+
* ### Two modes (combinable)
|
|
447
|
+
*
|
|
448
|
+
* - **Filter mode** — pass a structured `query` AST (and/or `sort`) and the
|
|
449
|
+
* endpoint returns comments matching the filter, ordered by `sort` (default
|
|
450
|
+
* `createdAt:desc`). Same shape as `/v2/posts/search`,
|
|
451
|
+
* `/v2/conversations/search`, `/v2/companies/search`, `/v2/contacts/search`.
|
|
452
|
+
* - **Search mode** — pass a top-level `search` string and the endpoint runs a
|
|
453
|
+
* hybrid full-text + vector search over comment `content`, returning matches
|
|
454
|
+
* ranked by relevance. Optional: combine with `query` to constrain the search to
|
|
455
|
+
* a post / changelog / author / time window, and/or `sort` to override relevance
|
|
456
|
+
* ranking with chronological order.
|
|
457
|
+
*
|
|
458
|
+
* ```json
|
|
459
|
+
* {
|
|
460
|
+
* "search": "dark mode feedback",
|
|
461
|
+
* "query": {
|
|
462
|
+
* "operator": "AND",
|
|
463
|
+
* "value": [
|
|
464
|
+
* {
|
|
465
|
+
* "field": "postId",
|
|
466
|
+
* "operator": "=",
|
|
467
|
+
* "value": "507f1f77bcf86cd799439011"
|
|
468
|
+
* }
|
|
469
|
+
* ]
|
|
470
|
+
* },
|
|
471
|
+
* "limit": 20
|
|
472
|
+
* }
|
|
473
|
+
* ```
|
|
474
|
+
*
|
|
475
|
+
* `search` is server-managed: no operators, no field selection, no special syntax
|
|
476
|
+
* — same plain-text contract as `/v2/posts/search`. The string must be 1–500
|
|
477
|
+
* characters.
|
|
478
|
+
*
|
|
479
|
+
* ### Structured query AST
|
|
480
|
+
*
|
|
481
|
+
* Each clause has the shape `{ field, operator, value }`. You can pass a single
|
|
482
|
+
* clause or wrap up to 15 in a top-level `AND` group. To list every comment a
|
|
483
|
+
* contact has authored:
|
|
484
|
+
*
|
|
485
|
+
* ```json
|
|
486
|
+
* {
|
|
487
|
+
* "query": {
|
|
488
|
+
* "field": "authorId",
|
|
489
|
+
* "operator": "=",
|
|
490
|
+
* "value": "507f1f77bcf86cd799439011"
|
|
491
|
+
* },
|
|
492
|
+
* "sort": "createdAt:desc",
|
|
493
|
+
* "limit": 100
|
|
494
|
+
* }
|
|
495
|
+
* ```
|
|
496
|
+
*
|
|
497
|
+
* Top-level `OR` groups and nested groups are not supported in this version.
|
|
498
|
+
*
|
|
499
|
+
* ### Supported fields and operators
|
|
500
|
+
*
|
|
501
|
+
* Field names are camelCase, matching the rest of the v2 public API. The other v2
|
|
502
|
+
* search endpoints (posts, contacts, companies, conversations) shipped earlier
|
|
503
|
+
* with snake_case field names and continue to accept those for back-compat;
|
|
504
|
+
* comments search is greenfield and ships with camelCase only.
|
|
505
|
+
*
|
|
506
|
+
* | Field | Type | Operators |
|
|
507
|
+
* | ------------------------------------- | ----------------------- | --------------------------------------------------------------------------- |
|
|
508
|
+
* | `authorId` | string (user id) | `=`, `!=`, `IN`, `NIN` |
|
|
509
|
+
* | `postId` | id or null (submission) | `=`, `!=`, `IN`, `NIN` (use `null` for changelog-only comments) |
|
|
510
|
+
* | `changelogId` | id or null | `=`, `!=`, `IN`, `NIN` (use `null` for post-only comments) |
|
|
511
|
+
* | `parentCommentId` | id or null | `=`, `!=`, `IN`, `NIN` (use `null` for root comments, non-null for replies) |
|
|
512
|
+
* | `isPrivate` | boolean | `=`, `!=` |
|
|
513
|
+
* | `inReview` | boolean | `=`, `!=` |
|
|
514
|
+
* | `createdAt` | unix seconds | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
515
|
+
* | `upvotes`, `score`, `confidenceScore` | number | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
516
|
+
*
|
|
517
|
+
* Use the top-level `search` field for full-text search across comment `content`
|
|
518
|
+
* (see "Search mode" above). The clause-level operators `~`, `!~`, `^`, `$` are
|
|
519
|
+
* reserved for future use and currently return `400`.
|
|
520
|
+
*
|
|
521
|
+
* A filter-mode query (no `search`) consisting only of `!=` or `NIN` clauses on
|
|
522
|
+
* unbounded fields is rejected with `query_too_broad` to prevent full-org scans.
|
|
523
|
+
* Combine the negation with at least one positive clause (`=`, `IN`, `>`, `<`)
|
|
524
|
+
* instead. Boolean fields (`isPrivate`, `inReview`) are bounded so a standalone
|
|
525
|
+
* negation on them is allowed. Search mode (with `search` set) relaxes this — the
|
|
526
|
+
* FTS query itself acts as the positive constraint.
|
|
527
|
+
*
|
|
528
|
+
* ### Sort
|
|
529
|
+
*
|
|
530
|
+
* Allowed values:
|
|
531
|
+
*
|
|
532
|
+
* - `createdAt:desc` (default in filter mode), `createdAt:asc` — newest / oldest
|
|
533
|
+
* first
|
|
534
|
+
* - `confidenceScore:desc` (the dashboard's "Best" view), `confidenceScore:asc`
|
|
535
|
+
* (low-confidence first, useful for moderation)
|
|
536
|
+
* - `score:desc` — raw upvotes − downvotes ("Top")
|
|
537
|
+
*
|
|
538
|
+
* Numeric counters (`upvotes`, `score`, `confidenceScore`) remain available as
|
|
539
|
+
* filter fields with the full range of operators; only the sort axes above are
|
|
540
|
+
* surfaced to keep the cursor-pagination contract small. `score:asc` and `upvotes`
|
|
541
|
+
* (both directions) are deliberately not exposed: `upvotes:desc` is identical to
|
|
542
|
+
* `score:desc` for the vast majority of comments (no downvotes), and
|
|
543
|
+
* "most-downvoted-first" / "least-upvoted-first" have no product use case.
|
|
544
|
+
*
|
|
545
|
+
* When `search` is set, results are ranked by relevance unless `sort` is also set,
|
|
546
|
+
* in which case the matching comments are returned in the requested order. The
|
|
547
|
+
* chosen sort axis (or relevance) is encoded in the cursor; switching `sort` (or
|
|
548
|
+
* toggling `search` on/off) mid-pagination returns `400 invalid_cursor`. Restart
|
|
549
|
+
* pagination without a cursor when changing the sort or search shape.
|
|
550
|
+
*
|
|
551
|
+
* ### Pagination
|
|
552
|
+
*
|
|
553
|
+
* Cursor-based, `limit` between 1 and 100 (default 10). In filter mode,
|
|
554
|
+
* `totalCount` is approximate and capped at 5000; `totalCountCapped` is `true`
|
|
555
|
+
* when the real count may be higher. In search mode, `totalCount` reflects the
|
|
556
|
+
* matching survivor set after the AST filter and is capped at 200 (the Turbopuffer
|
|
557
|
+
* top-K).
|
|
558
|
+
*
|
|
559
|
+
* ### Server-side guards
|
|
560
|
+
*
|
|
561
|
+
* These visibility rules are always applied and CANNOT be widened via the AST:
|
|
562
|
+
*
|
|
563
|
+
* - Callers without the `view_comments_private` permission can only see public
|
|
564
|
+
* comments. Sending `{ field: "isPrivate", operator: "=", value: true }` as such
|
|
565
|
+
* a caller returns an empty result, NOT a 403 — the security floor wins.
|
|
566
|
+
* - Callers without the `moderate_comments` permission can only see in-review
|
|
567
|
+
* comments they authored themselves. `inReview` queries from such callers are
|
|
568
|
+
* intersected with the authored-by-self constraint.
|
|
569
|
+
* - Spam comments (`isSpam: true`) are NOT excluded — this matches the legacy
|
|
570
|
+
* `GET /v2/comments` behavior. If you want to exclude spam, filter on the
|
|
571
|
+
* `isSpam` field (NOT exposed today; track follow-up).
|
|
572
|
+
*
|
|
573
|
+
* ### Response
|
|
574
|
+
*
|
|
575
|
+
* Returns a standard list envelope with comment rows identical to
|
|
576
|
+
* `GET /v2/comments/{id}`.
|
|
577
|
+
*
|
|
578
|
+
* ### Version Availability
|
|
579
|
+
*
|
|
580
|
+
* This endpoint is only available in API version 2026-01-01.nova and newer.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```ts
|
|
584
|
+
* const response = await client.feedback.comments.search();
|
|
585
|
+
* ```
|
|
586
|
+
*/
|
|
587
|
+
search(params: CommentSearchParams, options?: RequestOptions): APIPromise<CommentSearchResponse> {
|
|
588
|
+
const { 'Featurebase-Version': featurebaseVersion, ...body } = params;
|
|
589
|
+
return this._client.post('/v2/comments/search', {
|
|
590
|
+
body,
|
|
591
|
+
...options,
|
|
592
|
+
headers: buildHeaders([
|
|
593
|
+
{
|
|
594
|
+
...(featurebaseVersion?.toString() != null ?
|
|
595
|
+
{ 'Featurebase-Version': featurebaseVersion?.toString() }
|
|
596
|
+
: undefined),
|
|
597
|
+
},
|
|
598
|
+
options?.headers,
|
|
599
|
+
]),
|
|
600
|
+
});
|
|
601
|
+
}
|
|
441
602
|
}
|
|
442
603
|
|
|
443
604
|
export type CommentsCursorPage = CursorPage<Comment>;
|
|
@@ -571,6 +732,146 @@ export interface CommentDelete1Response {
|
|
|
571
732
|
success: boolean;
|
|
572
733
|
}
|
|
573
734
|
|
|
735
|
+
export interface CommentSearchResponse {
|
|
736
|
+
/**
|
|
737
|
+
* Array of search results
|
|
738
|
+
*/
|
|
739
|
+
data: Array<CommentSearchResponse.Data>;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Cursor for fetching the next page (null if no more results)
|
|
743
|
+
*/
|
|
744
|
+
nextCursor: string | null;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* Object type identifier
|
|
748
|
+
*/
|
|
749
|
+
object: 'list';
|
|
750
|
+
|
|
751
|
+
/**
|
|
752
|
+
* Total number of comments matching the query, capped at 5000 in filter mode and
|
|
753
|
+
* 200 (the Turbopuffer top-K) in search mode. When at the cap, `totalCountCapped`
|
|
754
|
+
* is true and the value is exactly the cap.
|
|
755
|
+
*/
|
|
756
|
+
totalCount?: number;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* True when `totalCount` is exactly the cap and the real count may be higher. UI
|
|
760
|
+
* can render as e.g. "5000+".
|
|
761
|
+
*/
|
|
762
|
+
totalCountCapped?: boolean;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
export namespace CommentSearchResponse {
|
|
766
|
+
export interface Data {
|
|
767
|
+
/**
|
|
768
|
+
* Unique identifier
|
|
769
|
+
*/
|
|
770
|
+
id: string;
|
|
771
|
+
|
|
772
|
+
author: Data.Author | null;
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Changelog ID this comment belongs to
|
|
776
|
+
*/
|
|
777
|
+
changelogId: string | null;
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Comment content in HTML format
|
|
781
|
+
*/
|
|
782
|
+
content: string;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* ISO 8601 timestamp when created
|
|
786
|
+
*/
|
|
787
|
+
createdAt: string;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Number of downvotes
|
|
791
|
+
*/
|
|
792
|
+
downvotes: number;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Whether the comment is in review
|
|
796
|
+
*/
|
|
797
|
+
inReview: boolean;
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Whether the comment is deleted
|
|
801
|
+
*/
|
|
802
|
+
isDeleted: boolean;
|
|
803
|
+
|
|
804
|
+
/**
|
|
805
|
+
* Whether the comment is pinned
|
|
806
|
+
*/
|
|
807
|
+
isPinned: boolean;
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Whether the comment is private
|
|
811
|
+
*/
|
|
812
|
+
isPrivate: boolean;
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Whether the comment is spam
|
|
816
|
+
*/
|
|
817
|
+
isSpam: boolean;
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* Object type identifier
|
|
821
|
+
*/
|
|
822
|
+
object: 'comment';
|
|
823
|
+
|
|
824
|
+
/**
|
|
825
|
+
* Parent comment ID for replies, null for root comments
|
|
826
|
+
*/
|
|
827
|
+
parentCommentId: string | null;
|
|
828
|
+
|
|
829
|
+
/**
|
|
830
|
+
* Post ID this comment belongs to
|
|
831
|
+
*/
|
|
832
|
+
postId: string | null;
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Net score (upvotes - downvotes)
|
|
836
|
+
*/
|
|
837
|
+
score: number;
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* ISO 8601 timestamp when updated
|
|
841
|
+
*/
|
|
842
|
+
updatedAt: string;
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* Number of upvotes
|
|
846
|
+
*/
|
|
847
|
+
upvotes: number;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export namespace Data {
|
|
851
|
+
export interface Author {
|
|
852
|
+
/**
|
|
853
|
+
* Author unique identifier
|
|
854
|
+
*/
|
|
855
|
+
id: string | null;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Author display name
|
|
859
|
+
*/
|
|
860
|
+
name: string;
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
* Author profile picture URL
|
|
864
|
+
*/
|
|
865
|
+
profilePicture: string | null;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Type of user who authored the comment
|
|
869
|
+
*/
|
|
870
|
+
type: 'admin' | 'customer' | 'guest' | 'integration' | 'bot' | 'lead';
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
|
|
574
875
|
export interface CommentCreateParams {
|
|
575
876
|
/**
|
|
576
877
|
* Body param: Comment content in HTML format
|
|
@@ -741,11 +1042,105 @@ export interface CommentDelete1Params {
|
|
|
741
1042
|
'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
|
|
742
1043
|
}
|
|
743
1044
|
|
|
1045
|
+
export interface CommentSearchParams {
|
|
1046
|
+
/**
|
|
1047
|
+
* Body param: An opaque cursor for pagination. Use the `nextCursor` value from a
|
|
1048
|
+
* previous response to fetch the next page of results.
|
|
1049
|
+
*/
|
|
1050
|
+
cursor?: string;
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Body param: A limit on the number of objects to be returned, between 1 and 100.
|
|
1054
|
+
*/
|
|
1055
|
+
limit?: number;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Body param: Structured filter AST. Either a single filter clause or one
|
|
1059
|
+
* top-level AND group (max 15 clauses). Top-level OR groups are not yet supported.
|
|
1060
|
+
*/
|
|
1061
|
+
query?: CommentSearchParams.SearchFilter | CommentSearchParams.SearchFilterGroup;
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Body param: Plain-text full-text search across comment `content`. Server-managed
|
|
1065
|
+
* (hybrid BM25 + vector, semanticRatio 0.5) — no operators, no field selection.
|
|
1066
|
+
* When `search` is set, results are ranked by relevance unless `sort` is also set,
|
|
1067
|
+
* in which case the matching comments are returned in the requested order. Combine
|
|
1068
|
+
* with `query` to constrain the search to a post / changelog / author / time
|
|
1069
|
+
* window.
|
|
1070
|
+
*/
|
|
1071
|
+
search?: string;
|
|
1072
|
+
|
|
1073
|
+
/**
|
|
1074
|
+
* Body param: Sort field + direction. Defaults to `createdAt:desc` in filter mode
|
|
1075
|
+
* and to relevance in search mode. The chosen sort axis is encoded in the cursor;
|
|
1076
|
+
* switching `sort` (or toggling `search` on/off) mid-pagination returns
|
|
1077
|
+
* `400 invalid_cursor`.
|
|
1078
|
+
*/
|
|
1079
|
+
sort?: 'createdAt:desc' | 'createdAt:asc' | 'confidenceScore:desc' | 'confidenceScore:asc' | 'score:desc';
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Header param: API version for this request. Defaults to your organization's
|
|
1083
|
+
* configured API version if not specified.
|
|
1084
|
+
*/
|
|
1085
|
+
'Featurebase-Version'?: '2026-01-01.nova' | '2025-12-12.clover';
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
export namespace CommentSearchParams {
|
|
1089
|
+
export interface SearchFilter {
|
|
1090
|
+
/**
|
|
1091
|
+
* Field name to filter on (e.g. `state`, `tag_ids`, `created_at`)
|
|
1092
|
+
*/
|
|
1093
|
+
field: string;
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Comparison operator
|
|
1097
|
+
*/
|
|
1098
|
+
operator: '=' | '!=' | 'IN' | 'NIN' | '>' | '<' | '>=' | '<=' | '~' | '!~' | '^' | '$';
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Value to compare against (primitive or array of primitives)
|
|
1102
|
+
*/
|
|
1103
|
+
value: string | number | boolean | Array<string | number> | null;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
export interface SearchFilterGroup {
|
|
1107
|
+
/**
|
|
1108
|
+
* Group operator: AND (all match) or OR (any match)
|
|
1109
|
+
*/
|
|
1110
|
+
operator: 'AND' | 'OR';
|
|
1111
|
+
|
|
1112
|
+
/**
|
|
1113
|
+
* Array of filter clauses (1-15 entries)
|
|
1114
|
+
*/
|
|
1115
|
+
value: Array<SearchFilterGroup.Value>;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
export namespace SearchFilterGroup {
|
|
1119
|
+
export interface Value {
|
|
1120
|
+
/**
|
|
1121
|
+
* Field name to filter on (e.g. `state`, `tag_ids`, `created_at`)
|
|
1122
|
+
*/
|
|
1123
|
+
field: string;
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Comparison operator
|
|
1127
|
+
*/
|
|
1128
|
+
operator: '=' | '!=' | 'IN' | 'NIN' | '>' | '<' | '>=' | '<=' | '~' | '!~' | '^' | '$';
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
* Value to compare against (primitive or array of primitives)
|
|
1132
|
+
*/
|
|
1133
|
+
value: string | number | boolean | Array<string | number> | null;
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
|
|
744
1138
|
export declare namespace Comments {
|
|
745
1139
|
export {
|
|
746
1140
|
type Comment as Comment,
|
|
747
1141
|
type CommentDelete0Response as CommentDelete0Response,
|
|
748
1142
|
type CommentDelete1Response as CommentDelete1Response,
|
|
1143
|
+
type CommentSearchResponse as CommentSearchResponse,
|
|
749
1144
|
type CommentsCursorPage as CommentsCursorPage,
|
|
750
1145
|
type CommentCreateParams as CommentCreateParams,
|
|
751
1146
|
type CommentRetrieveParams as CommentRetrieveParams,
|
|
@@ -753,5 +1148,6 @@ export declare namespace Comments {
|
|
|
753
1148
|
type CommentListParams as CommentListParams,
|
|
754
1149
|
type CommentDelete0Params as CommentDelete0Params,
|
|
755
1150
|
type CommentDelete1Params as CommentDelete1Params,
|
|
1151
|
+
type CommentSearchParams as CommentSearchParams,
|
|
756
1152
|
};
|
|
757
1153
|
}
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
CommentDelete1Response,
|
|
14
14
|
CommentListParams,
|
|
15
15
|
CommentRetrieveParams,
|
|
16
|
+
CommentSearchParams,
|
|
17
|
+
CommentSearchResponse,
|
|
16
18
|
CommentUpdateParams,
|
|
17
19
|
Comments,
|
|
18
20
|
CommentsCursorPage,
|
|
@@ -98,6 +100,7 @@ export declare namespace Feedback {
|
|
|
98
100
|
type Comment as Comment,
|
|
99
101
|
type CommentDelete0Response as CommentDelete0Response,
|
|
100
102
|
type CommentDelete1Response as CommentDelete1Response,
|
|
103
|
+
type CommentSearchResponse as CommentSearchResponse,
|
|
101
104
|
type CommentsCursorPage as CommentsCursorPage,
|
|
102
105
|
type CommentCreateParams as CommentCreateParams,
|
|
103
106
|
type CommentRetrieveParams as CommentRetrieveParams,
|
|
@@ -105,6 +108,7 @@ export declare namespace Feedback {
|
|
|
105
108
|
type CommentListParams as CommentListParams,
|
|
106
109
|
type CommentDelete0Params as CommentDelete0Params,
|
|
107
110
|
type CommentDelete1Params as CommentDelete1Params,
|
|
111
|
+
type CommentSearchParams as CommentSearchParams,
|
|
108
112
|
};
|
|
109
113
|
|
|
110
114
|
export {
|
|
@@ -12,12 +12,14 @@ export {
|
|
|
12
12
|
type Comment,
|
|
13
13
|
type CommentDelete0Response,
|
|
14
14
|
type CommentDelete1Response,
|
|
15
|
+
type CommentSearchResponse,
|
|
15
16
|
type CommentCreateParams,
|
|
16
17
|
type CommentRetrieveParams,
|
|
17
18
|
type CommentUpdateParams,
|
|
18
19
|
type CommentListParams,
|
|
19
20
|
type CommentDelete0Params,
|
|
20
21
|
type CommentDelete1Params,
|
|
22
|
+
type CommentSearchParams,
|
|
21
23
|
type CommentsCursorPage,
|
|
22
24
|
} from './comments';
|
|
23
25
|
export {
|
|
@@ -322,7 +322,7 @@ export class Posts extends APIResource {
|
|
|
322
322
|
*
|
|
323
323
|
* - **Filter mode** — pass a structured `query` AST (and/or `sort`) and the
|
|
324
324
|
* endpoint returns posts matching the filter, ordered by `sort` (default
|
|
325
|
-
* `
|
|
325
|
+
* `createdAt:desc`). Same shape as `/v2/conversations/search`,
|
|
326
326
|
* `/v2/companies/search`, `/v2/contacts/search`.
|
|
327
327
|
* - **Search mode** — pass a top-level `search` string and the endpoint runs a
|
|
328
328
|
* hybrid full-text + vector search (BM25 + embeddings, semanticRatio 0.5) over
|
|
@@ -337,7 +337,7 @@ export class Posts extends APIResource {
|
|
|
337
337
|
* "operator": "AND",
|
|
338
338
|
* "value": [
|
|
339
339
|
* {
|
|
340
|
-
* "field": "
|
|
340
|
+
* "field": "boardId",
|
|
341
341
|
* "operator": "IN",
|
|
342
342
|
* "value": ["507f1f77bcf86cd799439011"]
|
|
343
343
|
* }
|
|
@@ -363,7 +363,7 @@ export class Posts extends APIResource {
|
|
|
363
363
|
* "operator": "AND",
|
|
364
364
|
* "value": [
|
|
365
365
|
* {
|
|
366
|
-
* "field": "
|
|
366
|
+
* "field": "boardId",
|
|
367
367
|
* "operator": "IN",
|
|
368
368
|
* "value": ["507f1f77bcf86cd799439011"]
|
|
369
369
|
* },
|
|
@@ -375,21 +375,44 @@ export class Posts extends APIResource {
|
|
|
375
375
|
* }
|
|
376
376
|
* ```
|
|
377
377
|
*
|
|
378
|
+
* To list every post a contact has upvoted (the inverse of
|
|
379
|
+
* `feedback.posts.voters.list(postId)`):
|
|
380
|
+
*
|
|
381
|
+
* ```json
|
|
382
|
+
* {
|
|
383
|
+
* "query": {
|
|
384
|
+
* "field": "voterId",
|
|
385
|
+
* "operator": "=",
|
|
386
|
+
* "value": "507f1f77bcf86cd799439011"
|
|
387
|
+
* },
|
|
388
|
+
* "sort": "upvotes:desc",
|
|
389
|
+
* "limit": 100
|
|
390
|
+
* }
|
|
391
|
+
* ```
|
|
392
|
+
*
|
|
378
393
|
* Top-level `OR` groups and nested groups are not supported in this version.
|
|
379
394
|
*
|
|
380
395
|
* ### Supported fields and operators
|
|
381
396
|
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* |
|
|
390
|
-
* |
|
|
391
|
-
* | `
|
|
392
|
-
* | `
|
|
397
|
+
* Field names are camelCase, matching the rest of the v2 public API. Snake_case
|
|
398
|
+
* names that this endpoint originally shipped with (`board_id`, `status_id`,
|
|
399
|
+
* `tag_id`, `author_id`, `voter_id`, `assignee_id`, `company_id`, `created_at`,
|
|
400
|
+
* `updated_at`, `comment_count`, `monthly_spend`, `opportunity_amount`,
|
|
401
|
+
* `in_review`, `is_pinned`) are still accepted for back-compat but are deprecated
|
|
402
|
+
* — please migrate to camelCase in new code.
|
|
403
|
+
*
|
|
404
|
+
* | Field | Type | Operators |
|
|
405
|
+
* | -------------------------------------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
406
|
+
* | `boardId` | id (categoryId) | `=`, `!=`, `IN`, `NIN` |
|
|
407
|
+
* | `statusId` | id (postStatus) | `=`, `!=`, `IN`, `NIN` |
|
|
408
|
+
* | `tagId` | id (postTags) | `=`, `!=`, `IN`, `NIN` |
|
|
409
|
+
* | `authorId` | string (user id) | `=`, `!=`, `IN`, `NIN` |
|
|
410
|
+
* | `voterId` | id (customer) | `=`, `IN` (use to list every post a contact has upvoted; only matches `type: customer` upvoters — guests/admins are not searchable here) |
|
|
411
|
+
* | `assigneeId` | id or null (admin) | `=`, `!=`, `IN`, `NIN` (use `null` for unassigned) |
|
|
412
|
+
* | `companyId` | string (external company id) | `=`, `!=`, `IN`, `NIN` |
|
|
413
|
+
* | `createdAt`, `updatedAt`, `eta` | unix seconds | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
414
|
+
* | `upvotes`, `commentCount`, `monthlySpend`, `opportunityAmount` | number | `=`, `!=`, `>`, `<`, `>=`, `<=` |
|
|
415
|
+
* | `inReview`, `isPinned` | boolean | `=`, `!=` |
|
|
393
416
|
*
|
|
394
417
|
* Use the top-level `search` field for full-text search across `title` and
|
|
395
418
|
* `content` (see "Search mode" above). The clause-level operators `~`, `!~`, `^`,
|
|
@@ -398,7 +421,7 @@ export class Posts extends APIResource {
|
|
|
398
421
|
* A filter-mode query (no `search`) consisting only of `!=` or `NIN` clauses on
|
|
399
422
|
* unbounded fields is rejected with `query_too_broad` to prevent full-org scans.
|
|
400
423
|
* Combine the negation with at least one positive clause (`=`, `IN`, `>`, `<`)
|
|
401
|
-
* instead. Boolean fields (`
|
|
424
|
+
* instead. Boolean fields (`inReview`, `isPinned`) are bounded so a standalone
|
|
402
425
|
* negation on them is allowed. Search mode (with `search` set) relaxes this — the
|
|
403
426
|
* FTS query itself acts as the positive constraint.
|
|
404
427
|
*
|
|
@@ -406,15 +429,18 @@ export class Posts extends APIResource {
|
|
|
406
429
|
*
|
|
407
430
|
* Allowed values:
|
|
408
431
|
*
|
|
409
|
-
* - `
|
|
410
|
-
* - `
|
|
432
|
+
* - `createdAt:desc` (default), `createdAt:asc`
|
|
433
|
+
* - `updatedAt:desc`, `updatedAt:asc`
|
|
411
434
|
* - `upvotes:desc`, `upvotes:asc`
|
|
412
435
|
* - `eta:desc`, `eta:asc`
|
|
413
|
-
* - `
|
|
414
|
-
* - `
|
|
415
|
-
* - `opportunity_amount:desc`, `opportunity_amount:asc` (linked HubSpot/Salesforce
|
|
436
|
+
* - `monthlySpend:desc`, `monthlySpend:asc` (sum of upvoters' monthly spend)
|
|
437
|
+
* - `opportunityAmount:desc`, `opportunityAmount:asc` (linked HubSpot/Salesforce
|
|
416
438
|
* value)
|
|
417
|
-
* - `
|
|
439
|
+
* - `commentCount:desc`, `commentCount:asc`
|
|
440
|
+
*
|
|
441
|
+
* Snake_case sort axes (`created_at:desc`, `monthly_spend:asc`, etc.) are accepted
|
|
442
|
+
* for back-compat — the cursor encodes the canonical camelCase identity, so a
|
|
443
|
+
* caller can switch naming conventions mid-pagination without restarting.
|
|
418
444
|
*
|
|
419
445
|
* When `search` is set, results are ranked by relevance unless `sort` is also set,
|
|
420
446
|
* in which case the matching posts are returned in the requested order. The chosen
|
|
@@ -1515,21 +1541,30 @@ export interface PostSearchParams {
|
|
|
1515
1541
|
search?: string;
|
|
1516
1542
|
|
|
1517
1543
|
/**
|
|
1518
|
-
* Body param: Sort field + direction. Defaults to `
|
|
1544
|
+
* Body param: Sort field + direction. Defaults to `createdAt:desc`. The chosen
|
|
1519
1545
|
* sort axis is encoded in the cursor; switching `sort` mid-pagination returns
|
|
1520
|
-
* `400 invalid_cursor`.
|
|
1546
|
+
* `400 invalid_cursor`. Snake_case names (`created_at:desc`, `monthly_spend:asc`,
|
|
1547
|
+
* …) are accepted for back-compat — prefer camelCase in new code.
|
|
1521
1548
|
*/
|
|
1522
1549
|
sort?:
|
|
1523
|
-
| '
|
|
1524
|
-
| '
|
|
1525
|
-
| '
|
|
1526
|
-
| '
|
|
1550
|
+
| 'createdAt:desc'
|
|
1551
|
+
| 'createdAt:asc'
|
|
1552
|
+
| 'updatedAt:desc'
|
|
1553
|
+
| 'updatedAt:asc'
|
|
1527
1554
|
| 'upvotes:desc'
|
|
1528
1555
|
| 'upvotes:asc'
|
|
1529
1556
|
| 'eta:desc'
|
|
1530
1557
|
| 'eta:asc'
|
|
1531
|
-
| '
|
|
1532
|
-
| '
|
|
1558
|
+
| 'monthlySpend:desc'
|
|
1559
|
+
| 'monthlySpend:asc'
|
|
1560
|
+
| 'opportunityAmount:desc'
|
|
1561
|
+
| 'opportunityAmount:asc'
|
|
1562
|
+
| 'commentCount:desc'
|
|
1563
|
+
| 'commentCount:asc'
|
|
1564
|
+
| 'created_at:desc'
|
|
1565
|
+
| 'created_at:asc'
|
|
1566
|
+
| 'updated_at:desc'
|
|
1567
|
+
| 'updated_at:asc'
|
|
1533
1568
|
| 'monthly_spend:desc'
|
|
1534
1569
|
| 'monthly_spend:asc'
|
|
1535
1570
|
| 'opportunity_amount:desc'
|