featurebase-node 0.3.0 → 0.4.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.
Files changed (288) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +12 -6
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -6
  6. package/client.d.ts.map +1 -1
  7. package/client.js +10 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +10 -0
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +54 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +54 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +101 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +95 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/package.json +11 -1
  28. package/pagination.d.mts +2 -0
  29. package/pagination.d.mts.map +1 -0
  30. package/pagination.d.ts +2 -0
  31. package/pagination.d.ts.map +1 -0
  32. package/pagination.js +6 -0
  33. package/pagination.js.map +1 -0
  34. package/pagination.mjs +2 -0
  35. package/pagination.mjs.map +1 -0
  36. package/resources/changelogs/changelogs.d.mts +9 -53
  37. package/resources/changelogs/changelogs.d.mts.map +1 -1
  38. package/resources/changelogs/changelogs.d.ts +9 -53
  39. package/resources/changelogs/changelogs.d.ts.map +1 -1
  40. package/resources/changelogs/changelogs.js +6 -2
  41. package/resources/changelogs/changelogs.js.map +1 -1
  42. package/resources/changelogs/changelogs.mjs +6 -2
  43. package/resources/changelogs/changelogs.mjs.map +1 -1
  44. package/resources/changelogs/index.d.mts +1 -1
  45. package/resources/changelogs/index.d.mts.map +1 -1
  46. package/resources/changelogs/index.d.ts +1 -1
  47. package/resources/changelogs/index.d.ts.map +1 -1
  48. package/resources/feedback/comments.d.mts +9 -53
  49. package/resources/feedback/comments.d.mts.map +1 -1
  50. package/resources/feedback/comments.d.ts +9 -53
  51. package/resources/feedback/comments.d.ts.map +1 -1
  52. package/resources/feedback/comments.js +6 -2
  53. package/resources/feedback/comments.js.map +1 -1
  54. package/resources/feedback/comments.mjs +6 -2
  55. package/resources/feedback/comments.mjs.map +1 -1
  56. package/resources/feedback/feedback.d.mts +4 -4
  57. package/resources/feedback/feedback.d.mts.map +1 -1
  58. package/resources/feedback/feedback.d.ts +4 -4
  59. package/resources/feedback/feedback.d.ts.map +1 -1
  60. package/resources/feedback/feedback.mjs.map +1 -1
  61. package/resources/feedback/index.d.mts +2 -2
  62. package/resources/feedback/index.d.mts.map +1 -1
  63. package/resources/feedback/index.d.ts +2 -2
  64. package/resources/feedback/index.d.ts.map +1 -1
  65. package/resources/feedback/posts/index.d.mts +2 -2
  66. package/resources/feedback/posts/index.d.mts.map +1 -1
  67. package/resources/feedback/posts/index.d.ts +2 -2
  68. package/resources/feedback/posts/index.d.ts.map +1 -1
  69. package/resources/feedback/posts/index.js.map +1 -1
  70. package/resources/feedback/posts/index.mjs.map +1 -1
  71. package/resources/feedback/posts/posts.d.mts +11 -56
  72. package/resources/feedback/posts/posts.d.mts.map +1 -1
  73. package/resources/feedback/posts/posts.d.ts +11 -56
  74. package/resources/feedback/posts/posts.d.ts.map +1 -1
  75. package/resources/feedback/posts/posts.js +6 -2
  76. package/resources/feedback/posts/posts.js.map +1 -1
  77. package/resources/feedback/posts/posts.mjs +6 -2
  78. package/resources/feedback/posts/posts.mjs.map +1 -1
  79. package/resources/feedback/posts/voters.d.mts +79 -124
  80. package/resources/feedback/posts/voters.d.mts.map +1 -1
  81. package/resources/feedback/posts/voters.d.ts +79 -124
  82. package/resources/feedback/posts/voters.d.ts.map +1 -1
  83. package/resources/feedback/posts/voters.js +7 -3
  84. package/resources/feedback/posts/voters.js.map +1 -1
  85. package/resources/feedback/posts/voters.mjs +7 -3
  86. package/resources/feedback/posts/voters.mjs.map +1 -1
  87. package/resources/help-center/articles.d.mts +9 -27
  88. package/resources/help-center/articles.d.mts.map +1 -1
  89. package/resources/help-center/articles.d.ts +9 -27
  90. package/resources/help-center/articles.d.ts.map +1 -1
  91. package/resources/help-center/articles.js +6 -2
  92. package/resources/help-center/articles.js.map +1 -1
  93. package/resources/help-center/articles.mjs +6 -2
  94. package/resources/help-center/articles.mjs.map +1 -1
  95. package/resources/help-center/collections.d.mts +9 -28
  96. package/resources/help-center/collections.d.mts.map +1 -1
  97. package/resources/help-center/collections.d.ts +9 -28
  98. package/resources/help-center/collections.d.ts.map +1 -1
  99. package/resources/help-center/collections.js +6 -3
  100. package/resources/help-center/collections.js.map +1 -1
  101. package/resources/help-center/collections.mjs +6 -3
  102. package/resources/help-center/collections.mjs.map +1 -1
  103. package/resources/help-center/help-center.d.mts +8 -8
  104. package/resources/help-center/help-center.d.mts.map +1 -1
  105. package/resources/help-center/help-center.d.ts +8 -8
  106. package/resources/help-center/help-center.d.ts.map +1 -1
  107. package/resources/help-center/help-center.mjs.map +1 -1
  108. package/resources/help-center/help-centers.d.mts +9 -28
  109. package/resources/help-center/help-centers.d.mts.map +1 -1
  110. package/resources/help-center/help-centers.d.ts +9 -28
  111. package/resources/help-center/help-centers.d.ts.map +1 -1
  112. package/resources/help-center/help-centers.js +6 -3
  113. package/resources/help-center/help-centers.js.map +1 -1
  114. package/resources/help-center/help-centers.mjs +6 -3
  115. package/resources/help-center/help-centers.mjs.map +1 -1
  116. package/resources/help-center/index.d.mts +4 -4
  117. package/resources/help-center/index.d.mts.map +1 -1
  118. package/resources/help-center/index.d.ts +4 -4
  119. package/resources/help-center/index.d.ts.map +1 -1
  120. package/resources/help-center/redirect-rules.d.mts +9 -28
  121. package/resources/help-center/redirect-rules.d.mts.map +1 -1
  122. package/resources/help-center/redirect-rules.d.ts +9 -28
  123. package/resources/help-center/redirect-rules.d.ts.map +1 -1
  124. package/resources/help-center/redirect-rules.js +6 -3
  125. package/resources/help-center/redirect-rules.js.map +1 -1
  126. package/resources/help-center/redirect-rules.mjs +6 -3
  127. package/resources/help-center/redirect-rules.mjs.map +1 -1
  128. package/resources/index.d.mts +3 -3
  129. package/resources/index.d.mts.map +1 -1
  130. package/resources/index.d.ts +3 -3
  131. package/resources/index.d.ts.map +1 -1
  132. package/resources/index.js.map +1 -1
  133. package/resources/index.mjs.map +1 -1
  134. package/resources/organization/brands.d.mts +5 -26
  135. package/resources/organization/brands.d.mts.map +1 -1
  136. package/resources/organization/brands.d.ts +5 -26
  137. package/resources/organization/brands.d.ts.map +1 -1
  138. package/resources/organization/brands.js +2 -1
  139. package/resources/organization/brands.js.map +1 -1
  140. package/resources/organization/brands.mjs +2 -1
  141. package/resources/organization/brands.mjs.map +1 -1
  142. package/resources/organization/index.d.mts +1 -1
  143. package/resources/organization/index.d.mts.map +1 -1
  144. package/resources/organization/index.d.ts +1 -1
  145. package/resources/organization/index.d.ts.map +1 -1
  146. package/resources/organization/organization.d.mts +2 -2
  147. package/resources/organization/organization.d.mts.map +1 -1
  148. package/resources/organization/organization.d.ts +2 -2
  149. package/resources/organization/organization.d.ts.map +1 -1
  150. package/resources/organization/organization.js.map +1 -1
  151. package/resources/organization/organization.mjs.map +1 -1
  152. package/resources/support/conversations/conversations.d.mts +9 -28
  153. package/resources/support/conversations/conversations.d.mts.map +1 -1
  154. package/resources/support/conversations/conversations.d.ts +9 -28
  155. package/resources/support/conversations/conversations.d.ts.map +1 -1
  156. package/resources/support/conversations/conversations.js +6 -3
  157. package/resources/support/conversations/conversations.js.map +1 -1
  158. package/resources/support/conversations/conversations.mjs +6 -3
  159. package/resources/support/conversations/conversations.mjs.map +1 -1
  160. package/resources/support/conversations/index.d.mts +1 -1
  161. package/resources/support/conversations/index.d.mts.map +1 -1
  162. package/resources/support/conversations/index.d.ts +1 -1
  163. package/resources/support/conversations/index.d.ts.map +1 -1
  164. package/resources/support/index.d.mts +2 -2
  165. package/resources/support/index.d.mts.map +1 -1
  166. package/resources/support/index.d.ts +2 -2
  167. package/resources/support/index.d.ts.map +1 -1
  168. package/resources/support/support.d.mts +4 -4
  169. package/resources/support/support.d.mts.map +1 -1
  170. package/resources/support/support.d.ts +4 -4
  171. package/resources/support/support.d.ts.map +1 -1
  172. package/resources/support/support.mjs.map +1 -1
  173. package/resources/support/tickets/index.d.mts +1 -1
  174. package/resources/support/tickets/index.d.mts.map +1 -1
  175. package/resources/support/tickets/index.d.ts +1 -1
  176. package/resources/support/tickets/index.d.ts.map +1 -1
  177. package/resources/support/tickets/tickets.d.mts +9 -27
  178. package/resources/support/tickets/tickets.d.mts.map +1 -1
  179. package/resources/support/tickets/tickets.d.ts +9 -27
  180. package/resources/support/tickets/tickets.d.ts.map +1 -1
  181. package/resources/support/tickets/tickets.js +6 -2
  182. package/resources/support/tickets/tickets.js.map +1 -1
  183. package/resources/support/tickets/tickets.mjs +6 -2
  184. package/resources/support/tickets/tickets.mjs.map +1 -1
  185. package/resources/surveys.d.mts +34 -79
  186. package/resources/surveys.d.mts.map +1 -1
  187. package/resources/surveys.d.ts +34 -79
  188. package/resources/surveys.d.ts.map +1 -1
  189. package/resources/surveys.js +4 -3
  190. package/resources/surveys.js.map +1 -1
  191. package/resources/surveys.mjs +4 -3
  192. package/resources/surveys.mjs.map +1 -1
  193. package/resources/users/companies/companies.d.mts +9 -28
  194. package/resources/users/companies/companies.d.mts.map +1 -1
  195. package/resources/users/companies/companies.d.ts +9 -28
  196. package/resources/users/companies/companies.d.ts.map +1 -1
  197. package/resources/users/companies/companies.js +6 -2
  198. package/resources/users/companies/companies.js.map +1 -1
  199. package/resources/users/companies/companies.mjs +6 -2
  200. package/resources/users/companies/companies.mjs.map +1 -1
  201. package/resources/users/companies/contacts.d.mts +11 -16
  202. package/resources/users/companies/contacts.d.mts.map +1 -1
  203. package/resources/users/companies/contacts.d.ts +11 -16
  204. package/resources/users/companies/contacts.d.ts.map +1 -1
  205. package/resources/users/companies/contacts.js +8 -5
  206. package/resources/users/companies/contacts.js.map +1 -1
  207. package/resources/users/companies/contacts.mjs +8 -5
  208. package/resources/users/companies/contacts.mjs.map +1 -1
  209. package/resources/users/companies/index.d.mts +1 -1
  210. package/resources/users/companies/index.d.mts.map +1 -1
  211. package/resources/users/companies/index.d.ts +1 -1
  212. package/resources/users/companies/index.d.ts.map +1 -1
  213. package/resources/users/contacts/contacts.d.mts +9 -13
  214. package/resources/users/contacts/contacts.d.mts.map +1 -1
  215. package/resources/users/contacts/contacts.d.ts +9 -13
  216. package/resources/users/contacts/contacts.d.ts.map +1 -1
  217. package/resources/users/contacts/contacts.js +6 -2
  218. package/resources/users/contacts/contacts.js.map +1 -1
  219. package/resources/users/contacts/contacts.mjs +6 -2
  220. package/resources/users/contacts/contacts.mjs.map +1 -1
  221. package/resources/users/contacts/index.d.mts +1 -1
  222. package/resources/users/contacts/index.d.mts.map +1 -1
  223. package/resources/users/contacts/index.d.ts +1 -1
  224. package/resources/users/contacts/index.d.ts.map +1 -1
  225. package/resources/users/contacts/index.js.map +1 -1
  226. package/resources/users/contacts/index.mjs.map +1 -1
  227. package/resources/users/index.d.mts +2 -2
  228. package/resources/users/index.d.mts.map +1 -1
  229. package/resources/users/index.d.ts +2 -2
  230. package/resources/users/index.d.ts.map +1 -1
  231. package/resources/users/index.js.map +1 -1
  232. package/resources/users/index.mjs.map +1 -1
  233. package/resources/users/users.d.mts +4 -4
  234. package/resources/users/users.d.mts.map +1 -1
  235. package/resources/users/users.d.ts +4 -4
  236. package/resources/users/users.d.ts.map +1 -1
  237. package/resources/users/users.js.map +1 -1
  238. package/resources/users/users.mjs.map +1 -1
  239. package/resources/webhooks.d.mts +9 -27
  240. package/resources/webhooks.d.mts.map +1 -1
  241. package/resources/webhooks.d.ts +9 -27
  242. package/resources/webhooks.d.ts.map +1 -1
  243. package/resources/webhooks.js +6 -2
  244. package/resources/webhooks.js.map +1 -1
  245. package/resources/webhooks.mjs +6 -2
  246. package/resources/webhooks.mjs.map +1 -1
  247. package/src/client.ts +41 -10
  248. package/src/core/pagination.ts +157 -0
  249. package/src/index.ts +1 -0
  250. package/src/pagination.ts +2 -0
  251. package/src/resources/changelogs/changelogs.ts +11 -64
  252. package/src/resources/changelogs/index.ts +1 -1
  253. package/src/resources/feedback/comments.ts +11 -64
  254. package/src/resources/feedback/feedback.ts +4 -4
  255. package/src/resources/feedback/index.ts +2 -2
  256. package/src/resources/feedback/posts/index.ts +2 -1
  257. package/src/resources/feedback/posts/posts.ts +13 -65
  258. package/src/resources/feedback/posts/voters.ts +87 -140
  259. package/src/resources/help-center/articles.ts +11 -33
  260. package/src/resources/help-center/collections.ts +11 -34
  261. package/src/resources/help-center/help-center.ts +8 -8
  262. package/src/resources/help-center/help-centers.ts +11 -34
  263. package/src/resources/help-center/index.ts +4 -4
  264. package/src/resources/help-center/redirect-rules.ts +11 -34
  265. package/src/resources/index.ts +6 -5
  266. package/src/resources/organization/brands.ts +7 -32
  267. package/src/resources/organization/index.ts +1 -1
  268. package/src/resources/organization/organization.ts +2 -2
  269. package/src/resources/support/conversations/conversations.ts +11 -34
  270. package/src/resources/support/conversations/index.ts +1 -1
  271. package/src/resources/support/index.ts +2 -2
  272. package/src/resources/support/support.ts +4 -4
  273. package/src/resources/support/tickets/index.ts +1 -1
  274. package/src/resources/support/tickets/tickets.ts +11 -33
  275. package/src/resources/surveys.ts +54 -102
  276. package/src/resources/users/companies/companies.ts +11 -34
  277. package/src/resources/users/companies/contacts.ts +24 -26
  278. package/src/resources/users/companies/index.ts +1 -1
  279. package/src/resources/users/contacts/contacts.ts +14 -15
  280. package/src/resources/users/contacts/index.ts +1 -0
  281. package/src/resources/users/index.ts +2 -1
  282. package/src/resources/users/users.ts +4 -2
  283. package/src/resources/webhooks.ts +11 -33
  284. package/src/version.ts +1 -1
  285. package/version.d.mts +1 -1
  286. package/version.d.ts +1 -1
  287. package/version.js +1 -1
  288. package/version.mjs +1 -1
@@ -8,12 +8,14 @@ import {
8
8
  VoterAddResponse,
9
9
  VoterListParams,
10
10
  VoterListResponse,
11
+ VoterListResponsesCursorPage,
11
12
  VoterRemoveParams,
12
13
  VoterRemoveResponse,
13
14
  Voters,
14
15
  } from './voters';
15
16
  import * as TicketsAPI from '../../support/tickets/tickets';
16
17
  import { APIPromise } from '../../../core/api-promise';
18
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
17
19
  import { buildHeaders } from '../../../internal/headers';
18
20
  import { RequestOptions } from '../../../internal/request-options';
19
21
  import { path } from '../../../internal/utils/path';
@@ -225,15 +227,18 @@ export class Posts extends APIResource {
225
227
  *
226
228
  * @example
227
229
  * ```ts
228
- * const posts = await client.feedback.posts.list();
230
+ * // Automatically fetches more pages as needed.
231
+ * for await (const post of client.feedback.posts.list()) {
232
+ * // ...
233
+ * }
229
234
  * ```
230
235
  */
231
236
  list(
232
237
  params: PostListParams | null | undefined = {},
233
238
  options?: RequestOptions,
234
- ): APIPromise<PostListResponse> {
239
+ ): PagePromise<PostsCursorPage, Post> {
235
240
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
236
- return this._client.get('/v2/posts', {
241
+ return this._client.getAPIList('/v2/posts', CursorPage<Post>, {
237
242
  query,
238
243
  ...options,
239
244
  headers: buildHeaders([
@@ -290,6 +295,8 @@ export class Posts extends APIResource {
290
295
  }
291
296
  }
292
297
 
298
+ export type PostsCursorPage = CursorPage<Post>;
299
+
293
300
  export interface Post {
294
301
  /**
295
302
  * Unique identifier
@@ -629,55 +636,6 @@ export namespace Post {
629
636
  }
630
637
  }
631
638
 
632
- export interface PostListResponse {
633
- /**
634
- * Array of posts
635
- */
636
- data: Array<Post>;
637
-
638
- /**
639
- * Cursor for fetching the next page (cursor-based pagination)
640
- */
641
- nextCursor: string | null;
642
-
643
- /**
644
- * Object type identifier
645
- */
646
- object: 'list';
647
-
648
- /**
649
- * Pagination metadata for page-based requests
650
- */
651
- pagination?: PostListResponse.Pagination;
652
- }
653
-
654
- export namespace PostListResponse {
655
- /**
656
- * Pagination metadata for page-based requests
657
- */
658
- export interface Pagination {
659
- /**
660
- * Items per page
661
- */
662
- limit: number;
663
-
664
- /**
665
- * Current page number
666
- */
667
- page: number;
668
-
669
- /**
670
- * Total number of items
671
- */
672
- total: number;
673
-
674
- /**
675
- * Total number of pages
676
- */
677
- totalPages: number;
678
- }
679
- }
680
-
681
639
  export interface PostDeleteResponse {
682
640
  /**
683
641
  * Unique identifier of the deleted post
@@ -931,28 +889,17 @@ export interface PostUpdateParams {
931
889
  'Featurebase-Version'?: string;
932
890
  }
933
891
 
934
- export interface PostListParams {
892
+ export interface PostListParams extends CursorPageParams {
935
893
  /**
936
894
  * Query param: Filter by board (category) ID(s)
937
895
  */
938
896
  boardId?: string | Array<string>;
939
897
 
940
- /**
941
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
942
- * previous response to fetch the next page of results.
943
- */
944
- cursor?: string;
945
-
946
898
  /**
947
899
  * Query param: Include posts that are in review
948
900
  */
949
901
  inReview?: boolean | null;
950
902
 
951
- /**
952
- * Query param: A limit on the number of posts to be returned, between 1 and 100.
953
- */
954
- limit?: number;
955
-
956
903
  /**
957
904
  * Query param: Search query to filter posts by title/content
958
905
  */
@@ -998,8 +945,8 @@ Posts.Voters = Voters;
998
945
  export declare namespace Posts {
999
946
  export {
1000
947
  type Post as Post,
1001
- type PostListResponse as PostListResponse,
1002
948
  type PostDeleteResponse as PostDeleteResponse,
949
+ type PostsCursorPage as PostsCursorPage,
1003
950
  type PostCreateParams as PostCreateParams,
1004
951
  type PostRetrieveParams as PostRetrieveParams,
1005
952
  type PostUpdateParams as PostUpdateParams,
@@ -1012,6 +959,7 @@ export declare namespace Posts {
1012
959
  type VoterListResponse as VoterListResponse,
1013
960
  type VoterAddResponse as VoterAddResponse,
1014
961
  type VoterRemoveResponse as VoterRemoveResponse,
962
+ type VoterListResponsesCursorPage as VoterListResponsesCursorPage,
1015
963
  type VoterListParams as VoterListParams,
1016
964
  type VoterAddParams as VoterAddParams,
1017
965
  type VoterRemoveParams as VoterRemoveParams,
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as CompaniesAPI from '../../users/companies/companies';
5
5
  import { APIPromise } from '../../../core/api-promise';
6
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
6
7
  import { buildHeaders } from '../../../internal/headers';
7
8
  import { RequestOptions } from '../../../internal/request-options';
8
9
  import { path } from '../../../internal/utils/path';
@@ -50,18 +51,21 @@ export class Voters extends APIResource {
50
51
  *
51
52
  * @example
52
53
  * ```ts
53
- * const voters = await client.feedback.posts.voters.list(
54
+ * // Automatically fetches more pages as needed.
55
+ * for await (const voterListResponse of client.feedback.posts.voters.list(
54
56
  * '507f1f77bcf86cd799439011',
55
- * );
57
+ * )) {
58
+ * // ...
59
+ * }
56
60
  * ```
57
61
  */
58
62
  list(
59
63
  id: string,
60
64
  params: VoterListParams | null | undefined = {},
61
65
  options?: RequestOptions,
62
- ): APIPromise<VoterListResponse> {
66
+ ): PagePromise<VoterListResponsesCursorPage, VoterListResponse> {
63
67
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
64
- return this._client.get(path`/v2/posts/${id}/voters`, {
68
+ return this._client.getAPIList(path`/v2/posts/${id}/voters`, CursorPage<VoterListResponse>, {
65
69
  query,
66
70
  ...options,
67
71
  headers: buildHeaders([
@@ -176,150 +180,103 @@ export class Voters extends APIResource {
176
180
  }
177
181
  }
178
182
 
183
+ export type VoterListResponsesCursorPage = CursorPage<VoterListResponse>;
184
+
179
185
  export interface VoterListResponse {
180
186
  /**
181
- * Array of users
187
+ * Unique identifier
182
188
  */
183
- data: Array<VoterListResponse.Data>;
189
+ id: string;
184
190
 
185
191
  /**
186
- * Cursor for fetching the next page (cursor-based pagination)
192
+ * User display name
187
193
  */
188
- nextCursor: string | null;
194
+ name: string;
189
195
 
190
196
  /**
191
197
  * Object type identifier
192
198
  */
193
- object: 'list';
199
+ object: 'contact';
194
200
 
195
201
  /**
196
- * Pagination metadata for page-based requests
202
+ * Type of user
197
203
  */
198
- pagination?: VoterListResponse.Pagination;
199
- }
204
+ type: 'admin' | 'customer' | 'guest' | 'integration' | 'bot' | 'lead';
200
205
 
201
- export namespace VoterListResponse {
202
- export interface Data {
203
- /**
204
- * Unique identifier
205
- */
206
- id: string;
207
-
208
- /**
209
- * User display name
210
- */
211
- name: string;
212
-
213
- /**
214
- * Object type identifier
215
- */
216
- object: 'contact';
217
-
218
- /**
219
- * Type of user
220
- */
221
- type: 'admin' | 'customer' | 'guest' | 'integration' | 'bot' | 'lead';
222
-
223
- /**
224
- * Number of comments created
225
- */
226
- commentsCreated?: number;
227
-
228
- /**
229
- * Companies the user belongs to
230
- */
231
- companies?: Array<CompaniesAPI.Company>;
232
-
233
- /**
234
- * Custom field values on the user
235
- */
236
- customFields?: { [key: string]: unknown };
237
-
238
- /**
239
- * User description/bio
240
- */
241
- description?: string;
242
-
243
- /**
244
- * User email
245
- */
246
- email?: string | null;
247
-
248
- /**
249
- * Last activity ISO timestamp
250
- */
251
- lastActivity?: string;
252
-
253
- /**
254
- * User locale
255
- */
256
- locale?: string;
257
-
258
- /**
259
- * Whether manually opted out from changelog
260
- */
261
- manuallyOptedOutFromChangelog?: boolean;
262
-
263
- /**
264
- * Organization ID the user belongs to
265
- */
266
- organizationId?: string;
267
-
268
- /**
269
- * Number of posts created
270
- */
271
- postsCreated?: number;
272
-
273
- /**
274
- * Profile picture URL
275
- */
276
- profilePicture?: string | null;
277
-
278
- /**
279
- * User roles
280
- */
281
- roles?: Array<string>;
282
-
283
- /**
284
- * Whether subscribed to changelog
285
- */
286
- subscribedToChangelog?: boolean;
287
-
288
- /**
289
- * External user ID from SSO
290
- */
291
- userId?: string;
292
-
293
- /**
294
- * Whether email is verified
295
- */
296
- verified?: boolean;
297
- }
206
+ /**
207
+ * Number of comments created
208
+ */
209
+ commentsCreated?: number;
298
210
 
299
211
  /**
300
- * Pagination metadata for page-based requests
212
+ * Companies the user belongs to
301
213
  */
302
- export interface Pagination {
303
- /**
304
- * Items per page
305
- */
306
- limit: number;
214
+ companies?: Array<CompaniesAPI.Company>;
307
215
 
308
- /**
309
- * Current page number
310
- */
311
- page: number;
216
+ /**
217
+ * Custom field values on the user
218
+ */
219
+ customFields?: { [key: string]: unknown };
312
220
 
313
- /**
314
- * Total number of items
315
- */
316
- total: number;
221
+ /**
222
+ * User description/bio
223
+ */
224
+ description?: string;
317
225
 
318
- /**
319
- * Total number of pages
320
- */
321
- totalPages: number;
322
- }
226
+ /**
227
+ * User email
228
+ */
229
+ email?: string | null;
230
+
231
+ /**
232
+ * Last activity ISO timestamp
233
+ */
234
+ lastActivity?: string;
235
+
236
+ /**
237
+ * User locale
238
+ */
239
+ locale?: string;
240
+
241
+ /**
242
+ * Whether manually opted out from changelog
243
+ */
244
+ manuallyOptedOutFromChangelog?: boolean;
245
+
246
+ /**
247
+ * Organization ID the user belongs to
248
+ */
249
+ organizationId?: string;
250
+
251
+ /**
252
+ * Number of posts created
253
+ */
254
+ postsCreated?: number;
255
+
256
+ /**
257
+ * Profile picture URL
258
+ */
259
+ profilePicture?: string | null;
260
+
261
+ /**
262
+ * User roles
263
+ */
264
+ roles?: Array<string>;
265
+
266
+ /**
267
+ * Whether subscribed to changelog
268
+ */
269
+ subscribedToChangelog?: boolean;
270
+
271
+ /**
272
+ * External user ID from SSO
273
+ */
274
+ userId?: string;
275
+
276
+ /**
277
+ * Whether email is verified
278
+ */
279
+ verified?: boolean;
323
280
  }
324
281
 
325
282
  export interface VoterAddResponse {
@@ -366,18 +323,7 @@ export interface VoterRemoveResponse {
366
323
  removed: true;
367
324
  }
368
325
 
369
- export interface VoterListParams {
370
- /**
371
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
372
- * previous response to fetch the next page of results.
373
- */
374
- cursor?: string;
375
-
376
- /**
377
- * Query param: A limit on the number of voters to be returned, between 1 and 100.
378
- */
379
- limit?: number;
380
-
326
+ export interface VoterListParams extends CursorPageParams {
381
327
  /**
382
328
  * Header param: API version for this request. Defaults to your organization's
383
329
  * configured API version if not specified.
@@ -446,6 +392,7 @@ export declare namespace Voters {
446
392
  type VoterListResponse as VoterListResponse,
447
393
  type VoterAddResponse as VoterAddResponse,
448
394
  type VoterRemoveResponse as VoterRemoveResponse,
395
+ type VoterListResponsesCursorPage as VoterListResponsesCursorPage,
449
396
  type VoterListParams as VoterListParams,
450
397
  type VoterAddParams as VoterAddParams,
451
398
  type VoterRemoveParams as VoterRemoveParams,
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as ArticlesAPI from './articles';
5
5
  import { APIPromise } from '../../core/api-promise';
6
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination';
6
7
  import { buildHeaders } from '../../internal/headers';
7
8
  import { RequestOptions } from '../../internal/request-options';
8
9
  import { path } from '../../internal/utils/path';
@@ -250,15 +251,18 @@ export class Articles extends APIResource {
250
251
  *
251
252
  * @example
252
253
  * ```ts
253
- * const articles = await client.helpCenter.articles.list();
254
+ * // Automatically fetches more pages as needed.
255
+ * for await (const article of client.helpCenter.articles.list()) {
256
+ * // ...
257
+ * }
254
258
  * ```
255
259
  */
256
260
  list(
257
261
  params: ArticleListParams | null | undefined = {},
258
262
  options?: RequestOptions,
259
- ): APIPromise<ArticleListResponse> {
263
+ ): PagePromise<ArticlesCursorPage, Article> {
260
264
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
261
- return this._client.get('/v2/help_center/articles', {
265
+ return this._client.getAPIList('/v2/help_center/articles', CursorPage<Article>, {
262
266
  query,
263
267
  ...options,
264
268
  headers: buildHeaders([
@@ -310,6 +314,8 @@ export class Articles extends APIResource {
310
314
  }
311
315
  }
312
316
 
317
+ export type ArticlesCursorPage = CursorPage<Article>;
318
+
313
319
  export interface Article {
314
320
  /**
315
321
  * Article unique identifier
@@ -837,23 +843,6 @@ export interface ArticleTranslationInputNova {
837
843
  title?: string;
838
844
  }
839
845
 
840
- export interface ArticleListResponse {
841
- /**
842
- * Array of article objects
843
- */
844
- data: Array<Article>;
845
-
846
- /**
847
- * Cursor for fetching the next page (cursor-based pagination)
848
- */
849
- nextCursor: string | null;
850
-
851
- /**
852
- * Object type identifier
853
- */
854
- object: 'list';
855
- }
856
-
857
846
  export interface ArticleDeleteResponse {
858
847
  /**
859
848
  * Unique identifier of the deleted article
@@ -1169,24 +1158,13 @@ export namespace ArticleUpdateParams {
1169
1158
  }
1170
1159
  }
1171
1160
 
1172
- export interface ArticleListParams {
1173
- /**
1174
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
1175
- * previous response to fetch the next page of results.
1176
- */
1177
- cursor?: string;
1178
-
1161
+ export interface ArticleListParams extends CursorPageParams {
1179
1162
  /**
1180
1163
  * Query param: Filter articles by help center ID. If omitted, returns articles
1181
1164
  * across all help centers.
1182
1165
  */
1183
1166
  helpCenterId?: string;
1184
1167
 
1185
- /**
1186
- * Query param: A limit on the number of objects to be returned, between 1 and 100.
1187
- */
1188
- limit?: number;
1189
-
1190
1168
  /**
1191
1169
  * Query param: Filter articles by parent collection ID
1192
1170
  */
@@ -1220,8 +1198,8 @@ export declare namespace Articles {
1220
1198
  type ArticleIconInputNova as ArticleIconInputNova,
1221
1199
  type ArticleTranslation as ArticleTranslation,
1222
1200
  type ArticleTranslationInputNova as ArticleTranslationInputNova,
1223
- type ArticleListResponse as ArticleListResponse,
1224
1201
  type ArticleDeleteResponse as ArticleDeleteResponse,
1202
+ type ArticlesCursorPage as ArticlesCursorPage,
1225
1203
  type ArticleCreateParams as ArticleCreateParams,
1226
1204
  type ArticleRetrieveParams as ArticleRetrieveParams,
1227
1205
  type ArticleUpdateParams as ArticleUpdateParams,
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as CollectionsAPI from './collections';
5
5
  import { APIPromise } from '../../core/api-promise';
6
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../core/pagination';
6
7
  import { buildHeaders } from '../../internal/headers';
7
8
  import { RequestOptions } from '../../internal/request-options';
8
9
  import { path } from '../../internal/utils/path';
@@ -232,16 +233,18 @@ export class Collections extends APIResource {
232
233
  *
233
234
  * @example
234
235
  * ```ts
235
- * const collections =
236
- * await client.helpCenter.collections.list();
236
+ * // Automatically fetches more pages as needed.
237
+ * for await (const collection of client.helpCenter.collections.list()) {
238
+ * // ...
239
+ * }
237
240
  * ```
238
241
  */
239
242
  list(
240
243
  params: CollectionListParams | null | undefined = {},
241
244
  options?: RequestOptions,
242
- ): APIPromise<CollectionListResponse> {
245
+ ): PagePromise<CollectionsCursorPage, Collection> {
243
246
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
244
- return this._client.get('/v2/help_center/collections', {
247
+ return this._client.getAPIList('/v2/help_center/collections', CursorPage<Collection>, {
245
248
  query,
246
249
  ...options,
247
250
  headers: buildHeaders([
@@ -292,6 +295,8 @@ export class Collections extends APIResource {
292
295
  }
293
296
  }
294
297
 
298
+ export type CollectionsCursorPage = CursorPage<Collection>;
299
+
295
300
  export interface Collection {
296
301
  /**
297
302
  * Collection unique identifier
@@ -725,23 +730,6 @@ export interface CollectionTranslationInputNova {
725
730
  name?: string;
726
731
  }
727
732
 
728
- export interface CollectionListResponse {
729
- /**
730
- * Array of collections
731
- */
732
- data: Array<Collection>;
733
-
734
- /**
735
- * Cursor for fetching the next page (cursor-based pagination)
736
- */
737
- nextCursor: string | null;
738
-
739
- /**
740
- * Object type identifier
741
- */
742
- object: 'list';
743
- }
744
-
745
733
  export interface CollectionDeleteResponse {
746
734
  /**
747
735
  * Unique identifier of the deleted collection
@@ -1015,24 +1003,13 @@ export namespace CollectionUpdateParams {
1015
1003
  }
1016
1004
  }
1017
1005
 
1018
- export interface CollectionListParams {
1019
- /**
1020
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
1021
- * previous response to fetch the next page.
1022
- */
1023
- cursor?: string;
1024
-
1006
+ export interface CollectionListParams extends CursorPageParams {
1025
1007
  /**
1026
1008
  * Query param: Filter collections by help center ID. If omitted, returns
1027
1009
  * collections across all help centers.
1028
1010
  */
1029
1011
  helpCenterId?: string;
1030
1012
 
1031
- /**
1032
- * Query param: A limit on the number of objects to be returned, between 1 and 100.
1033
- */
1034
- limit?: number;
1035
-
1036
1013
  /**
1037
1014
  * Header param: API version for this request. Defaults to your organization's
1038
1015
  * configured API version if not specified.
@@ -1054,8 +1031,8 @@ export declare namespace Collections {
1054
1031
  type CollectionIconNova as CollectionIconNova,
1055
1032
  type CollectionTranslation as CollectionTranslation,
1056
1033
  type CollectionTranslationInputNova as CollectionTranslationInputNova,
1057
- type CollectionListResponse as CollectionListResponse,
1058
1034
  type CollectionDeleteResponse as CollectionDeleteResponse,
1035
+ type CollectionsCursorPage as CollectionsCursorPage,
1059
1036
  type CollectionCreateParams as CollectionCreateParams,
1060
1037
  type CollectionRetrieveParams as CollectionRetrieveParams,
1061
1038
  type CollectionUpdateParams as CollectionUpdateParams,