@tryfinch/finch-api 1.0.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 (266) hide show
  1. package/.eslintrc.js +10 -0
  2. package/.github/workflows/publish-npm.yml +28 -0
  3. package/.github/workflows/release-doctor.yml +20 -0
  4. package/.github/workflows/release.yml +38 -0
  5. package/.prettierrc +6 -0
  6. package/.release-please-manifest.json +3 -0
  7. package/.stats.yml +1 -0
  8. package/CHANGELOG.md +7 -0
  9. package/LICENSE +201 -0
  10. package/README.md +220 -0
  11. package/api.md +186 -0
  12. package/bin/check-release-environment +25 -0
  13. package/bin/check-test-server +50 -0
  14. package/bin/publish-npm +6 -0
  15. package/build +12 -0
  16. package/check-version.ts +18 -0
  17. package/core.ts +926 -0
  18. package/dist/cjs/check-version.d.ts +2 -0
  19. package/dist/cjs/check-version.d.ts.map +1 -0
  20. package/dist/cjs/check-version.js +23 -0
  21. package/dist/cjs/check-version.js.map +1 -0
  22. package/dist/cjs/core.d.ts +268 -0
  23. package/dist/cjs/core.d.ts.map +1 -0
  24. package/dist/cjs/core.js +994 -0
  25. package/dist/cjs/core.js.map +1 -0
  26. package/dist/cjs/fetch-polyfill.d.ts +6 -0
  27. package/dist/cjs/fetch-polyfill.d.ts.map +1 -0
  28. package/dist/cjs/fetch-polyfill.js +57 -0
  29. package/dist/cjs/fetch-polyfill.js.map +1 -0
  30. package/dist/cjs/index.d.ts +115 -0
  31. package/dist/cjs/index.d.ts.map +1 -0
  32. package/dist/cjs/index.js +198 -0
  33. package/dist/cjs/index.js.map +1 -0
  34. package/dist/cjs/pagination.d.ts +166 -0
  35. package/dist/cjs/pagination.d.ts.map +1 -0
  36. package/dist/cjs/pagination.js +215 -0
  37. package/dist/cjs/pagination.js.map +1 -0
  38. package/dist/cjs/resource.d.ts +12 -0
  39. package/dist/cjs/resource.d.ts.map +1 -0
  40. package/dist/cjs/resource.js +17 -0
  41. package/dist/cjs/resource.js.map +1 -0
  42. package/dist/cjs/resources/account.d.ts +49 -0
  43. package/dist/cjs/resources/account.d.ts.map +1 -0
  44. package/dist/cjs/resources/account.js +23 -0
  45. package/dist/cjs/resources/account.js.map +1 -0
  46. package/dist/cjs/resources/ats/applications.d.ts +31 -0
  47. package/dist/cjs/resources/ats/applications.d.ts.map +1 -0
  48. package/dist/cjs/resources/ats/applications.js +27 -0
  49. package/dist/cjs/resources/ats/applications.js.map +1 -0
  50. package/dist/cjs/resources/ats/ats.d.ts +14 -0
  51. package/dist/cjs/resources/ats/ats.d.ts.map +1 -0
  52. package/dist/cjs/resources/ats/ats.js +22 -0
  53. package/dist/cjs/resources/ats/ats.js.map +1 -0
  54. package/dist/cjs/resources/ats/candidates.d.ts +45 -0
  55. package/dist/cjs/resources/ats/candidates.d.ts.map +1 -0
  56. package/dist/cjs/resources/ats/candidates.js +24 -0
  57. package/dist/cjs/resources/ats/candidates.js.map +1 -0
  58. package/dist/cjs/resources/ats/index.d.ts +6 -0
  59. package/dist/cjs/resources/ats/index.d.ts.map +1 -0
  60. package/dist/cjs/resources/ats/index.js +12 -0
  61. package/dist/cjs/resources/ats/index.js.map +1 -0
  62. package/dist/cjs/resources/ats/jobs.d.ts +42 -0
  63. package/dist/cjs/resources/ats/jobs.d.ts.map +1 -0
  64. package/dist/cjs/resources/ats/jobs.js +23 -0
  65. package/dist/cjs/resources/ats/jobs.js.map +1 -0
  66. package/dist/cjs/resources/ats/offers.d.ts +34 -0
  67. package/dist/cjs/resources/ats/offers.d.ts.map +1 -0
  68. package/dist/cjs/resources/ats/offers.js +23 -0
  69. package/dist/cjs/resources/ats/offers.js.map +1 -0
  70. package/dist/cjs/resources/ats/stages.d.ts +23 -0
  71. package/dist/cjs/resources/ats/stages.d.ts.map +1 -0
  72. package/dist/cjs/resources/ats/stages.js +21 -0
  73. package/dist/cjs/resources/ats/stages.js.map +1 -0
  74. package/dist/cjs/resources/hris/benefits/benefits.d.ts +155 -0
  75. package/dist/cjs/resources/hris/benefits/benefits.d.ts.map +1 -0
  76. package/dist/cjs/resources/hris/benefits/benefits.js +57 -0
  77. package/dist/cjs/resources/hris/benefits/benefits.js.map +1 -0
  78. package/dist/cjs/resources/hris/benefits/index.d.ts +26 -0
  79. package/dist/cjs/resources/hris/benefits/index.d.ts.map +1 -0
  80. package/dist/cjs/resources/hris/benefits/index.js +42 -0
  81. package/dist/cjs/resources/hris/benefits/index.js.map +1 -0
  82. package/dist/cjs/resources/hris/benefits/individuals.d.ts +163 -0
  83. package/dist/cjs/resources/hris/benefits/individuals.d.ts.map +1 -0
  84. package/dist/cjs/resources/hris/benefits/individuals.js +68 -0
  85. package/dist/cjs/resources/hris/benefits/individuals.js.map +1 -0
  86. package/dist/cjs/resources/hris/company.d.ts +104 -0
  87. package/dist/cjs/resources/hris/company.d.ts.map +1 -0
  88. package/dist/cjs/resources/hris/company.js +15 -0
  89. package/dist/cjs/resources/hris/company.js.map +1 -0
  90. package/dist/cjs/resources/hris/directory.d.ts +65 -0
  91. package/dist/cjs/resources/hris/directory.d.ts.map +1 -0
  92. package/dist/cjs/resources/hris/directory.js +21 -0
  93. package/dist/cjs/resources/hris/directory.js.map +1 -0
  94. package/dist/cjs/resources/hris/hris.d.ts +95 -0
  95. package/dist/cjs/resources/hris/hris.d.ts.map +1 -0
  96. package/dist/cjs/resources/hris/hris.js +24 -0
  97. package/dist/cjs/resources/hris/hris.js.map +1 -0
  98. package/dist/cjs/resources/hris/index.d.ts +31 -0
  99. package/dist/cjs/resources/hris/index.d.ts.map +1 -0
  100. package/dist/cjs/resources/hris/index.js +44 -0
  101. package/dist/cjs/resources/hris/index.js.map +1 -0
  102. package/dist/cjs/resources/hris/individuals/employment-data.d.ts +151 -0
  103. package/dist/cjs/resources/hris/individuals/employment-data.d.ts.map +1 -0
  104. package/dist/cjs/resources/hris/individuals/employment-data.js +26 -0
  105. package/dist/cjs/resources/hris/individuals/employment-data.js.map +1 -0
  106. package/dist/cjs/resources/hris/individuals/index.d.ts +13 -0
  107. package/dist/cjs/resources/hris/individuals/index.d.ts.map +1 -0
  108. package/dist/cjs/resources/hris/individuals/index.js +28 -0
  109. package/dist/cjs/resources/hris/individuals/index.js.map +1 -0
  110. package/dist/cjs/resources/hris/individuals/individuals.d.ts +86 -0
  111. package/dist/cjs/resources/hris/individuals/individuals.d.ts.map +1 -0
  112. package/dist/cjs/resources/hris/individuals/individuals.js +28 -0
  113. package/dist/cjs/resources/hris/individuals/individuals.js.map +1 -0
  114. package/dist/cjs/resources/hris/pay-statements.d.ts +201 -0
  115. package/dist/cjs/resources/hris/pay-statements.d.ts.map +1 -0
  116. package/dist/cjs/resources/hris/pay-statements.js +25 -0
  117. package/dist/cjs/resources/hris/pay-statements.js.map +1 -0
  118. package/dist/cjs/resources/hris/payments.d.ts +54 -0
  119. package/dist/cjs/resources/hris/payments.d.ts.map +1 -0
  120. package/dist/cjs/resources/hris/payments.js +18 -0
  121. package/dist/cjs/resources/hris/payments.js.map +1 -0
  122. package/dist/cjs/resources/index.d.ts +5 -0
  123. package/dist/cjs/resources/index.d.ts.map +1 -0
  124. package/dist/cjs/resources/index.js +39 -0
  125. package/dist/cjs/resources/index.js.map +1 -0
  126. package/dist/cjs/resources/providers.d.ts +46 -0
  127. package/dist/cjs/resources/providers.d.ts.map +1 -0
  128. package/dist/cjs/resources/providers.js +18 -0
  129. package/dist/cjs/resources/providers.js.map +1 -0
  130. package/dist/cjs/resources/top-level.d.ts +2 -0
  131. package/dist/cjs/resources/top-level.d.ts.map +1 -0
  132. package/dist/cjs/resources/top-level.js +4 -0
  133. package/dist/cjs/resources/top-level.js.map +1 -0
  134. package/dist/cjs/tests/api-resources/account.test.d.ts +2 -0
  135. package/dist/cjs/tests/api-resources/account.test.d.ts.map +1 -0
  136. package/dist/cjs/tests/api-resources/account.test.js +66 -0
  137. package/dist/cjs/tests/api-resources/account.test.js.map +1 -0
  138. package/dist/cjs/tests/api-resources/ats/applications.test.d.ts +2 -0
  139. package/dist/cjs/tests/api-resources/ats/applications.test.d.ts.map +1 -0
  140. package/dist/cjs/tests/api-resources/ats/applications.test.js +73 -0
  141. package/dist/cjs/tests/api-resources/ats/applications.test.js.map +1 -0
  142. package/dist/cjs/tests/api-resources/ats/candidates.test.d.ts +2 -0
  143. package/dist/cjs/tests/api-resources/ats/candidates.test.d.ts.map +1 -0
  144. package/dist/cjs/tests/api-resources/ats/candidates.test.js +73 -0
  145. package/dist/cjs/tests/api-resources/ats/candidates.test.js.map +1 -0
  146. package/dist/cjs/tests/api-resources/ats/jobs.test.d.ts +2 -0
  147. package/dist/cjs/tests/api-resources/ats/jobs.test.d.ts.map +1 -0
  148. package/dist/cjs/tests/api-resources/ats/jobs.test.js +73 -0
  149. package/dist/cjs/tests/api-resources/ats/jobs.test.js.map +1 -0
  150. package/dist/cjs/tests/api-resources/ats/offers.test.d.ts +2 -0
  151. package/dist/cjs/tests/api-resources/ats/offers.test.d.ts.map +1 -0
  152. package/dist/cjs/tests/api-resources/ats/offers.test.js +73 -0
  153. package/dist/cjs/tests/api-resources/ats/offers.test.js.map +1 -0
  154. package/dist/cjs/tests/api-resources/ats/stages.test.d.ts +2 -0
  155. package/dist/cjs/tests/api-resources/ats/stages.test.d.ts.map +1 -0
  156. package/dist/cjs/tests/api-resources/ats/stages.test.js +55 -0
  157. package/dist/cjs/tests/api-resources/ats/stages.test.js.map +1 -0
  158. package/dist/cjs/tests/api-resources/hris/benefits/benefits.test.d.ts +2 -0
  159. package/dist/cjs/tests/api-resources/hris/benefits/benefits.test.d.ts.map +1 -0
  160. package/dist/cjs/tests/api-resources/hris/benefits/benefits.test.js +116 -0
  161. package/dist/cjs/tests/api-resources/hris/benefits/benefits.test.js.map +1 -0
  162. package/dist/cjs/tests/api-resources/hris/benefits/individuals.test.d.ts +2 -0
  163. package/dist/cjs/tests/api-resources/hris/benefits/individuals.test.d.ts.map +1 -0
  164. package/dist/cjs/tests/api-resources/hris/benefits/individuals.test.js +103 -0
  165. package/dist/cjs/tests/api-resources/hris/benefits/individuals.test.js.map +1 -0
  166. package/dist/cjs/tests/api-resources/hris/company.test.d.ts +2 -0
  167. package/dist/cjs/tests/api-resources/hris/company.test.d.ts.map +1 -0
  168. package/dist/cjs/tests/api-resources/hris/company.test.js +55 -0
  169. package/dist/cjs/tests/api-resources/hris/company.test.js.map +1 -0
  170. package/dist/cjs/tests/api-resources/hris/directory.test.d.ts +2 -0
  171. package/dist/cjs/tests/api-resources/hris/directory.test.d.ts.map +1 -0
  172. package/dist/cjs/tests/api-resources/hris/directory.test.js +62 -0
  173. package/dist/cjs/tests/api-resources/hris/directory.test.js.map +1 -0
  174. package/dist/cjs/tests/api-resources/hris/individuals/employment-data.test.d.ts +2 -0
  175. package/dist/cjs/tests/api-resources/hris/individuals/employment-data.test.d.ts.map +1 -0
  176. package/dist/cjs/tests/api-resources/hris/individuals/employment-data.test.js +56 -0
  177. package/dist/cjs/tests/api-resources/hris/individuals/employment-data.test.js.map +1 -0
  178. package/dist/cjs/tests/api-resources/hris/individuals/individuals.test.d.ts +2 -0
  179. package/dist/cjs/tests/api-resources/hris/individuals/individuals.test.d.ts.map +1 -0
  180. package/dist/cjs/tests/api-resources/hris/individuals/individuals.test.js +68 -0
  181. package/dist/cjs/tests/api-resources/hris/individuals/individuals.test.js.map +1 -0
  182. package/dist/cjs/tests/api-resources/hris/pay-statements.test.d.ts +2 -0
  183. package/dist/cjs/tests/api-resources/hris/pay-statements.test.d.ts.map +1 -0
  184. package/dist/cjs/tests/api-resources/hris/pay-statements.test.js +64 -0
  185. package/dist/cjs/tests/api-resources/hris/pay-statements.test.js.map +1 -0
  186. package/dist/cjs/tests/api-resources/hris/payments.test.d.ts +2 -0
  187. package/dist/cjs/tests/api-resources/hris/payments.test.d.ts.map +1 -0
  188. package/dist/cjs/tests/api-resources/hris/payments.test.js +52 -0
  189. package/dist/cjs/tests/api-resources/hris/payments.test.js.map +1 -0
  190. package/dist/cjs/tests/api-resources/providers.test.d.ts +2 -0
  191. package/dist/cjs/tests/api-resources/providers.test.d.ts.map +1 -0
  192. package/dist/cjs/tests/api-resources/providers.test.js +55 -0
  193. package/dist/cjs/tests/api-resources/providers.test.js.map +1 -0
  194. package/dist/cjs/tests/api-resources/top-level.test.d.ts +2 -0
  195. package/dist/cjs/tests/api-resources/top-level.test.d.ts.map +1 -0
  196. package/dist/cjs/tests/api-resources/top-level.test.js +52 -0
  197. package/dist/cjs/tests/api-resources/top-level.test.js.map +1 -0
  198. package/dist/cjs/tests/form.test.d.ts +2 -0
  199. package/dist/cjs/tests/form.test.d.ts.map +1 -0
  200. package/dist/cjs/tests/form.test.js +61 -0
  201. package/dist/cjs/tests/form.test.js.map +1 -0
  202. package/dist/cjs/tests/index.test.d.ts +2 -0
  203. package/dist/cjs/tests/index.test.d.ts.map +1 -0
  204. package/dist/cjs/tests/index.test.js +34 -0
  205. package/dist/cjs/tests/index.test.js.map +1 -0
  206. package/dist/cjs/tests/responses.test.d.ts +2 -0
  207. package/dist/cjs/tests/responses.test.d.ts.map +1 -0
  208. package/dist/cjs/tests/responses.test.js +60 -0
  209. package/dist/cjs/tests/responses.test.js.map +1 -0
  210. package/dist/cjs/version.d.ts +2 -0
  211. package/dist/cjs/version.d.ts.map +1 -0
  212. package/dist/cjs/version.js +5 -0
  213. package/dist/cjs/version.js.map +1 -0
  214. package/fetch-polyfill.ts +69 -0
  215. package/index.ts +212 -0
  216. package/jest.config.js +8 -0
  217. package/package.json +47 -0
  218. package/pagination.ts +401 -0
  219. package/release-please-config.json +12 -0
  220. package/resource.ts +24 -0
  221. package/resources/account.ts +63 -0
  222. package/resources/ats/applications.ts +55 -0
  223. package/resources/ats/ats.ts +16 -0
  224. package/resources/ats/candidates.ts +74 -0
  225. package/resources/ats/index.ts +7 -0
  226. package/resources/ats/jobs.ts +70 -0
  227. package/resources/ats/offers.ts +57 -0
  228. package/resources/ats/stages.ts +31 -0
  229. package/resources/hris/benefits/benefits.ts +214 -0
  230. package/resources/hris/benefits/index.ts +27 -0
  231. package/resources/hris/benefits/individuals.ts +234 -0
  232. package/resources/hris/company.ts +127 -0
  233. package/resources/hris/directory.ts +87 -0
  234. package/resources/hris/hris.ts +113 -0
  235. package/resources/hris/index.ts +32 -0
  236. package/resources/hris/individuals/employment-data.ts +188 -0
  237. package/resources/hris/individuals/index.ts +14 -0
  238. package/resources/hris/individuals/individuals.ts +128 -0
  239. package/resources/hris/pay-statements.ts +251 -0
  240. package/resources/hris/payments.ts +73 -0
  241. package/resources/index.ts +6 -0
  242. package/resources/providers.ts +59 -0
  243. package/resources/top-level.ts +3 -0
  244. package/tests/api-resources/account.test.ts +29 -0
  245. package/tests/api-resources/ats/applications.test.ts +36 -0
  246. package/tests/api-resources/ats/candidates.test.ts +36 -0
  247. package/tests/api-resources/ats/jobs.test.ts +36 -0
  248. package/tests/api-resources/ats/offers.test.ts +36 -0
  249. package/tests/api-resources/ats/stages.test.ts +18 -0
  250. package/tests/api-resources/hris/benefits/benefits.test.ts +79 -0
  251. package/tests/api-resources/hris/benefits/individuals.test.ts +66 -0
  252. package/tests/api-resources/hris/company.test.ts +18 -0
  253. package/tests/api-resources/hris/directory.test.ts +25 -0
  254. package/tests/api-resources/hris/individuals/employment-data.test.ts +19 -0
  255. package/tests/api-resources/hris/individuals/individuals.test.ts +31 -0
  256. package/tests/api-resources/hris/pay-statements.test.ts +27 -0
  257. package/tests/api-resources/hris/payments.test.ts +15 -0
  258. package/tests/api-resources/providers.test.ts +18 -0
  259. package/tests/api-resources/top-level.test.ts +15 -0
  260. package/tests/form.test.ts +27 -0
  261. package/tests/index.test.ts +34 -0
  262. package/tests/responses.test.ts +25 -0
  263. package/tsconfig.cjs.json +8 -0
  264. package/tsconfig.json +39 -0
  265. package/typings/digest-fetch/index.d.ts +33 -0
  266. package/version.ts +1 -0
package/pagination.ts ADDED
@@ -0,0 +1,401 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import { AbstractPage, APIResponse, APIClient, FinalRequestOptions, PageInfo } from './core';
4
+ import * as HRIS from './resources/hris';
5
+ import * as ATS from './resources/ats';
6
+
7
+ export type SinglePageResponse<Item> = Item[];
8
+
9
+ export class SinglePage<Item> extends AbstractPage<Item> {
10
+ items: Array<Item>;
11
+
12
+ constructor(
13
+ client: APIClient,
14
+ response: APIResponse<SinglePageResponse<Item>>,
15
+ options: FinalRequestOptions,
16
+ ) {
17
+ super(client, response, options);
18
+
19
+ this.items = response || [];
20
+ }
21
+
22
+ getPaginatedItems(): Item[] {
23
+ return this.items;
24
+ }
25
+
26
+ // @deprecated Please use `nextPageInfo()` instead
27
+ /**
28
+ * This page represents a response that isn't actually paginated at the API level
29
+ * so there will never be any next page params.
30
+ */
31
+ nextPageParams(): null {
32
+ return null;
33
+ }
34
+
35
+ nextPageInfo(): null {
36
+ return null;
37
+ }
38
+ }
39
+
40
+ export interface ResponsesPageResponse<Item> {
41
+ responses: Array<Item>;
42
+ }
43
+
44
+ export class ResponsesPage<Item> extends AbstractPage<Item> implements ResponsesPageResponse<Item> {
45
+ responses: Array<Item>;
46
+
47
+ constructor(
48
+ client: APIClient,
49
+ response: APIResponse<ResponsesPageResponse<Item>>,
50
+ options: FinalRequestOptions,
51
+ ) {
52
+ super(client, response, options);
53
+
54
+ this.responses = response.responses;
55
+ }
56
+
57
+ getPaginatedItems(): Item[] {
58
+ return this.responses;
59
+ }
60
+
61
+ // @deprecated Please use `nextPageInfo()` instead
62
+ /**
63
+ * This page represents a response that isn't actually paginated at the API level
64
+ * so there will never be any next page params.
65
+ */
66
+ nextPageParams(): null {
67
+ return null;
68
+ }
69
+
70
+ nextPageInfo(): null {
71
+ return null;
72
+ }
73
+ }
74
+
75
+ export interface IndividualsPageResponse {
76
+ /**
77
+ * The array of employees.
78
+ */
79
+ individuals: Array<HRIS.IndividualInDirectory>;
80
+
81
+ paging: HRIS.Paging;
82
+ }
83
+
84
+ export interface IndividualsPageParams {
85
+ /**
86
+ * Number of employees to return (defaults to all)
87
+ */
88
+ limit?: number;
89
+
90
+ /**
91
+ * Index to start from (defaults to 0)
92
+ */
93
+ offset?: number;
94
+ }
95
+
96
+ export class IndividualsPage
97
+ extends AbstractPage<HRIS.IndividualInDirectory>
98
+ implements IndividualsPageResponse
99
+ {
100
+ paging: HRIS.Paging;
101
+ /** The array of employees. */
102
+ individuals: Array<HRIS.IndividualInDirectory>;
103
+
104
+ constructor(
105
+ client: APIClient,
106
+ response: APIResponse<IndividualsPageResponse>,
107
+ options: FinalRequestOptions,
108
+ ) {
109
+ super(client, response, options);
110
+
111
+ this.paging = response.paging;
112
+ this.individuals = response.individuals;
113
+ }
114
+
115
+ getPaginatedItems(): HRIS.IndividualInDirectory[] {
116
+ return this.individuals;
117
+ }
118
+
119
+ // @deprecated Please use `nextPageInfo()` instead
120
+ nextPageParams(): Partial<IndividualsPageParams> | null {
121
+ const info = this.nextPageInfo();
122
+ if (!info) return null;
123
+ if ('params' in info) return info.params;
124
+ const params = Object.fromEntries(info.url.searchParams);
125
+ if (!Object.keys(params).length) return null;
126
+ return params;
127
+ }
128
+
129
+ nextPageInfo(): PageInfo | null {
130
+ const offset = this.paging.offset;
131
+ if (!offset) return null;
132
+
133
+ const length = this.individuals.length;
134
+ const currentCount = offset + length;
135
+
136
+ const totalCount = this.paging.count;
137
+ if (!totalCount) return null;
138
+
139
+ if (currentCount < totalCount) {
140
+ return { params: { offset: currentCount } };
141
+ }
142
+
143
+ return null;
144
+ }
145
+ }
146
+
147
+ export interface CandidatesPageResponse {
148
+ candidates: Array<ATS.Candidate>;
149
+
150
+ paging: HRIS.Paging;
151
+ }
152
+
153
+ export interface CandidatesPageParams {
154
+ /**
155
+ * Number of candidates to return (defaults to all)
156
+ */
157
+ limit?: number;
158
+
159
+ /**
160
+ * Index to start from (defaults to 0)
161
+ */
162
+ offset?: number;
163
+ }
164
+
165
+ export class CandidatesPage extends AbstractPage<ATS.Candidate> implements CandidatesPageResponse {
166
+ paging: HRIS.Paging;
167
+
168
+ candidates: Array<ATS.Candidate>;
169
+
170
+ constructor(
171
+ client: APIClient,
172
+ response: APIResponse<CandidatesPageResponse>,
173
+ options: FinalRequestOptions,
174
+ ) {
175
+ super(client, response, options);
176
+
177
+ this.paging = response.paging;
178
+ this.candidates = response.candidates;
179
+ }
180
+
181
+ getPaginatedItems(): ATS.Candidate[] {
182
+ return this.candidates;
183
+ }
184
+
185
+ // @deprecated Please use `nextPageInfo()` instead
186
+ nextPageParams(): Partial<CandidatesPageParams> | null {
187
+ const info = this.nextPageInfo();
188
+ if (!info) return null;
189
+ if ('params' in info) return info.params;
190
+ const params = Object.fromEntries(info.url.searchParams);
191
+ if (!Object.keys(params).length) return null;
192
+ return params;
193
+ }
194
+
195
+ nextPageInfo(): PageInfo | null {
196
+ const offset = this.paging.offset;
197
+ if (!offset) return null;
198
+
199
+ const length = this.candidates.length;
200
+ const currentCount = offset + length;
201
+
202
+ const totalCount = this.paging.count;
203
+ if (!totalCount) return null;
204
+
205
+ if (currentCount < totalCount) {
206
+ return { params: { offset: currentCount } };
207
+ }
208
+
209
+ return null;
210
+ }
211
+ }
212
+
213
+ export interface ApplicationsPageResponse {
214
+ applications: Array<ATS.Application>;
215
+
216
+ paging: HRIS.Paging;
217
+ }
218
+
219
+ export interface ApplicationsPageParams {
220
+ /**
221
+ * Number of applications to return (defaults to all)
222
+ */
223
+ limit?: number;
224
+
225
+ /**
226
+ * Index to start from (defaults to 0)
227
+ */
228
+ offset?: number;
229
+ }
230
+
231
+ export class ApplicationsPage extends AbstractPage<ATS.Application> implements ApplicationsPageResponse {
232
+ paging: HRIS.Paging;
233
+
234
+ applications: Array<ATS.Application>;
235
+
236
+ constructor(
237
+ client: APIClient,
238
+ response: APIResponse<ApplicationsPageResponse>,
239
+ options: FinalRequestOptions,
240
+ ) {
241
+ super(client, response, options);
242
+
243
+ this.paging = response.paging;
244
+ this.applications = response.applications;
245
+ }
246
+
247
+ getPaginatedItems(): ATS.Application[] {
248
+ return this.applications;
249
+ }
250
+
251
+ // @deprecated Please use `nextPageInfo()` instead
252
+ nextPageParams(): Partial<ApplicationsPageParams> | null {
253
+ const info = this.nextPageInfo();
254
+ if (!info) return null;
255
+ if ('params' in info) return info.params;
256
+ const params = Object.fromEntries(info.url.searchParams);
257
+ if (!Object.keys(params).length) return null;
258
+ return params;
259
+ }
260
+
261
+ nextPageInfo(): PageInfo | null {
262
+ const offset = this.paging.offset;
263
+ if (!offset) return null;
264
+
265
+ const length = this.applications.length;
266
+ const currentCount = offset + length;
267
+
268
+ const totalCount = this.paging.count;
269
+ if (!totalCount) return null;
270
+
271
+ if (currentCount < totalCount) {
272
+ return { params: { offset: currentCount } };
273
+ }
274
+
275
+ return null;
276
+ }
277
+ }
278
+
279
+ export interface JobsPageResponse {
280
+ jobs: Array<ATS.Job>;
281
+
282
+ paging: HRIS.Paging;
283
+ }
284
+
285
+ export interface JobsPageParams {
286
+ /**
287
+ * Number of jobs to return (defaults to all)
288
+ */
289
+ limit?: number;
290
+
291
+ /**
292
+ * Index to start from (defaults to 0)
293
+ */
294
+ offset?: number;
295
+ }
296
+
297
+ export class JobsPage extends AbstractPage<ATS.Job> implements JobsPageResponse {
298
+ paging: HRIS.Paging;
299
+
300
+ jobs: Array<ATS.Job>;
301
+
302
+ constructor(client: APIClient, response: APIResponse<JobsPageResponse>, options: FinalRequestOptions) {
303
+ super(client, response, options);
304
+
305
+ this.paging = response.paging;
306
+ this.jobs = response.jobs;
307
+ }
308
+
309
+ getPaginatedItems(): ATS.Job[] {
310
+ return this.jobs;
311
+ }
312
+
313
+ // @deprecated Please use `nextPageInfo()` instead
314
+ nextPageParams(): Partial<JobsPageParams> | null {
315
+ const info = this.nextPageInfo();
316
+ if (!info) return null;
317
+ if ('params' in info) return info.params;
318
+ const params = Object.fromEntries(info.url.searchParams);
319
+ if (!Object.keys(params).length) return null;
320
+ return params;
321
+ }
322
+
323
+ nextPageInfo(): PageInfo | null {
324
+ const offset = this.paging.offset;
325
+ if (!offset) return null;
326
+
327
+ const length = this.jobs.length;
328
+ const currentCount = offset + length;
329
+
330
+ const totalCount = this.paging.count;
331
+ if (!totalCount) return null;
332
+
333
+ if (currentCount < totalCount) {
334
+ return { params: { offset: currentCount } };
335
+ }
336
+
337
+ return null;
338
+ }
339
+ }
340
+
341
+ export interface OffersPageResponse {
342
+ offers: Array<ATS.Offer>;
343
+
344
+ paging: HRIS.Paging;
345
+ }
346
+
347
+ export interface OffersPageParams {
348
+ /**
349
+ * Number of offers to return (defaults to all)
350
+ */
351
+ limit?: number;
352
+
353
+ /**
354
+ * Index to start from (defaults to 0)
355
+ */
356
+ offset?: number;
357
+ }
358
+
359
+ export class OffersPage extends AbstractPage<ATS.Offer> implements OffersPageResponse {
360
+ paging: HRIS.Paging;
361
+
362
+ offers: Array<ATS.Offer>;
363
+
364
+ constructor(client: APIClient, response: APIResponse<OffersPageResponse>, options: FinalRequestOptions) {
365
+ super(client, response, options);
366
+
367
+ this.paging = response.paging;
368
+ this.offers = response.offers;
369
+ }
370
+
371
+ getPaginatedItems(): ATS.Offer[] {
372
+ return this.offers;
373
+ }
374
+
375
+ // @deprecated Please use `nextPageInfo()` instead
376
+ nextPageParams(): Partial<OffersPageParams> | null {
377
+ const info = this.nextPageInfo();
378
+ if (!info) return null;
379
+ if ('params' in info) return info.params;
380
+ const params = Object.fromEntries(info.url.searchParams);
381
+ if (!Object.keys(params).length) return null;
382
+ return params;
383
+ }
384
+
385
+ nextPageInfo(): PageInfo | null {
386
+ const offset = this.paging.offset;
387
+ if (!offset) return null;
388
+
389
+ const length = this.offers.length;
390
+ const currentCount = offset + length;
391
+
392
+ const totalCount = this.paging.count;
393
+ if (!totalCount) return null;
394
+
395
+ if (currentCount < totalCount) {
396
+ return { params: { offset: currentCount } };
397
+ }
398
+
399
+ return null;
400
+ }
401
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "include-v-in-tag": true,
3
+ "bump-minor-pre-major": true,
4
+ "bump-patch-for-minor-pre-major": true,
5
+ "pull-request-header": "Automated Release PR",
6
+ "packages": {
7
+ ".": {}
8
+ },
9
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
10
+ "release-type": "node",
11
+ "extra-files": ["version.ts"]
12
+ }
package/resource.ts ADDED
@@ -0,0 +1,24 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import type { Finch } from './index';
4
+
5
+ export class APIResource {
6
+ protected client: Finch;
7
+ constructor(client: Finch) {
8
+ this.client = client;
9
+
10
+ this.get = client.get.bind(client);
11
+ this.post = client.post.bind(client);
12
+ this.patch = client.patch.bind(client);
13
+ this.put = client.put.bind(client);
14
+ this.delete = client.delete.bind(client);
15
+ this.getAPIList = client.getAPIList.bind(client);
16
+ }
17
+
18
+ protected get: Finch['get'];
19
+ protected post: Finch['post'];
20
+ protected patch: Finch['patch'];
21
+ protected put: Finch['put'];
22
+ protected delete: Finch['delete'];
23
+ protected getAPIList: Finch['getAPIList'];
24
+ }
@@ -0,0 +1,63 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+
6
+ export class Account extends APIResource {
7
+ /**
8
+ * Disconnect an employer from your application and invalidate all `access_token`s
9
+ * associated with the employer. We require applications to implement the
10
+ * Disconnect endpoint for billing and security purposes.
11
+ */
12
+ disconnect(options?: Core.RequestOptions): Promise<Core.APIResponse<DisconnectResponse>> {
13
+ return this.post('/disconnect', options);
14
+ }
15
+
16
+ /**
17
+ * Read account information associated with an `access_token`
18
+ */
19
+ introspect(options?: Core.RequestOptions): Promise<Core.APIResponse<Introspection>> {
20
+ return this.get('/introspect', options);
21
+ }
22
+ }
23
+
24
+ export interface DisconnectResponse {
25
+ /**
26
+ * If the request is successful, Finch will return “success” (HTTP 200 status).
27
+ */
28
+ status: string;
29
+ }
30
+
31
+ export interface Introspection {
32
+ /**
33
+ * The client id of the application associated with the `access_token`.
34
+ */
35
+ client_id: string;
36
+
37
+ /**
38
+ * The Finch uuid of the company associated with the `access_token`.
39
+ */
40
+ company_id: string;
41
+
42
+ /**
43
+ * Whether the connection associated with the `access_token` uses the Assisted
44
+ * Connect Flow. (`true` if using Assisted Connect, `false` if connection is
45
+ * automated)
46
+ */
47
+ manual: boolean;
48
+
49
+ /**
50
+ * The payroll provider associated with the `access_token`.
51
+ */
52
+ payroll_provider_id: string;
53
+
54
+ /**
55
+ * An array of the authorized products associated with the `access_token`.
56
+ */
57
+ products: Array<string>;
58
+
59
+ /**
60
+ * The account username used for login associated with the `access_token`.
61
+ */
62
+ username: string;
63
+ }
@@ -0,0 +1,55 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+ import { isRequestOptions } from '~/core';
6
+ import * as Stages from '~/resources/ats/stages';
7
+ import { ApplicationsPage, ApplicationsPageParams } from '~/pagination';
8
+
9
+ export class Applications extends APIResource {
10
+ /**
11
+ * Gets an application from an organization.
12
+ */
13
+ retrieve(applicationId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Application>> {
14
+ return this.get(`/ats/applications/${applicationId}`, options);
15
+ }
16
+
17
+ /**
18
+ * Gets all of an organization's applications.
19
+ */
20
+ list(query?: ApplicationListParams, options?: Core.RequestOptions): Core.PagePromise<ApplicationsPage>;
21
+ list(options?: Core.RequestOptions): Core.PagePromise<ApplicationsPage>;
22
+ list(
23
+ query: ApplicationListParams | Core.RequestOptions = {},
24
+ options?: Core.RequestOptions,
25
+ ): Core.PagePromise<ApplicationsPage> {
26
+ if (isRequestOptions(query)) {
27
+ return this.list({}, query);
28
+ }
29
+ return this.getAPIList('/ats/applications', ApplicationsPage, { query, ...options });
30
+ }
31
+ }
32
+
33
+ export interface Application {
34
+ candidate_id: string;
35
+
36
+ id: string;
37
+
38
+ job_id: string;
39
+
40
+ offer_id: string | null;
41
+
42
+ rejected_at: string | null;
43
+
44
+ rejected_reason: Application.RejectedReason | null;
45
+
46
+ stage: Stages.Stage | null;
47
+ }
48
+
49
+ export namespace Application {
50
+ export interface RejectedReason {
51
+ text?: string | null;
52
+ }
53
+ }
54
+
55
+ export interface ApplicationListParams extends ApplicationsPageParams {}
@@ -0,0 +1,16 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import { APIResource } from '~/resource';
4
+ import { Candidates } from './candidates';
5
+ import { Applications } from './applications';
6
+ import { Stages } from './stages';
7
+ import { Jobs } from './jobs';
8
+ import { Offers } from './offers';
9
+
10
+ export class ATS extends APIResource {
11
+ candidates: Candidates = new Candidates(this.client);
12
+ applications: Applications = new Applications(this.client);
13
+ stages: Stages = new Stages(this.client);
14
+ jobs: Jobs = new Jobs(this.client);
15
+ offers: Offers = new Offers(this.client);
16
+ }
@@ -0,0 +1,74 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+ import { isRequestOptions } from '~/core';
6
+ import { CandidatesPage, CandidatesPageParams } from '~/pagination';
7
+
8
+ export class Candidates extends APIResource {
9
+ /**
10
+ * Gets a candidate from an organization. A candidate represents an individual
11
+ * associated with one or more applications.
12
+ */
13
+ retrieve(candidateId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Candidate>> {
14
+ return this.get(`/ats/candidates/${candidateId}`, options);
15
+ }
16
+
17
+ /**
18
+ * Gets all of an organization's candidates. A candidate represents an individual
19
+ * associated with one or more applications.
20
+ */
21
+ list(query?: CandidateListParams, options?: Core.RequestOptions): Core.PagePromise<CandidatesPage>;
22
+ list(options?: Core.RequestOptions): Core.PagePromise<CandidatesPage>;
23
+ list(
24
+ query: CandidateListParams | Core.RequestOptions = {},
25
+ options?: Core.RequestOptions,
26
+ ): Core.PagePromise<CandidatesPage> {
27
+ if (isRequestOptions(query)) {
28
+ return this.list({}, query);
29
+ }
30
+ return this.getAPIList('/ats/candidates', CandidatesPage, { query, ...options });
31
+ }
32
+ }
33
+
34
+ /**
35
+ * A candidate represents an individual associated with one or more applications.
36
+ */
37
+ export interface Candidate {
38
+ /**
39
+ * Array of Finch uuids corresponding to `application`s for this individual
40
+ */
41
+ application_ids: Array<string>;
42
+
43
+ created_at: string;
44
+
45
+ emails: Array<Candidate.Emails>;
46
+
47
+ first_name: string | null;
48
+
49
+ full_name: string | null;
50
+
51
+ id: string;
52
+
53
+ last_activity_at: string;
54
+
55
+ last_name: string | null;
56
+
57
+ phone_numbers: Array<Candidate.PhoneNumbers>;
58
+ }
59
+
60
+ export namespace Candidate {
61
+ export interface Emails {
62
+ data?: string | null;
63
+
64
+ type?: string | null;
65
+ }
66
+
67
+ export interface PhoneNumbers {
68
+ data?: string | null;
69
+
70
+ type?: string | null;
71
+ }
72
+ }
73
+
74
+ export interface CandidateListParams extends CandidatesPageParams {}
@@ -0,0 +1,7 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ export { Application, ApplicationListParams } from './applications';
4
+ export { Candidate, CandidateListParams } from './candidates';
5
+ export { Job, JobListParams } from './jobs';
6
+ export { Offer, OfferListParams } from './offers';
7
+ export { Stage, StagesSinglePage } from './stages';