@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
@@ -0,0 +1,70 @@
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 { JobsPage, JobsPageParams } from '~/pagination';
7
+
8
+ export class Jobs extends APIResource {
9
+ /**
10
+ * Gets a job from an organization.
11
+ */
12
+ retrieve(jobId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Job>> {
13
+ return this.get(`/ats/jobs/${jobId}`, options);
14
+ }
15
+
16
+ /**
17
+ * Gets all of an organization's jobs.
18
+ */
19
+ list(query?: JobListParams, options?: Core.RequestOptions): Core.PagePromise<JobsPage>;
20
+ list(options?: Core.RequestOptions): Core.PagePromise<JobsPage>;
21
+ list(
22
+ query: JobListParams | Core.RequestOptions = {},
23
+ options?: Core.RequestOptions,
24
+ ): Core.PagePromise<JobsPage> {
25
+ if (isRequestOptions(query)) {
26
+ return this.list({}, query);
27
+ }
28
+ return this.getAPIList('/ats/jobs', JobsPage, { query, ...options });
29
+ }
30
+ }
31
+
32
+ export interface Job {
33
+ closed_at: string | null;
34
+
35
+ created_at: string | null;
36
+
37
+ department: Job.Department;
38
+
39
+ hiring_team: Job.HiringTeam;
40
+
41
+ id: string;
42
+
43
+ name: string | null;
44
+
45
+ status: 'open' | 'closed' | 'on_hold' | 'draft' | 'archived' | null;
46
+ }
47
+
48
+ export namespace Job {
49
+ export interface Department {
50
+ name?: string | null;
51
+ }
52
+
53
+ export interface HiringTeam {
54
+ hiring_managers?: Array<HiringTeam.HiringManagers> | null;
55
+
56
+ recruiters?: Array<HiringTeam.Recruiters> | null;
57
+ }
58
+
59
+ export namespace HiringTeam {
60
+ export interface HiringManagers {
61
+ name?: string;
62
+ }
63
+
64
+ export interface Recruiters {
65
+ name?: string;
66
+ }
67
+ }
68
+ }
69
+
70
+ export interface JobListParams extends JobsPageParams {}
@@ -0,0 +1,57 @@
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 { OffersPage, OffersPageParams } from '~/pagination';
7
+
8
+ export class Offers extends APIResource {
9
+ /**
10
+ * Get a single offer from an organization.
11
+ */
12
+ retrieve(offerId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Offer>> {
13
+ return this.get(`/ats/offers/${offerId}`, options);
14
+ }
15
+
16
+ /**
17
+ * Get all offers put out by an organization.
18
+ */
19
+ list(query?: OfferListParams, options?: Core.RequestOptions): Core.PagePromise<OffersPage>;
20
+ list(options?: Core.RequestOptions): Core.PagePromise<OffersPage>;
21
+ list(
22
+ query: OfferListParams | Core.RequestOptions = {},
23
+ options?: Core.RequestOptions,
24
+ ): Core.PagePromise<OffersPage> {
25
+ if (isRequestOptions(query)) {
26
+ return this.list({}, query);
27
+ }
28
+ return this.getAPIList('/ats/offers', OffersPage, { query, ...options });
29
+ }
30
+ }
31
+
32
+ export interface Offer {
33
+ application_id: string;
34
+
35
+ candidate_id: string;
36
+
37
+ created_at: string;
38
+
39
+ id: string;
40
+
41
+ job_id: string;
42
+
43
+ status:
44
+ | 'signed'
45
+ | 'rejected'
46
+ | 'draft'
47
+ | 'approval-sent'
48
+ | 'approved'
49
+ | 'sent'
50
+ | 'sent-manually'
51
+ | 'opened'
52
+ | 'archived';
53
+
54
+ updated_at: string;
55
+ }
56
+
57
+ export interface OfferListParams extends OffersPageParams {}
@@ -0,0 +1,31 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ import * as Core from '~/core';
4
+ import { APIResource } from '~/resource';
5
+ import { SinglePage } from '~/pagination';
6
+
7
+ export class Stages extends APIResource {
8
+ /**
9
+ * Get all job stages for an organization. Depending on the system, some jobs may
10
+ * have stages specific to that job. Other job stages may apply broadly to all jobs
11
+ * in the system. Use the `job_id` to determine whether a job applies specifically
12
+ * to a job.
13
+ */
14
+ list(options?: Core.RequestOptions): Core.PagePromise<StagesSinglePage> {
15
+ return this.getAPIList('/ats/stages', StagesSinglePage, options);
16
+ }
17
+ }
18
+
19
+ export class StagesSinglePage extends SinglePage<Stage> {}
20
+
21
+ export interface Stage {
22
+ id?: string;
23
+
24
+ /**
25
+ * The job id that this stage applies to, if applicable. Not all systems enumerate
26
+ * stages specific to jobs.
27
+ */
28
+ job_id?: string | null;
29
+
30
+ name?: string | null;
31
+ }
@@ -0,0 +1,214 @@
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 { Individuals } from './individuals';
7
+ import { SinglePage } from '~/pagination';
8
+
9
+ export class Benefits extends APIResource {
10
+ individuals: Individuals = new Individuals(this.client);
11
+
12
+ /**
13
+ * **Availability: Automated and Assisted Benefits providers**
14
+ *
15
+ * Creates a new company-wide benefit. Please use the `/meta` endpoint to view
16
+ * available types for each provider.
17
+ */
18
+ create(
19
+ body?: BenefitCreateParams,
20
+ options?: Core.RequestOptions,
21
+ ): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>>;
22
+ create(options?: Core.RequestOptions): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>>;
23
+ create(
24
+ body: BenefitCreateParams | Core.RequestOptions = {},
25
+ options?: Core.RequestOptions,
26
+ ): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>> {
27
+ if (isRequestOptions(body)) {
28
+ return this.create({}, body);
29
+ }
30
+ return this.post('/employer/benefits', { body, ...options });
31
+ }
32
+
33
+ /**
34
+ * **Availability: Automated Benefits providers only**
35
+ *
36
+ * Lists benefit information for a given benefit
37
+ */
38
+ retrieve(benefitId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<CompanyBenefit>> {
39
+ return this.get(`/employer/benefits/${benefitId}`, options);
40
+ }
41
+
42
+ /**
43
+ * **Availability: Automated and Assisted Benefits providers**
44
+ *
45
+ * Updates an existing company-wide benefit
46
+ */
47
+ update(
48
+ benefitId: string,
49
+ body?: BenefitUpdateParams,
50
+ options?: Core.RequestOptions,
51
+ ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>>;
52
+ update(
53
+ benefitId: string,
54
+ options?: Core.RequestOptions,
55
+ ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>>;
56
+ update(
57
+ benefitId: string,
58
+ body: BenefitUpdateParams | Core.RequestOptions = {},
59
+ options?: Core.RequestOptions,
60
+ ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>> {
61
+ if (isRequestOptions(body)) {
62
+ return this.update(benefitId, {}, body);
63
+ }
64
+ return this.post(`/employer/benefits/${benefitId}`, { body, ...options });
65
+ }
66
+
67
+ /**
68
+ * **Availability: Automated Benefits providers only**
69
+ *
70
+ * List all company-wide benefits.
71
+ */
72
+ list(options?: Core.RequestOptions): Core.PagePromise<CompanyBenefitsSinglePage> {
73
+ return this.getAPIList('/employer/benefits', CompanyBenefitsSinglePage, options);
74
+ }
75
+
76
+ /**
77
+ * **Availability: Automated and Assisted Benefits providers**
78
+ *
79
+ * Lists available types and configurations for the provider associated with the
80
+ * access token.
81
+ */
82
+ listSupportedBenefits(options?: Core.RequestOptions): Core.PagePromise<SupportedBenefitsSinglePage> {
83
+ return this.getAPIList('/employer/benefits/meta', SupportedBenefitsSinglePage, options);
84
+ }
85
+ }
86
+
87
+ export class CompanyBenefitsSinglePage extends SinglePage<CompanyBenefit> {}
88
+
89
+ export class SupportedBenefitsSinglePage extends SinglePage<SupportedBenefit> {}
90
+
91
+ export type BenefitFrequency = 'one_time' | 'every_paycheck' | null;
92
+
93
+ /**
94
+ * Type of benefit.
95
+ */
96
+ export type BenefitType =
97
+ | '401k'
98
+ | '401k_roth'
99
+ | '401k_loan'
100
+ | '403b'
101
+ | '403b_roth'
102
+ | '457'
103
+ | '457_roth'
104
+ | 's125_medical'
105
+ | 's125_dental'
106
+ | 's125_vision'
107
+ | 'hsa_pre'
108
+ | 'hsa_post'
109
+ | 'fsa_medical'
110
+ | 'fsa_dependent_care'
111
+ | 'simple_ira'
112
+ | 'simple'
113
+ | 'commuter'
114
+ | 'custom_post_tax'
115
+ | 'custom_pre_tax'
116
+ | null;
117
+
118
+ export interface BenfitContribution {
119
+ /**
120
+ * Contribution amount in cents (if `fixed`) or basis points (if `percent`).
121
+ */
122
+ amount?: number | null;
123
+
124
+ /**
125
+ * Contribution type.
126
+ */
127
+ type?: 'fixed' | 'percent' | null;
128
+ }
129
+
130
+ export interface CompanyBenefit {
131
+ benefit_id: string;
132
+
133
+ company_contribution: BenfitContribution | null;
134
+
135
+ description: string | null;
136
+
137
+ employee_deduction: BenfitContribution | null;
138
+
139
+ frequency: BenefitFrequency | null;
140
+
141
+ /**
142
+ * Type of benefit.
143
+ */
144
+ type: BenefitType | null;
145
+ }
146
+
147
+ export interface CreateCompanyBenefitsResponse {
148
+ benefit_id: string;
149
+ }
150
+
151
+ export interface SupportedBenefit {
152
+ /**
153
+ * Whether the provider supports an annual maximum for this benefit.
154
+ */
155
+ annual_maximum?: boolean | null;
156
+
157
+ /**
158
+ * Whether the provider supports catch up for this benefit. This field will only be
159
+ * true for retirement benefits.
160
+ */
161
+ catch_up?: boolean | null;
162
+
163
+ /**
164
+ * Supported contribution types. An empty array indicates contributions are not
165
+ * supported.
166
+ */
167
+ company_contribution?: Array<'fixed' | 'percent'> | null;
168
+
169
+ description?: string | null;
170
+
171
+ /**
172
+ * Supported deduction types. An empty array indicates deductions are not
173
+ * supported.
174
+ */
175
+ employee_deduction?: Array<'fixed' | 'percent'> | null;
176
+
177
+ /**
178
+ * The list of frequencies supported by the provider for this benefit
179
+ */
180
+ frequencies?: Array<BenefitFrequency | null>;
181
+
182
+ /**
183
+ * Whether the provider supports HSA contribution limits. Empty if this feature is
184
+ * not supported for the benefit. This array only has values for HSA benefits.
185
+ */
186
+ hsa_contribution_limit?: Array<'individual' | 'family'> | null;
187
+
188
+ /**
189
+ * Type of benefit.
190
+ */
191
+ type?: BenefitType | null;
192
+ }
193
+
194
+ export interface UpdateCompanyBenefitResponse {
195
+ benefit_id: string;
196
+ }
197
+
198
+ export interface BenefitCreateParams {
199
+ description?: string;
200
+
201
+ frequency?: BenefitFrequency | null;
202
+
203
+ /**
204
+ * Type of benefit.
205
+ */
206
+ type?: BenefitType | null;
207
+ }
208
+
209
+ export interface BenefitUpdateParams {
210
+ /**
211
+ * Updated name or description.
212
+ */
213
+ description?: string;
214
+ }
@@ -0,0 +1,27 @@
1
+ // File generated from our OpenAPI spec by Stainless.
2
+
3
+ export {
4
+ BenefitFrequency,
5
+ BenefitType,
6
+ BenfitContribution,
7
+ CompanyBenefit,
8
+ CreateCompanyBenefitsResponse,
9
+ SupportedBenefit,
10
+ UpdateCompanyBenefitResponse,
11
+ BenefitCreateParams,
12
+ BenefitUpdateParams,
13
+ CompanyBenefitsSinglePage,
14
+ SupportedBenefitsSinglePage,
15
+ } from './benefits';
16
+ export {
17
+ EnrolledIndividual,
18
+ IndividualBenefit,
19
+ UnenrolledIndividual,
20
+ IndividualEnrolledIDsResponse,
21
+ IndividualEnrollManyParams,
22
+ IndividualRetrieveManyBenefitsParams,
23
+ IndividualUnenrollParams,
24
+ EnrolledIndividualsSinglePage,
25
+ IndividualBenefitsSinglePage,
26
+ UnenrolledIndividualsSinglePage,
27
+ } from './individuals';
@@ -0,0 +1,234 @@
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 Benefits from '~/resources/hris/benefits';
7
+ import { SinglePage } from '~/pagination';
8
+
9
+ export class Individuals extends APIResource {
10
+ /**
11
+ * **Availability: Automated and Assisted Benefits providers**
12
+ *
13
+ * Enroll an individual into a benefit. If the employee is already enrolled, the
14
+ * enrollment amounts will be adjusted.
15
+ *
16
+ * <!-- theme: warning -->
17
+ *
18
+ * > Making changes to an individual's benefits may have tax consequences based on
19
+ * > IRS regulations. Please consult a tax expert to ensure all changes being made
20
+ * > to the system are compliant with local, state, and federal law.
21
+ */
22
+ enrollMany(
23
+ benefitId: string,
24
+ body: IndividualEnrollManyParams,
25
+ options?: Core.RequestOptions,
26
+ ): Core.PagePromise<EnrolledIndividualsSinglePage> {
27
+ return this.getAPIList(`/employer/benefits/${benefitId}/individuals`, EnrolledIndividualsSinglePage, {
28
+ body,
29
+ method: 'post',
30
+ ...options,
31
+ });
32
+ }
33
+
34
+ /**
35
+ * **Availability: Automated Benefits providers only**
36
+ *
37
+ * Lists individuals currently enrolled in a given benefit.
38
+ */
39
+ enrolledIds(
40
+ benefitId: string,
41
+ options?: Core.RequestOptions,
42
+ ): Promise<Core.APIResponse<IndividualEnrolledIDsResponse>> {
43
+ return this.get(`/employer/benefits/${benefitId}/enrolled`, options);
44
+ }
45
+
46
+ /**
47
+ * **Availability: Automated Benefits providers only**
48
+ *
49
+ * Get enrolled benefit information for the given individuals.
50
+ */
51
+ retrieveManyBenefits(
52
+ benefitId: string,
53
+ query?: IndividualRetrieveManyBenefitsParams,
54
+ options?: Core.RequestOptions,
55
+ ): Core.PagePromise<IndividualBenefitsSinglePage>;
56
+ retrieveManyBenefits(
57
+ benefitId: string,
58
+ options?: Core.RequestOptions,
59
+ ): Core.PagePromise<IndividualBenefitsSinglePage>;
60
+ retrieveManyBenefits(
61
+ benefitId: string,
62
+ query: IndividualRetrieveManyBenefitsParams | Core.RequestOptions = {},
63
+ options?: Core.RequestOptions,
64
+ ): Core.PagePromise<IndividualBenefitsSinglePage> {
65
+ if (isRequestOptions(query)) {
66
+ return this.retrieveManyBenefits(benefitId, {}, query);
67
+ }
68
+ return this.getAPIList(`/employer/benefits/${benefitId}/individuals`, IndividualBenefitsSinglePage, {
69
+ query,
70
+ ...options,
71
+ });
72
+ }
73
+
74
+ /**
75
+ * **Availability: Automated and Assisted Benefits providers**
76
+ *
77
+ * Unenroll individuals from a benefit
78
+ */
79
+ unenroll(
80
+ benefitId: string,
81
+ body?: IndividualUnenrollParams,
82
+ options?: Core.RequestOptions,
83
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage>;
84
+ unenroll(
85
+ benefitId: string,
86
+ options?: Core.RequestOptions,
87
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage>;
88
+ unenroll(
89
+ benefitId: string,
90
+ body: IndividualUnenrollParams | Core.RequestOptions = {},
91
+ options?: Core.RequestOptions,
92
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage> {
93
+ if (isRequestOptions(body)) {
94
+ return this.unenroll(benefitId, {}, body);
95
+ }
96
+ return this.getAPIList(`/employer/benefits/${benefitId}/individuals`, UnenrolledIndividualsSinglePage, {
97
+ body,
98
+ method: 'delete',
99
+ ...options,
100
+ });
101
+ }
102
+ }
103
+
104
+ export class EnrolledIndividualsSinglePage extends SinglePage<EnrolledIndividual> {}
105
+
106
+ export class IndividualBenefitsSinglePage extends SinglePage<IndividualBenefit> {}
107
+
108
+ export class UnenrolledIndividualsSinglePage extends SinglePage<UnenrolledIndividual> {}
109
+
110
+ export interface EnrolledIndividual {
111
+ body?: EnrolledIndividual.Body;
112
+
113
+ /**
114
+ * HTTP status code. Either 201 or 200
115
+ */
116
+ code?: 200 | 201 | 404 | 403;
117
+
118
+ individual_id?: string;
119
+ }
120
+
121
+ export namespace EnrolledIndividual {
122
+ export interface Body {
123
+ /**
124
+ * A descriptive identifier for the response
125
+ */
126
+ finch_code?: string | null;
127
+
128
+ /**
129
+ * Short description in English that provides more information about the response.
130
+ */
131
+ message?: string | null;
132
+
133
+ /**
134
+ * Identifier indicating whether the benefit was newly enrolled or updated.
135
+ */
136
+ name?: string | null;
137
+ }
138
+ }
139
+
140
+ export interface IndividualBenefit {
141
+ body?: IndividualBenefit.Body;
142
+
143
+ code?: number;
144
+
145
+ individual_id?: string;
146
+ }
147
+
148
+ export namespace IndividualBenefit {
149
+ export interface Body {
150
+ /**
151
+ * If the benefit supports annual maximum, the amount in cents for this individual.
152
+ */
153
+ annual_maximum?: number | null;
154
+
155
+ /**
156
+ * If the benefit supports catch up (401k, 403b, etc.), whether catch up is enabled
157
+ * for this individual.
158
+ */
159
+ catch_up?: boolean | null;
160
+
161
+ company_contribution?: Benefits.BenfitContribution | null;
162
+
163
+ employee_deduction?: Benefits.BenfitContribution | null;
164
+
165
+ /**
166
+ * Type for HSA contribution limit if the benefit is a HSA.
167
+ */
168
+ hsa_contribution_limit?: 'individual' | 'family' | null;
169
+ }
170
+ }
171
+
172
+ export interface UnenrolledIndividual {
173
+ body?: UnenrolledIndividual.Body;
174
+
175
+ /**
176
+ * HTTP status code
177
+ */
178
+ code?: number;
179
+
180
+ individual_id?: string;
181
+ }
182
+
183
+ export namespace UnenrolledIndividual {
184
+ export interface Body {
185
+ /**
186
+ * A descriptive identifier for the response.
187
+ */
188
+ finch_code?: string | null;
189
+
190
+ /**
191
+ * Short description in English that provides more information about the response.
192
+ */
193
+ message?: string | null;
194
+
195
+ /**
196
+ * Identifier indicating whether the benefit was newly enrolled or updated.
197
+ */
198
+ name?: string | null;
199
+ }
200
+ }
201
+
202
+ export interface IndividualEnrolledIDsResponse {
203
+ benefit_id: string;
204
+
205
+ individual_ids: Array<string>;
206
+ }
207
+
208
+ export type IndividualEnrollManyParams = Array<IndividualEnrollManyParams.Individual>;
209
+
210
+ export namespace IndividualEnrollManyParams {
211
+ export interface Individual {
212
+ configuration?: unknown;
213
+
214
+ /**
215
+ * Finch id (uuidv4) for the individual to enroll
216
+ */
217
+ individual_id?: string;
218
+ }
219
+ }
220
+
221
+ export interface IndividualRetrieveManyBenefitsParams {
222
+ /**
223
+ * comma-delimited list of stable Finch uuids for each individual. If empty,
224
+ * defaults to all individuals
225
+ */
226
+ individual_ids?: string;
227
+ }
228
+
229
+ export interface IndividualUnenrollParams {
230
+ /**
231
+ * Array of individual_ids to unenroll.
232
+ */
233
+ individual_ids?: Array<string>;
234
+ }