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
@@ -10,6 +10,7 @@ import { CustomFieldListParams, CustomFieldRetrieveParams, CustomFields } from '
10
10
  import * as StatusesAPI from './statuses';
11
11
  import { StatusListParams, StatusListResponse, StatusRetrieveParams, Statuses } from './statuses';
12
12
  import { APIPromise } from '../../../core/api-promise';
13
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
13
14
  import { buildHeaders } from '../../../internal/headers';
14
15
  import { RequestOptions } from '../../../internal/request-options';
15
16
  import { path } from '../../../internal/utils/path';
@@ -210,15 +211,18 @@ export class Tickets extends APIResource {
210
211
  *
211
212
  * @example
212
213
  * ```ts
213
- * const tickets = await client.support.tickets.list();
214
+ * // Automatically fetches more pages as needed.
215
+ * for await (const ticket of client.support.tickets.list()) {
216
+ * // ...
217
+ * }
214
218
  * ```
215
219
  */
216
220
  list(
217
221
  params: TicketListParams | null | undefined = {},
218
222
  options?: RequestOptions,
219
- ): APIPromise<TicketListResponse> {
223
+ ): PagePromise<TicketsCursorPage, Ticket> {
220
224
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
221
- return this._client.get('/v2/tickets', {
225
+ return this._client.getAPIList('/v2/tickets', CursorPage<Ticket>, {
222
226
  query,
223
227
  ...options,
224
228
  headers: buildHeaders([
@@ -337,6 +341,8 @@ export class Tickets extends APIResource {
337
341
  }
338
342
  }
339
343
 
344
+ export type TicketsCursorPage = CursorPage<Ticket>;
345
+
340
346
  /**
341
347
  * Author to attribute the post to. If not provided, uses the authenticated user.
342
348
  * Supports multiple identification methods: id (Featurebase ID), userId (external
@@ -663,23 +669,6 @@ export namespace Ticket {
663
669
  }
664
670
  }
665
671
 
666
- export interface TicketListResponse {
667
- /**
668
- * Array of tickets
669
- */
670
- data: Array<Ticket>;
671
-
672
- /**
673
- * Cursor for fetching the next page
674
- */
675
- nextCursor: string | null;
676
-
677
- /**
678
- * Object type identifier
679
- */
680
- object: 'list';
681
- }
682
-
683
672
  export interface TicketDeleteResponse {
684
673
  /**
685
674
  * Unique identifier of the deleted ticket
@@ -823,7 +812,7 @@ export interface TicketUpdateParams {
823
812
  'Featurebase-Version'?: string;
824
813
  }
825
814
 
826
- export interface TicketListParams {
815
+ export interface TicketListParams extends CursorPageParams {
827
816
  /**
828
817
  * Query param
829
818
  */
@@ -834,17 +823,6 @@ export interface TicketListParams {
834
823
  */
835
824
  categoryType?: 'customer' | 'tracker' | 'back-office';
836
825
 
837
- /**
838
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
839
- * previous response to fetch the next page of results.
840
- */
841
- cursor?: string;
842
-
843
- /**
844
- * Query param
845
- */
846
- limit?: number;
847
-
848
826
  /**
849
827
  * Query param
850
828
  */
@@ -988,8 +966,8 @@ export declare namespace Tickets {
988
966
  export {
989
967
  type AuthorInput as AuthorInput,
990
968
  type Ticket as Ticket,
991
- type TicketListResponse as TicketListResponse,
992
969
  type TicketDeleteResponse as TicketDeleteResponse,
970
+ type TicketsCursorPage as TicketsCursorPage,
993
971
  type TicketCreateParams as TicketCreateParams,
994
972
  type TicketRetrieveParams as TicketRetrieveParams,
995
973
  type TicketUpdateParams as TicketUpdateParams,
@@ -4,6 +4,7 @@ import { APIResource } from '../core/resource';
4
4
  import * as SurveysAPI from './surveys';
5
5
  import * as ContactsAPI from './users/contacts/contacts';
6
6
  import { APIPromise } from '../core/api-promise';
7
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
7
8
  import { buildHeaders } from '../internal/headers';
8
9
  import { RequestOptions } from '../internal/request-options';
9
10
  import { path } from '../internal/utils/path';
@@ -95,9 +96,9 @@ export class Surveys extends APIResource {
95
96
  list(
96
97
  params: SurveyListParams | null | undefined = {},
97
98
  options?: RequestOptions,
98
- ): APIPromise<SurveyListResponse> {
99
+ ): PagePromise<SurveysCursorPage, Survey> {
99
100
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
100
- return this._client.get('/v2/surveys', {
101
+ return this._client.getAPIList('/v2/surveys', CursorPage<Survey>, {
101
102
  query,
102
103
  ...options,
103
104
  headers: buildHeaders([
@@ -145,23 +146,31 @@ export class Surveys extends APIResource {
145
146
  *
146
147
  * - `404` - Survey not found in your organization
147
148
  */
148
- retrieveResponses(
149
+ listResponses(
149
150
  id: string,
150
- params: SurveyRetrieveResponsesParams | null | undefined = {},
151
+ params: SurveyListResponsesParams | null | undefined = {},
151
152
  options?: RequestOptions,
152
- ): APIPromise<SurveyRetrieveResponsesResponse> {
153
+ ): PagePromise<SurveyListResponsesResponsesCursorPage, SurveyListResponsesResponse> {
153
154
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
154
- return this._client.get(path`/v2/surveys/${id}/responses`, {
155
- query,
156
- ...options,
157
- headers: buildHeaders([
158
- { ...(featurebaseVersion != null ? { 'Featurebase-Version': featurebaseVersion } : undefined) },
159
- options?.headers,
160
- ]),
161
- });
155
+ return this._client.getAPIList(
156
+ path`/v2/surveys/${id}/responses`,
157
+ CursorPage<SurveyListResponsesResponse>,
158
+ {
159
+ query,
160
+ ...options,
161
+ headers: buildHeaders([
162
+ { ...(featurebaseVersion != null ? { 'Featurebase-Version': featurebaseVersion } : undefined) },
163
+ options?.headers,
164
+ ]),
165
+ },
166
+ );
162
167
  }
163
168
  }
164
169
 
170
+ export type SurveysCursorPage = CursorPage<Survey>;
171
+
172
+ export type SurveyListResponsesResponsesCursorPage = CursorPage<SurveyListResponsesResponse>;
173
+
165
174
  export interface Survey {
166
175
  /**
167
176
  * Unique identifier
@@ -405,100 +414,64 @@ export interface SurveyNextAction {
405
414
  pageId?: string;
406
415
  }
407
416
 
408
- export interface SurveyListResponse {
417
+ export interface SurveyListResponsesResponse {
409
418
  /**
410
- * Array of surveys
419
+ * Unique identifier
411
420
  */
412
- data: Array<Survey>;
421
+ id: string;
413
422
 
414
423
  /**
415
- * Cursor for fetching the next page (cursor-based pagination)
424
+ * ISO 8601 timestamp when created
416
425
  */
417
- nextCursor: string | null;
426
+ createdAt: string;
418
427
 
419
428
  /**
420
429
  * Object type identifier
421
430
  */
422
- object: 'list';
423
- }
424
-
425
- export interface SurveyRetrieveResponsesResponse {
426
- /**
427
- * Array of survey responses
428
- */
429
- data: Array<SurveyRetrieveResponsesResponse.Data>;
431
+ object: 'survey_response';
430
432
 
431
433
  /**
432
- * Cursor for fetching the next page (cursor-based pagination)
434
+ * Individual responses to questions
433
435
  */
434
- nextCursor: string | null;
436
+ responses: Array<SurveyListResponsesResponse.Response>;
435
437
 
436
438
  /**
437
- * Object type identifier
439
+ * User who submitted the response
438
440
  */
439
- object: 'list';
441
+ user: ContactsAPI.Contact | null;
440
442
  }
441
443
 
442
- export namespace SurveyRetrieveResponsesResponse {
443
- export interface Data {
444
+ export namespace SurveyListResponsesResponse {
445
+ export interface Response {
444
446
  /**
445
- * Unique identifier
447
+ * Page ID this response is for
446
448
  */
447
- id: string;
449
+ pageId: string;
448
450
 
449
451
  /**
450
- * ISO 8601 timestamp when created
452
+ * Response type
451
453
  */
452
- createdAt: string;
454
+ type: 'text' | 'link' | 'rating' | 'multiple-choice';
453
455
 
454
456
  /**
455
- * Object type identifier
457
+ * Response value
456
458
  */
457
- object: 'survey_response';
459
+ value: string | number | boolean | Array<string>;
458
460
 
459
461
  /**
460
- * Individual responses to questions
462
+ * Response ID
461
463
  */
462
- responses: Array<Data.Response>;
464
+ id?: string;
463
465
 
464
466
  /**
465
- * User who submitted the response
467
+ * ISO 8601 timestamp when created
466
468
  */
467
- user: ContactsAPI.Contact | null;
468
- }
469
-
470
- export namespace Data {
471
- export interface Response {
472
- /**
473
- * Page ID this response is for
474
- */
475
- pageId: string;
476
-
477
- /**
478
- * Response type
479
- */
480
- type: 'text' | 'link' | 'rating' | 'multiple-choice';
481
-
482
- /**
483
- * Response value
484
- */
485
- value: string | number | boolean | Array<string>;
486
-
487
- /**
488
- * Response ID
489
- */
490
- id?: string;
491
-
492
- /**
493
- * ISO 8601 timestamp when created
494
- */
495
- createdAt?: string;
469
+ createdAt?: string;
496
470
 
497
- /**
498
- * ISO 8601 timestamp when updated
499
- */
500
- updatedAt?: string;
501
- }
471
+ /**
472
+ * ISO 8601 timestamp when updated
473
+ */
474
+ updatedAt?: string;
502
475
  }
503
476
  }
504
477
 
@@ -510,23 +483,12 @@ export interface SurveyRetrieveParams {
510
483
  'Featurebase-Version'?: string;
511
484
  }
512
485
 
513
- export interface SurveyListParams {
514
- /**
515
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
516
- * previous response to fetch the next page.
517
- */
518
- cursor?: string;
519
-
486
+ export interface SurveyListParams extends CursorPageParams {
520
487
  /**
521
488
  * Query param: Filter by active status
522
489
  */
523
490
  isActive?: boolean | null;
524
491
 
525
- /**
526
- * Query param: A limit on the number of objects to be returned, between 1 and 100.
527
- */
528
- limit?: number;
529
-
530
492
  /**
531
493
  * Query param: Filter by survey page type
532
494
  */
@@ -539,18 +501,7 @@ export interface SurveyListParams {
539
501
  'Featurebase-Version'?: string;
540
502
  }
541
503
 
542
- export interface SurveyRetrieveResponsesParams {
543
- /**
544
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
545
- * previous response to fetch the next page.
546
- */
547
- cursor?: string;
548
-
549
- /**
550
- * Query param: A limit on the number of objects to be returned, between 1 and 100.
551
- */
552
- limit?: number;
553
-
504
+ export interface SurveyListResponsesParams extends CursorPageParams {
554
505
  /**
555
506
  * Query param: Filter by survey page ID
556
507
  */
@@ -567,10 +518,11 @@ export declare namespace Surveys {
567
518
  export {
568
519
  type Survey as Survey,
569
520
  type SurveyNextAction as SurveyNextAction,
570
- type SurveyListResponse as SurveyListResponse,
571
- type SurveyRetrieveResponsesResponse as SurveyRetrieveResponsesResponse,
521
+ type SurveyListResponsesResponse as SurveyListResponsesResponse,
522
+ type SurveysCursorPage as SurveysCursorPage,
523
+ type SurveyListResponsesResponsesCursorPage as SurveyListResponsesResponsesCursorPage,
572
524
  type SurveyRetrieveParams as SurveyRetrieveParams,
573
525
  type SurveyListParams as SurveyListParams,
574
- type SurveyRetrieveResponsesParams as SurveyRetrieveResponsesParams,
526
+ type SurveyListResponsesParams as SurveyListResponsesParams,
575
527
  };
576
528
  }
@@ -11,6 +11,7 @@ import {
11
11
  Contacts,
12
12
  } from './contacts';
13
13
  import { APIPromise } from '../../../core/api-promise';
14
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
14
15
  import { buildHeaders } from '../../../internal/headers';
15
16
  import { RequestOptions } from '../../../internal/request-options';
16
17
  import { path } from '../../../internal/utils/path';
@@ -164,15 +165,18 @@ export class Companies extends APIResource {
164
165
  *
165
166
  * @example
166
167
  * ```ts
167
- * const companies = await client.users.companies.list();
168
+ * // Automatically fetches more pages as needed.
169
+ * for await (const company of client.users.companies.list()) {
170
+ * // ...
171
+ * }
168
172
  * ```
169
173
  */
170
174
  list(
171
175
  params: CompanyListParams | null | undefined = {},
172
176
  options?: RequestOptions,
173
- ): APIPromise<CompanyListResponse> {
177
+ ): PagePromise<CompaniesCursorPage, Company> {
174
178
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
175
- return this._client.get('/v2/companies', {
179
+ return this._client.getAPIList('/v2/companies', CursorPage<Company>, {
176
180
  query,
177
181
  ...options,
178
182
  headers: buildHeaders([
@@ -389,6 +393,8 @@ export class Companies extends APIResource {
389
393
  }
390
394
  }
391
395
 
396
+ export type CompaniesCursorPage = CursorPage<Company>;
397
+
392
398
  export interface Company {
393
399
  /**
394
400
  * Featurebase internal ID
@@ -478,23 +484,6 @@ export interface DeletedCompany {
478
484
  object: 'company';
479
485
  }
480
486
 
481
- export interface CompanyListResponse {
482
- /**
483
- * Array of companies
484
- */
485
- data: Array<Company>;
486
-
487
- /**
488
- * Cursor for fetching the next page (cursor-based pagination)
489
- */
490
- nextCursor: string | null;
491
-
492
- /**
493
- * Object type identifier
494
- */
495
- object: 'list';
496
- }
497
-
498
487
  export interface CompanyRetrieveParams {
499
488
  /**
500
489
  * API version for this request. Defaults to your organization's configured API
@@ -503,19 +492,7 @@ export interface CompanyRetrieveParams {
503
492
  'Featurebase-Version'?: string;
504
493
  }
505
494
 
506
- export interface CompanyListParams {
507
- /**
508
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
509
- * previous response to fetch the next page of results.
510
- */
511
- cursor?: string;
512
-
513
- /**
514
- * Query param: A limit on the number of companies to be returned, between 1
515
- * and 100.
516
- */
517
- limit?: number;
518
-
495
+ export interface CompanyListParams extends CursorPageParams {
519
496
  /**
520
497
  * Header param: API version for this request. Defaults to your organization's
521
498
  * configured API version if not specified.
@@ -614,7 +591,7 @@ export declare namespace Companies {
614
591
  export {
615
592
  type Company as Company,
616
593
  type DeletedCompany as DeletedCompany,
617
- type CompanyListResponse as CompanyListResponse,
594
+ type CompaniesCursorPage as CompaniesCursorPage,
618
595
  type CompanyRetrieveParams as CompanyRetrieveParams,
619
596
  type CompanyListParams as CompanyListParams,
620
597
  type CompanyDeleteParams as CompanyDeleteParams,
@@ -2,7 +2,9 @@
2
2
 
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as UsersContactsAPI from '../contacts/contacts';
5
+ import { ContactListDataCursorPage } from '../contacts/contacts';
5
6
  import { APIPromise } from '../../../core/api-promise';
7
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
6
8
  import { buildHeaders } from '../../../internal/headers';
7
9
  import { RequestOptions } from '../../../internal/request-options';
8
10
  import { path } from '../../../internal/utils/path';
@@ -65,26 +67,32 @@ export class Contacts extends APIResource {
65
67
  *
66
68
  * @example
67
69
  * ```ts
68
- * const contactList =
69
- * await client.users.companies.contacts.list(
70
- * '507f1f77bcf86cd799439011',
71
- * );
70
+ * // Automatically fetches more pages as needed.
71
+ * for await (const contact of client.users.companies.contacts.list(
72
+ * '507f1f77bcf86cd799439011',
73
+ * )) {
74
+ * // ...
75
+ * }
72
76
  * ```
73
77
  */
74
78
  list(
75
79
  id: string,
76
80
  params: ContactListParams | null | undefined = {},
77
81
  options?: RequestOptions,
78
- ): APIPromise<UsersContactsAPI.ContactList> {
82
+ ): PagePromise<ContactListDataCursorPage, UsersContactsAPI.ContactList.Data> {
79
83
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
80
- return this._client.get(path`/v2/companies/${id}/contacts`, {
81
- query,
82
- ...options,
83
- headers: buildHeaders([
84
- { ...(featurebaseVersion != null ? { 'Featurebase-Version': featurebaseVersion } : undefined) },
85
- options?.headers,
86
- ]),
87
- });
84
+ return this._client.getAPIList(
85
+ path`/v2/companies/${id}/contacts`,
86
+ CursorPage<UsersContactsAPI.ContactList.Data>,
87
+ {
88
+ query,
89
+ ...options,
90
+ headers: buildHeaders([
91
+ { ...(featurebaseVersion != null ? { 'Featurebase-Version': featurebaseVersion } : undefined) },
92
+ options?.headers,
93
+ ]),
94
+ },
95
+ );
88
96
  }
89
97
 
90
98
  /**
@@ -244,19 +252,7 @@ export type ContactAttachResponse = UsersContactsAPI.Contact | (null & {});
244
252
  */
245
253
  export type ContactRemoveResponse = UsersContactsAPI.Contact | (null & {});
246
254
 
247
- export interface ContactListParams {
248
- /**
249
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
250
- * previous response to fetch the next page of results.
251
- */
252
- cursor?: string;
253
-
254
- /**
255
- * Query param: A limit on the number of contacts to be returned, between 1
256
- * and 100.
257
- */
258
- limit?: number;
259
-
255
+ export interface ContactListParams extends CursorPageParams {
260
256
  /**
261
257
  * Header param: API version for this request. Defaults to your organization's
262
258
  * configured API version if not specified.
@@ -300,3 +296,5 @@ export declare namespace Contacts {
300
296
  type ContactRemoveParams as ContactRemoveParams,
301
297
  };
302
298
  }
299
+
300
+ export { type ContactListDataCursorPage };
@@ -4,12 +4,12 @@ export {
4
4
  Companies,
5
5
  type Company,
6
6
  type DeletedCompany,
7
- type CompanyListResponse,
8
7
  type CompanyRetrieveParams,
9
8
  type CompanyListParams,
10
9
  type CompanyDeleteParams,
11
10
  type CompanyCreateOrUpdateParams,
12
11
  type CompanyDeleteByCompanyIDParams,
12
+ type CompaniesCursorPage,
13
13
  } from './companies';
14
14
  export {
15
15
  Contacts,
@@ -20,6 +20,7 @@ import {
20
20
  ByUserIDRetrieveResponse,
21
21
  } from './by-user-id/by-user-id';
22
22
  import { APIPromise } from '../../../core/api-promise';
23
+ import { CursorPage, type CursorPageParams, PagePromise } from '../../../core/pagination';
23
24
  import { buildHeaders } from '../../../internal/headers';
24
25
  import { RequestOptions } from '../../../internal/request-options';
25
26
  import { path } from '../../../internal/utils/path';
@@ -157,12 +158,18 @@ export class Contacts extends APIResource {
157
158
  *
158
159
  * @example
159
160
  * ```ts
160
- * const contactList = await client.users.contacts.list();
161
+ * // Automatically fetches more pages as needed.
162
+ * for await (const contact of client.users.contacts.list()) {
163
+ * // ...
164
+ * }
161
165
  * ```
162
166
  */
163
- list(params: ContactListParams | null | undefined = {}, options?: RequestOptions): APIPromise<ContactList> {
167
+ list(
168
+ params: ContactListParams | null | undefined = {},
169
+ options?: RequestOptions,
170
+ ): PagePromise<ContactListDataCursorPage, ContactList.Data> {
164
171
  const { 'Featurebase-Version': featurebaseVersion, ...query } = params ?? {};
165
- return this._client.get('/v2/contacts', {
172
+ return this._client.getAPIList('/v2/contacts', CursorPage<ContactList.Data>, {
166
173
  query,
167
174
  ...options,
168
175
  headers: buildHeaders([
@@ -478,6 +485,8 @@ export class Contacts extends APIResource {
478
485
  }
479
486
  }
480
487
 
488
+ export type ContactListDataCursorPage = CursorPage<ContactList.Data>;
489
+
481
490
  /**
482
491
  * User who submitted the response
483
492
  */
@@ -671,23 +680,12 @@ export interface ContactRetrieveParams {
671
680
  'Featurebase-Version'?: string;
672
681
  }
673
682
 
674
- export interface ContactListParams {
683
+ export interface ContactListParams extends CursorPageParams {
675
684
  /**
676
685
  * Query param: Filter contacts by type. Defaults to "customer".
677
686
  */
678
687
  contactType?: 'customer' | 'lead' | 'all';
679
688
 
680
- /**
681
- * Query param: An opaque cursor for pagination. Use the nextCursor value from a
682
- * previous response to fetch the next page of results.
683
- */
684
- cursor?: string;
685
-
686
- /**
687
- * Query param: A limit on the number of objects to be returned, between 1 and 100.
688
- */
689
- limit?: number;
690
-
691
689
  /**
692
690
  * Header param: API version for this request. Defaults to your organization's
693
691
  * configured API version if not specified.
@@ -883,6 +881,7 @@ export declare namespace Contacts {
883
881
  type ContactBlockResponse as ContactBlockResponse,
884
882
  type ContactCreateOrUpdateResponse as ContactCreateOrUpdateResponse,
885
883
  type ContactUnblockResponse as ContactUnblockResponse,
884
+ type ContactListDataCursorPage as ContactListDataCursorPage,
886
885
  type ContactRetrieveParams as ContactRetrieveParams,
887
886
  type ContactListParams as ContactListParams,
888
887
  type ContactDeleteParams as ContactDeleteParams,
@@ -21,6 +21,7 @@ export {
21
21
  type ContactBlockParams,
22
22
  type ContactCreateOrUpdateParams,
23
23
  type ContactUnblockParams,
24
+ type ContactListDataCursorPage,
24
25
  } from './contacts';
25
26
  export {
26
27
  EmailPreferences,
@@ -4,12 +4,12 @@ export {
4
4
  Companies,
5
5
  type Company,
6
6
  type DeletedCompany,
7
- type CompanyListResponse,
8
7
  type CompanyRetrieveParams,
9
8
  type CompanyListParams,
10
9
  type CompanyDeleteParams,
11
10
  type CompanyCreateOrUpdateParams,
12
11
  type CompanyDeleteByCompanyIDParams,
12
+ type CompaniesCursorPage,
13
13
  } from './companies/index';
14
14
  export {
15
15
  Contacts,
@@ -26,5 +26,6 @@ export {
26
26
  type ContactBlockParams,
27
27
  type ContactCreateOrUpdateParams,
28
28
  type ContactUnblockParams,
29
+ type ContactListDataCursorPage,
29
30
  } from './contacts/index';
30
31
  export { Users } from './users';
@@ -4,12 +4,12 @@ import { APIResource } from '../../core/resource';
4
4
  import * as CompaniesAPI from './companies/companies';
5
5
  import {
6
6
  Companies,
7
+ CompaniesCursorPage,
7
8
  Company,
8
9
  CompanyCreateOrUpdateParams,
9
10
  CompanyDeleteByCompanyIDParams,
10
11
  CompanyDeleteParams,
11
12
  CompanyListParams,
12
- CompanyListResponse,
13
13
  CompanyRetrieveParams,
14
14
  DeletedCompany,
15
15
  } from './companies/companies';
@@ -22,6 +22,7 @@ import {
22
22
  ContactCreateOrUpdateResponse,
23
23
  ContactDeleteParams,
24
24
  ContactList,
25
+ ContactListDataCursorPage,
25
26
  ContactListParams,
26
27
  ContactRetrieveParams,
27
28
  ContactRetrieveResponse,
@@ -49,6 +50,7 @@ export declare namespace Users {
49
50
  type ContactBlockResponse as ContactBlockResponse,
50
51
  type ContactCreateOrUpdateResponse as ContactCreateOrUpdateResponse,
51
52
  type ContactUnblockResponse as ContactUnblockResponse,
53
+ type ContactListDataCursorPage as ContactListDataCursorPage,
52
54
  type ContactRetrieveParams as ContactRetrieveParams,
53
55
  type ContactListParams as ContactListParams,
54
56
  type ContactDeleteParams as ContactDeleteParams,
@@ -61,7 +63,7 @@ export declare namespace Users {
61
63
  Companies as Companies,
62
64
  type Company as Company,
63
65
  type DeletedCompany as DeletedCompany,
64
- type CompanyListResponse as CompanyListResponse,
66
+ type CompaniesCursorPage as CompaniesCursorPage,
65
67
  type CompanyRetrieveParams as CompanyRetrieveParams,
66
68
  type CompanyListParams as CompanyListParams,
67
69
  type CompanyDeleteParams as CompanyDeleteParams,