@tryfinch/finch-api 5.4.1 → 5.5.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 (159) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +16 -19
  3. package/_shims/auto/types.d.ts +3 -1
  4. package/_shims/index.d.ts +2 -0
  5. package/_shims/node-runtime.d.ts.map +1 -1
  6. package/_shims/node-runtime.js +5 -2
  7. package/_shims/node-runtime.js.map +1 -1
  8. package/_shims/node-runtime.mjs +4 -2
  9. package/_shims/node-runtime.mjs.map +1 -1
  10. package/_shims/node-types.d.ts +1 -1
  11. package/_shims/registry.d.ts +2 -0
  12. package/_shims/registry.d.ts.map +1 -1
  13. package/_shims/registry.js +3 -1
  14. package/_shims/registry.js.map +1 -1
  15. package/_shims/registry.mjs +2 -0
  16. package/_shims/registry.mjs.map +1 -1
  17. package/_shims/web-runtime.d.ts.map +1 -1
  18. package/_shims/web-runtime.js +8 -0
  19. package/_shims/web-runtime.js.map +1 -1
  20. package/_shims/web-runtime.mjs +8 -0
  21. package/_shims/web-runtime.mjs.map +1 -1
  22. package/_shims/web-types.d.ts +2 -1
  23. package/core.d.ts +1 -1
  24. package/core.d.ts.map +1 -1
  25. package/core.js +43 -34
  26. package/core.js.map +1 -1
  27. package/core.mjs +41 -32
  28. package/core.mjs.map +1 -1
  29. package/error.d.ts.map +1 -1
  30. package/error.js +15 -5
  31. package/error.js.map +1 -1
  32. package/error.mjs +15 -5
  33. package/error.mjs.map +1 -1
  34. package/index.d.mts +19 -13
  35. package/index.d.ts +19 -13
  36. package/index.d.ts.map +1 -1
  37. package/index.js +8 -10
  38. package/index.js.map +1 -1
  39. package/index.mjs +8 -10
  40. package/index.mjs.map +1 -1
  41. package/package.json +4 -2
  42. package/pagination.d.ts +8 -7
  43. package/pagination.d.ts.map +1 -1
  44. package/pagination.js.map +1 -1
  45. package/pagination.mjs.map +1 -1
  46. package/resources/account.d.ts +3 -3
  47. package/resources/account.d.ts.map +1 -1
  48. package/resources/hris/benefits/benefits.d.ts +41 -36
  49. package/resources/hris/benefits/benefits.d.ts.map +1 -1
  50. package/resources/hris/benefits/benefits.js +9 -7
  51. package/resources/hris/benefits/benefits.js.map +1 -1
  52. package/resources/hris/benefits/benefits.mjs +9 -7
  53. package/resources/hris/benefits/benefits.mjs.map +1 -1
  54. package/resources/hris/benefits/index.d.ts +1 -1
  55. package/resources/hris/benefits/index.d.ts.map +1 -1
  56. package/resources/hris/benefits/index.js.map +1 -1
  57. package/resources/hris/benefits/index.mjs.map +1 -1
  58. package/resources/hris/benefits/individuals.d.ts +14 -18
  59. package/resources/hris/benefits/individuals.d.ts.map +1 -1
  60. package/resources/hris/benefits/individuals.js +27 -0
  61. package/resources/hris/benefits/individuals.js.map +1 -1
  62. package/resources/hris/benefits/individuals.mjs +4 -0
  63. package/resources/hris/benefits/individuals.mjs.map +1 -1
  64. package/resources/hris/company.d.ts +4 -4
  65. package/resources/hris/company.d.ts.map +1 -1
  66. package/resources/hris/directory.d.ts +16 -6
  67. package/resources/hris/directory.d.ts.map +1 -1
  68. package/resources/hris/directory.js +9 -2
  69. package/resources/hris/directory.js.map +1 -1
  70. package/resources/hris/directory.mjs +9 -2
  71. package/resources/hris/directory.mjs.map +1 -1
  72. package/resources/hris/employments.d.ts +9 -11
  73. package/resources/hris/employments.d.ts.map +1 -1
  74. package/resources/hris/employments.js +25 -0
  75. package/resources/hris/employments.js.map +1 -1
  76. package/resources/hris/employments.mjs +2 -0
  77. package/resources/hris/employments.mjs.map +1 -1
  78. package/resources/hris/hris.d.ts +61 -56
  79. package/resources/hris/hris.d.ts.map +1 -1
  80. package/resources/hris/hris.js +27 -28
  81. package/resources/hris/hris.js.map +1 -1
  82. package/resources/hris/hris.mjs +27 -28
  83. package/resources/hris/hris.mjs.map +1 -1
  84. package/resources/hris/index.d.ts +2 -2
  85. package/resources/hris/index.d.ts.map +1 -1
  86. package/resources/hris/index.js.map +1 -1
  87. package/resources/hris/index.mjs +1 -1
  88. package/resources/hris/index.mjs.map +1 -1
  89. package/resources/hris/individuals.d.ts +7 -9
  90. package/resources/hris/individuals.d.ts.map +1 -1
  91. package/resources/hris/individuals.js +25 -0
  92. package/resources/hris/individuals.js.map +1 -1
  93. package/resources/hris/individuals.mjs +2 -0
  94. package/resources/hris/individuals.mjs.map +1 -1
  95. package/resources/hris/pay-statements.d.ts +13 -15
  96. package/resources/hris/pay-statements.d.ts.map +1 -1
  97. package/resources/hris/pay-statements.js +25 -0
  98. package/resources/hris/pay-statements.js.map +1 -1
  99. package/resources/hris/pay-statements.mjs +2 -0
  100. package/resources/hris/pay-statements.mjs.map +1 -1
  101. package/resources/hris/payments.d.ts +10 -12
  102. package/resources/hris/payments.d.ts.map +1 -1
  103. package/resources/hris/payments.js +25 -0
  104. package/resources/hris/payments.js.map +1 -1
  105. package/resources/hris/payments.mjs +2 -0
  106. package/resources/hris/payments.mjs.map +1 -1
  107. package/resources/providers.d.ts +3 -5
  108. package/resources/providers.d.ts.map +1 -1
  109. package/resources/providers.js +25 -0
  110. package/resources/providers.js.map +1 -1
  111. package/resources/providers.mjs +2 -0
  112. package/resources/providers.mjs.map +1 -1
  113. package/resources/request-forwarding.d.ts +3 -3
  114. package/resources/request-forwarding.d.ts.map +1 -1
  115. package/resources/webhooks.d.ts.map +1 -1
  116. package/resources/webhooks.js +3 -12
  117. package/resources/webhooks.js.map +1 -1
  118. package/resources/webhooks.mjs +4 -13
  119. package/resources/webhooks.mjs.map +1 -1
  120. package/shims/node.d.ts +1 -1
  121. package/shims/node.d.ts.map +1 -1
  122. package/shims/web.d.ts +1 -1
  123. package/shims/web.d.ts.map +1 -1
  124. package/src/_shims/auto/types.d.ts +3 -1
  125. package/src/_shims/index.d.ts +2 -0
  126. package/src/_shims/node-runtime.ts +6 -2
  127. package/src/_shims/node-types.d.ts +1 -1
  128. package/src/_shims/registry.ts +3 -0
  129. package/src/_shims/web-runtime.ts +12 -0
  130. package/src/_shims/web-types.d.ts +2 -1
  131. package/src/core.ts +26 -9
  132. package/src/error.ts +15 -5
  133. package/src/index.ts +22 -16
  134. package/src/pagination.ts +8 -7
  135. package/src/resources/account.ts +3 -3
  136. package/src/resources/hris/benefits/benefits.ts +47 -43
  137. package/src/resources/hris/benefits/index.ts +1 -0
  138. package/src/resources/hris/benefits/individuals.ts +14 -20
  139. package/src/resources/hris/company.ts +4 -4
  140. package/src/resources/hris/directory.ts +18 -10
  141. package/src/resources/hris/employments.ts +9 -11
  142. package/src/resources/hris/hris.ts +61 -63
  143. package/src/resources/hris/index.ts +7 -1
  144. package/src/resources/hris/individuals.ts +7 -9
  145. package/src/resources/hris/pay-statements.ts +13 -15
  146. package/src/resources/hris/payments.ts +10 -12
  147. package/src/resources/providers.ts +3 -5
  148. package/src/resources/request-forwarding.ts +3 -3
  149. package/src/resources/webhooks.ts +4 -15
  150. package/src/shims/node.ts +1 -1
  151. package/src/shims/web.ts +1 -1
  152. package/src/version.ts +1 -1
  153. package/uploads.js +5 -9
  154. package/uploads.js.map +1 -1
  155. package/uploads.mjs +5 -9
  156. package/uploads.mjs.map +1 -1
  157. package/version.d.ts +1 -1
  158. package/version.js +1 -1
  159. package/version.mjs +1 -1
@@ -62,6 +62,8 @@ export type Readable = SelectType<manual.Readable, auto.Readable>;
62
62
  export type FsReadStream = SelectType<manual.FsReadStream, auto.FsReadStream>;
63
63
  // @ts-ignore
64
64
  export type ReadableStream = SelectType<manual.ReadableStream, auto.ReadableStream>;
65
+ // @ts-ignore
66
+ export const ReadableStream: SelectType<typeof manual.ReadableStream, typeof auto.ReadableStream>;
65
67
 
66
68
  export function getMultipartRequestOptions<T extends {} = Record<string, unknown>>(
67
69
  form: FormData,
@@ -14,6 +14,9 @@ import { type RequestOptions } from '../core';
14
14
  import { MultipartBody } from './MultipartBody';
15
15
  import { type Shims } from './registry';
16
16
 
17
+ // @ts-ignore (this package does not have proper export maps for this export)
18
+ import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
19
+
17
20
  type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
18
21
 
19
22
  let fileFromPathWarned = false;
@@ -59,8 +62,8 @@ async function getMultipartRequestOptions<T extends {} = Record<string, unknown>
59
62
  export function getRuntime(): Shims {
60
63
  // Polyfill global object if needed.
61
64
  if (typeof AbortController === 'undefined') {
62
- // @ts-ignore
63
- AbortController = AbortControllerPolyfill;
65
+ // @ts-expect-error (the types are subtly different, but compatible in practice)
66
+ globalThis.AbortController = AbortControllerPolyfill;
64
67
  }
65
68
  return {
66
69
  kind: 'node',
@@ -71,6 +74,7 @@ export function getRuntime(): Shims {
71
74
  FormData: fd.FormData,
72
75
  Blob: fd.Blob,
73
76
  File: fd.File,
77
+ ReadableStream,
74
78
  getMultipartRequestOptions,
75
79
  getDefaultAgent: (url: string): Agent => (url.startsWith('https') ? defaultHttpsAgent : defaultHttpAgent),
76
80
  fileFromPath,
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
7
7
  export { type Agent } from 'node:http';
8
8
  export { type Readable } from 'node:stream';
9
9
  export { type ReadStream as FsReadStream } from 'node:fs';
10
- export { type ReadableStream } from 'web-streams-polyfill';
10
+ export { ReadableStream } from 'web-streams-polyfill';
11
11
 
12
12
  export const fetch: typeof nf.default;
13
13
 
@@ -12,6 +12,7 @@ export interface Shims {
12
12
  FormData: any;
13
13
  Blob: any;
14
14
  File: any;
15
+ ReadableStream: any;
15
16
  getMultipartRequestOptions: <T extends {} = Record<string, unknown>>(
16
17
  form: Shims['FormData'],
17
18
  opts: RequestOptions<T>,
@@ -32,6 +33,7 @@ export let Headers: Shims['Headers'] | undefined = undefined;
32
33
  export let FormData: Shims['FormData'] | undefined = undefined;
33
34
  export let Blob: Shims['Blob'] | undefined = undefined;
34
35
  export let File: Shims['File'] | undefined = undefined;
36
+ export let ReadableStream: Shims['ReadableStream'] | undefined = undefined;
35
37
  export let getMultipartRequestOptions: Shims['getMultipartRequestOptions'] | undefined = undefined;
36
38
  export let getDefaultAgent: Shims['getDefaultAgent'] | undefined = undefined;
37
39
  export let fileFromPath: Shims['fileFromPath'] | undefined = undefined;
@@ -57,6 +59,7 @@ export function setShims(shims: Shims, options: { auto: boolean } = { auto: fals
57
59
  FormData = shims.FormData;
58
60
  Blob = shims.Blob;
59
61
  File = shims.File;
62
+ ReadableStream = shims.ReadableStream;
60
63
  getMultipartRequestOptions = shims.getMultipartRequestOptions;
61
64
  getDefaultAgent = shims.getDefaultAgent;
62
65
  fileFromPath = shims.fileFromPath;
@@ -72,6 +72,18 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
72
72
  }
73
73
  }
74
74
  ),
75
+ ReadableStream:
76
+ // @ts-ignore
77
+ typeof ReadableStream !== 'undefined' ? ReadableStream : (
78
+ class ReadableStream {
79
+ // @ts-ignore
80
+ constructor() {
81
+ throw new Error(
82
+ `streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${recommendation}`,
83
+ );
84
+ }
85
+ }
86
+ ),
75
87
  getMultipartRequestOptions: async <T extends {} = Record<string, unknown>>(
76
88
  // @ts-ignore
77
89
  form: FormData,
@@ -79,4 +79,5 @@ export declare class FsReadStream extends Readable {
79
79
  }
80
80
 
81
81
  type _ReadableStream<R = any> = ReadableStream<R>;
82
- export { type _ReadableStream as ReadableStream };
82
+ declare const _ReadableStream: typeof ReadableStream;
83
+ export { _ReadableStream as ReadableStream };
package/src/core.ts CHANGED
@@ -1052,16 +1052,33 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
1052
1052
  return typeof headers?.get === 'function';
1053
1053
  };
1054
1054
 
1055
- export const getHeader = (headers: HeadersLike, key: string): string | null | undefined => {
1056
- const lowerKey = key.toLowerCase();
1057
- if (isHeadersProtocol(headers)) return headers.get(key) || headers.get(lowerKey);
1058
- const value = headers[key] || headers[lowerKey];
1059
- if (Array.isArray(value)) {
1060
- if (value.length <= 1) return value[0];
1061
- console.warn(`Received ${value.length} entries for the ${key} header, using the first entry.`);
1062
- return value[0];
1055
+ export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
1056
+ const lowerCasedHeader = header.toLowerCase();
1057
+ if (isHeadersProtocol(headers)) {
1058
+ // to deal with the case where the header looks like Stainless-Event-Id
1059
+ const intercapsHeader =
1060
+ header[0]?.toUpperCase() +
1061
+ header.substring(1).replace(/([^\w])(\w)/g, (_m, g1, g2) => g1 + g2.toUpperCase());
1062
+ for (const key of [header, lowerCasedHeader, header.toUpperCase(), intercapsHeader]) {
1063
+ const value = headers.get(key);
1064
+ if (value) {
1065
+ return value;
1066
+ }
1067
+ }
1063
1068
  }
1064
- return value;
1069
+
1070
+ for (const [key, value] of Object.entries(headers)) {
1071
+ if (key.toLowerCase() === lowerCasedHeader) {
1072
+ if (Array.isArray(value)) {
1073
+ if (value.length <= 1) return value[0];
1074
+ console.warn(`Received ${value.length} entries for the ${header} header, using the first entry.`);
1075
+ return value[0];
1076
+ }
1077
+ return value;
1078
+ }
1079
+ }
1080
+
1081
+ throw new Error(`Could not find ${header} header`);
1065
1082
  };
1066
1083
 
1067
1084
  /**
package/src/error.ts CHANGED
@@ -15,20 +15,30 @@ export class APIError extends FinchError {
15
15
  message: string | undefined,
16
16
  headers: Headers | undefined,
17
17
  ) {
18
- super(`${status} ${APIError.makeMessage(error, message)}`);
18
+ super(`${APIError.makeMessage(status, error, message)}`);
19
19
  this.status = status;
20
20
  this.headers = headers;
21
21
  this.error = error;
22
22
  }
23
23
 
24
- private static makeMessage(error: any, message: string | undefined) {
25
- return (
24
+ private static makeMessage(status: number | undefined, error: any, message: string | undefined) {
25
+ const msg =
26
26
  error?.message ?
27
27
  typeof error.message === 'string' ? error.message
28
28
  : JSON.stringify(error.message)
29
29
  : error ? JSON.stringify(error)
30
- : message || 'status code (no body)'
31
- );
30
+ : message;
31
+
32
+ if (status && msg) {
33
+ return `${status} ${msg}`;
34
+ }
35
+ if (status) {
36
+ return `${status} status code (no body)`;
37
+ }
38
+ if (msg) {
39
+ return msg;
40
+ }
41
+ return '(no status code or body)';
32
42
  }
33
43
 
34
44
  static generate(
package/src/index.ts CHANGED
@@ -2,16 +2,28 @@
2
2
 
3
3
  import * as Core from './core';
4
4
  import * as Pagination from './pagination';
5
- import * as API from './resources/index';
6
5
  import * as Errors from './error';
7
6
  import { type Agent } from './_shims/index';
8
7
  import * as Uploads from './uploads';
8
+ import * as API from "./ch/finch-api/resources/index";
9
9
 
10
10
  export interface ClientOptions {
11
+ accessToken?: string | null;
12
+
11
13
  /**
12
- * Set it to null if you want to send unauthenticated requests.
14
+ * Defaults to process.env['FINCH_CLIENT_ID'].
13
15
  */
14
- accessToken?: string | null;
16
+ clientId?: string | null;
17
+
18
+ /**
19
+ * Defaults to process.env['FINCH_CLIENT_SECRET'].
20
+ */
21
+ clientSecret?: string | null;
22
+
23
+ /**
24
+ * Defaults to process.env['FINCH_WEBHOOK_SECRET'].
25
+ */
26
+ webhookSecret?: string | null;
15
27
 
16
28
  /**
17
29
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
@@ -66,27 +78,24 @@ export interface ClientOptions {
66
78
  * param to `undefined` in request options.
67
79
  */
68
80
  defaultQuery?: Core.DefaultQuery;
69
-
70
- clientId?: string | null;
71
-
72
- clientSecret?: string | null;
73
-
74
- webhookSecret?: string | null;
75
81
  }
76
82
 
77
83
  /** API Client for interfacing with the Finch API. */
78
84
  export class Finch extends Core.APIClient {
79
85
  accessToken: string | null;
80
- clientId?: string | null;
81
- clientSecret?: string | null;
82
- webhookSecret?: string | null;
86
+ clientId: string | null;
87
+ clientSecret: string | null;
88
+ webhookSecret: string | null;
83
89
 
84
90
  private _options: ClientOptions;
85
91
 
86
92
  /**
87
93
  * API Client for interfacing with the Finch API.
88
94
  *
89
- * @param {string | null} opts.accessToken - The Access Token to send to the API.
95
+ * @param {string | null} [opts.accessToken]
96
+ * @param {string | null} [opts.clientId==process.env['FINCH_CLIENT_ID'] ?? null]
97
+ * @param {string | null} [opts.clientSecret==process.env['FINCH_CLIENT_SECRET'] ?? null]
98
+ * @param {string | null} [opts.webhookSecret==process.env['FINCH_WEBHOOK_SECRET'] ?? null]
90
99
  * @param {string} [opts.baseURL] - Override the default base URL for the API.
91
100
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
92
101
  * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
@@ -94,9 +103,6 @@ export class Finch extends Core.APIClient {
94
103
  * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
95
104
  * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
96
105
  * @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
97
- * @param {string | null} [opts.clientId]
98
- * @param {string | null} [opts.clientSecret]
99
- * @param {string | null} [opts.webhookSecret]
100
106
  */
101
107
  constructor({
102
108
  accessToken = null,
package/src/pagination.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
3
  import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core';
4
- import * as HRIS from './resources/hris/index';
4
+ import * as DirectoryAPI from "./ch/finch-api/resources/hris/directory";
5
+ import * as HRISAPI from "./ch/finch-api/resources/hris/hris";
5
6
 
6
7
  export type SinglePageResponse<Item> = Item[];
7
8
 
@@ -77,9 +78,9 @@ export interface IndividualsPageResponse {
77
78
  /**
78
79
  * The array of employees.
79
80
  */
80
- individuals: Array<HRIS.IndividualInDirectory>;
81
+ individuals: Array<DirectoryAPI.IndividualInDirectory>;
81
82
 
82
- paging: HRIS.Paging;
83
+ paging: HRISAPI.Paging;
83
84
  }
84
85
 
85
86
  export interface IndividualsPageParams {
@@ -95,15 +96,15 @@ export interface IndividualsPageParams {
95
96
  }
96
97
 
97
98
  export class IndividualsPage
98
- extends AbstractPage<HRIS.IndividualInDirectory>
99
+ extends AbstractPage<DirectoryAPI.IndividualInDirectory>
99
100
  implements IndividualsPageResponse
100
101
  {
101
- paging: HRIS.Paging;
102
+ paging: HRISAPI.Paging;
102
103
 
103
104
  /**
104
105
  * The array of employees.
105
106
  */
106
- individuals: Array<HRIS.IndividualInDirectory>;
107
+ individuals: Array<DirectoryAPI.IndividualInDirectory>;
107
108
 
108
109
  constructor(
109
110
  client: APIClient,
@@ -117,7 +118,7 @@ export class IndividualsPage
117
118
  this.individuals = body.individuals;
118
119
  }
119
120
 
120
- getPaginatedItems(): HRIS.IndividualInDirectory[] {
121
+ getPaginatedItems(): DirectoryAPI.IndividualInDirectory[] {
121
122
  return this.individuals;
122
123
  }
123
124
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as Core from "../ch/finch-api/core";
4
4
  import { APIResource } from "../ch/finch-api/resource";
5
- import * as API from './index';
5
+ import * as AccountAPI from "../ch/finch-api/resources/account";
6
6
 
7
7
  export class Account extends APIResource {
8
8
  /**
@@ -64,6 +64,6 @@ export interface Introspection {
64
64
  }
65
65
 
66
66
  export namespace Account {
67
- export import DisconnectResponse = API.DisconnectResponse;
68
- export import Introspection = API.Introspection;
67
+ export import DisconnectResponse = AccountAPI.DisconnectResponse;
68
+ export import Introspection = AccountAPI.Introspection;
69
69
  }
@@ -3,12 +3,12 @@
3
3
  import * as Core from "../../../ch/finch-api/core";
4
4
  import { APIResource } from "../../../ch/finch-api/resource";
5
5
  import { isRequestOptions } from "../../../ch/finch-api/core";
6
- import { Individuals } from './individuals';
7
- import * as API from './index';
6
+ import * as BenefitsAPI from "../../../ch/finch-api/resources/hris/benefits/benefits";
7
+ import * as IndividualsAPI from "../../../ch/finch-api/resources/hris/benefits/individuals";
8
8
  import { SinglePage } from "../../../ch/finch-api/pagination";
9
9
 
10
10
  export class Benefits extends APIResource {
11
- individuals: Individuals = new Individuals(this.client);
11
+ individuals: IndividualsAPI.Individuals = new IndividualsAPI.Individuals(this.client);
12
12
 
13
13
  /**
14
14
  * **Availability: Automated and Assisted Benefits providers**
@@ -85,12 +85,20 @@ export class Benefits extends APIResource {
85
85
  }
86
86
 
87
87
  export class CompanyBenefitsSinglePage extends SinglePage<CompanyBenefit> {}
88
- // alias so we can export it in the namespace
89
- type _CompanyBenefitsSinglePage = CompanyBenefitsSinglePage;
90
88
 
91
89
  export class SupportedBenefitsSinglePage extends SinglePage<SupportedBenefit> {}
92
- // alias so we can export it in the namespace
93
- type _SupportedBenefitsSinglePage = SupportedBenefitsSinglePage;
90
+
91
+ export interface BenefitContribution {
92
+ /**
93
+ * Contribution amount in cents (if `fixed`) or basis points (if `percent`).
94
+ */
95
+ amount?: number | null;
96
+
97
+ /**
98
+ * Contribution type.
99
+ */
100
+ type?: 'fixed' | 'percent' | null;
101
+ }
94
102
 
95
103
  export type BenefitFrequency = 'one_time' | 'every_paycheck' | null;
96
104
 
@@ -119,26 +127,19 @@ export type BenefitType =
119
127
  | 'custom_pre_tax'
120
128
  | null;
121
129
 
122
- export interface BenfitContribution {
123
- /**
124
- * Contribution amount in cents (if `fixed`) or basis points (if `percent`).
125
- */
126
- amount?: number | null;
127
-
128
- /**
129
- * Contribution type.
130
- */
131
- type?: 'fixed' | 'percent' | null;
132
- }
130
+ /**
131
+ * @deprecated use `BenefitContribution` instead
132
+ */
133
+ export type BenfitContribution = BenefitContribution | null;
133
134
 
134
135
  export interface CompanyBenefit {
135
136
  benefit_id: string;
136
137
 
137
- company_contribution: BenfitContribution | null;
138
+ company_contribution: BenefitContribution | null;
138
139
 
139
140
  description: string | null;
140
141
 
141
- employee_deduction: BenfitContribution | null;
142
+ employee_deduction: BenefitContribution | null;
142
143
 
143
144
  frequency: BenefitFrequency | null;
144
145
 
@@ -218,27 +219,30 @@ export interface BenefitUpdateParams {
218
219
  }
219
220
 
220
221
  export namespace Benefits {
221
- export import BenefitFrequency = API.BenefitFrequency;
222
- export import BenefitType = API.BenefitType;
223
- export import BenfitContribution = API.BenfitContribution;
224
- export import CompanyBenefit = API.CompanyBenefit;
225
- export import CreateCompanyBenefitsResponse = API.CreateCompanyBenefitsResponse;
226
- export import SupportedBenefit = API.SupportedBenefit;
227
- export import UpdateCompanyBenefitResponse = API.UpdateCompanyBenefitResponse;
228
- export type CompanyBenefitsSinglePage = _CompanyBenefitsSinglePage;
229
- export type SupportedBenefitsSinglePage = _SupportedBenefitsSinglePage;
230
- export import BenefitCreateParams = API.BenefitCreateParams;
231
- export import BenefitUpdateParams = API.BenefitUpdateParams;
232
-
233
- export import Individuals = API.Individuals;
234
- export import EnrolledIndividual = API.EnrolledIndividual;
235
- export import IndividualBenefit = API.IndividualBenefit;
236
- export import UnenrolledIndividual = API.UnenrolledIndividual;
237
- export import IndividualEnrolledIDsResponse = API.IndividualEnrolledIDsResponse;
238
- export import EnrolledIndividualsSinglePage = API.EnrolledIndividualsSinglePage;
239
- export import IndividualBenefitsSinglePage = API.IndividualBenefitsSinglePage;
240
- export import UnenrolledIndividualsSinglePage = API.UnenrolledIndividualsSinglePage;
241
- export import IndividualEnrollManyParams = API.IndividualEnrollManyParams;
242
- export import IndividualRetrieveManyBenefitsParams = API.IndividualRetrieveManyBenefitsParams;
243
- export import IndividualUnenrollManyParams = API.IndividualUnenrollManyParams;
222
+ export import BenefitContribution = BenefitsAPI.BenefitContribution;
223
+ export import BenefitFrequency = BenefitsAPI.BenefitFrequency;
224
+ export import BenefitType = BenefitsAPI.BenefitType;
225
+ /**
226
+ * @deprecated use `BenefitContribution` instead
227
+ */
228
+ export import BenfitContribution = BenefitsAPI.BenfitContribution;
229
+ export import CompanyBenefit = BenefitsAPI.CompanyBenefit;
230
+ export import CreateCompanyBenefitsResponse = BenefitsAPI.CreateCompanyBenefitsResponse;
231
+ export import SupportedBenefit = BenefitsAPI.SupportedBenefit;
232
+ export import UpdateCompanyBenefitResponse = BenefitsAPI.UpdateCompanyBenefitResponse;
233
+ export import CompanyBenefitsSinglePage = BenefitsAPI.CompanyBenefitsSinglePage;
234
+ export import SupportedBenefitsSinglePage = BenefitsAPI.SupportedBenefitsSinglePage;
235
+ export import BenefitCreateParams = BenefitsAPI.BenefitCreateParams;
236
+ export import BenefitUpdateParams = BenefitsAPI.BenefitUpdateParams;
237
+ export import Individuals = IndividualsAPI.Individuals;
238
+ export import EnrolledIndividual = IndividualsAPI.EnrolledIndividual;
239
+ export import IndividualBenefit = IndividualsAPI.IndividualBenefit;
240
+ export import UnenrolledIndividual = IndividualsAPI.UnenrolledIndividual;
241
+ export import IndividualEnrolledIDsResponse = IndividualsAPI.IndividualEnrolledIDsResponse;
242
+ export import EnrolledIndividualsSinglePage = IndividualsAPI.EnrolledIndividualsSinglePage;
243
+ export import IndividualBenefitsSinglePage = IndividualsAPI.IndividualBenefitsSinglePage;
244
+ export import UnenrolledIndividualsSinglePage = IndividualsAPI.UnenrolledIndividualsSinglePage;
245
+ export import IndividualEnrollManyParams = IndividualsAPI.IndividualEnrollManyParams;
246
+ export import IndividualRetrieveManyBenefitsParams = IndividualsAPI.IndividualRetrieveManyBenefitsParams;
247
+ export import IndividualUnenrollManyParams = IndividualsAPI.IndividualUnenrollManyParams;
244
248
  }
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
3
  export {
4
+ BenefitContribution,
4
5
  BenefitFrequency,
5
6
  BenefitType,
6
7
  BenfitContribution,
@@ -3,8 +3,8 @@
3
3
  import * as Core from "../../../ch/finch-api/core";
4
4
  import { APIResource } from "../../../ch/finch-api/resource";
5
5
  import { isRequestOptions } from "../../../ch/finch-api/core";
6
- import * as Benefits from "../../../ch/finch-api/resources/hris/benefits/index";
7
- import * as API from './index';
6
+ import * as IndividualsAPI from "../../../ch/finch-api/resources/hris/benefits/individuals";
7
+ import * as BenefitsAPI from "../../../ch/finch-api/resources/hris/benefits/benefits";
8
8
  import { SinglePage } from "../../../ch/finch-api/pagination";
9
9
 
10
10
  export class Individuals extends APIResource {
@@ -103,16 +103,10 @@ export class Individuals extends APIResource {
103
103
  }
104
104
 
105
105
  export class EnrolledIndividualsSinglePage extends SinglePage<EnrolledIndividual> {}
106
- // alias so we can export it in the namespace
107
- type _EnrolledIndividualsSinglePage = EnrolledIndividualsSinglePage;
108
106
 
109
107
  export class IndividualBenefitsSinglePage extends SinglePage<IndividualBenefit> {}
110
- // alias so we can export it in the namespace
111
- type _IndividualBenefitsSinglePage = IndividualBenefitsSinglePage;
112
108
 
113
109
  export class UnenrolledIndividualsSinglePage extends SinglePage<UnenrolledIndividual> {}
114
- // alias so we can export it in the namespace
115
- type _UnenrolledIndividualsSinglePage = UnenrolledIndividualsSinglePage;
116
110
 
117
111
  export interface EnrolledIndividual {
118
112
  body?: EnrolledIndividual.Body;
@@ -165,9 +159,9 @@ export namespace IndividualBenefit {
165
159
  */
166
160
  catch_up?: boolean | null;
167
161
 
168
- company_contribution?: Benefits.BenfitContribution | null;
162
+ company_contribution?: BenefitsAPI.BenefitContribution | null;
169
163
 
170
- employee_deduction?: Benefits.BenfitContribution | null;
164
+ employee_deduction?: BenefitsAPI.BenefitContribution | null;
171
165
 
172
166
  /**
173
167
  * Type for HSA contribution limit if the benefit is a HSA.
@@ -241,14 +235,14 @@ export interface IndividualUnenrollManyParams {
241
235
  }
242
236
 
243
237
  export namespace Individuals {
244
- export import EnrolledIndividual = API.EnrolledIndividual;
245
- export import IndividualBenefit = API.IndividualBenefit;
246
- export import UnenrolledIndividual = API.UnenrolledIndividual;
247
- export import IndividualEnrolledIDsResponse = API.IndividualEnrolledIDsResponse;
248
- export type EnrolledIndividualsSinglePage = _EnrolledIndividualsSinglePage;
249
- export type IndividualBenefitsSinglePage = _IndividualBenefitsSinglePage;
250
- export type UnenrolledIndividualsSinglePage = _UnenrolledIndividualsSinglePage;
251
- export import IndividualEnrollManyParams = API.IndividualEnrollManyParams;
252
- export import IndividualRetrieveManyBenefitsParams = API.IndividualRetrieveManyBenefitsParams;
253
- export import IndividualUnenrollManyParams = API.IndividualUnenrollManyParams;
238
+ export import EnrolledIndividual = IndividualsAPI.EnrolledIndividual;
239
+ export import IndividualBenefit = IndividualsAPI.IndividualBenefit;
240
+ export import UnenrolledIndividual = IndividualsAPI.UnenrolledIndividual;
241
+ export import IndividualEnrolledIDsResponse = IndividualsAPI.IndividualEnrolledIDsResponse;
242
+ export import EnrolledIndividualsSinglePage = IndividualsAPI.EnrolledIndividualsSinglePage;
243
+ export import IndividualBenefitsSinglePage = IndividualsAPI.IndividualBenefitsSinglePage;
244
+ export import UnenrolledIndividualsSinglePage = IndividualsAPI.UnenrolledIndividualsSinglePage;
245
+ export import IndividualEnrollManyParams = IndividualsAPI.IndividualEnrollManyParams;
246
+ export import IndividualRetrieveManyBenefitsParams = IndividualsAPI.IndividualRetrieveManyBenefitsParams;
247
+ export import IndividualUnenrollManyParams = IndividualsAPI.IndividualUnenrollManyParams;
254
248
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  import * as Core from "../../ch/finch-api/core";
4
4
  import { APIResource } from "../../ch/finch-api/resource";
5
- import * as HRIS from "../../ch/finch-api/resources/hris/index";
6
- import * as API from './index';
5
+ import * as CompanyAPI from "../../ch/finch-api/resources/hris/company";
6
+ import * as HRISAPI from "../../ch/finch-api/resources/hris/hris";
7
7
 
8
8
  export class CompanyResource extends APIResource {
9
9
  /**
@@ -45,7 +45,7 @@ export interface Company {
45
45
  */
46
46
  legal_name: string | null;
47
47
 
48
- locations: Array<HRIS.Location | null> | null;
48
+ locations: Array<HRISAPI.Location | null> | null;
49
49
 
50
50
  /**
51
51
  * The email of the main administrator on the account.
@@ -128,5 +128,5 @@ export namespace Company {
128
128
  }
129
129
 
130
130
  export namespace CompanyResource {
131
- export import Company = API.Company;
131
+ export import Company = CompanyAPI.Company;
132
132
  }
@@ -3,27 +3,32 @@
3
3
  import * as Core from "../../ch/finch-api/core";
4
4
  import { APIResource } from "../../ch/finch-api/resource";
5
5
  import { isRequestOptions } from "../../ch/finch-api/core";
6
- import * as API from './index';
7
- import { IndividualsPage, IndividualsPageParams } from "../../ch/finch-api/pagination";
6
+ import * as DirectoryAPI from "../../ch/finch-api/resources/hris/directory";
7
+ import { IndividualsPage, type IndividualsPageParams } from "../../ch/finch-api/pagination";
8
8
 
9
9
  export class Directory extends APIResource {
10
10
  /**
11
11
  * Read company directory and organization structure
12
12
  */
13
- listIndividuals(
14
- query?: DirectoryListIndividualsParams,
13
+ list(
14
+ query?: DirectoryListParams,
15
15
  options?: Core.RequestOptions,
16
16
  ): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
17
- listIndividuals(options?: Core.RequestOptions): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
18
- listIndividuals(
19
- query: DirectoryListIndividualsParams | Core.RequestOptions = {},
17
+ list(options?: Core.RequestOptions): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
18
+ list(
19
+ query: DirectoryListParams | Core.RequestOptions = {},
20
20
  options?: Core.RequestOptions,
21
21
  ): Core.PagePromise<IndividualsPage, IndividualInDirectory> {
22
22
  if (isRequestOptions(query)) {
23
- return this.listIndividuals({}, query);
23
+ return this.list({}, query);
24
24
  }
25
25
  return this.getAPIList('/employer/directory', IndividualsPage, { query, ...options });
26
26
  }
27
+
28
+ /**
29
+ * @deprecated use `list` instead
30
+ */
31
+ listIndividuals = this.list;
27
32
  }
28
33
 
29
34
  export interface IndividualInDirectory {
@@ -85,9 +90,12 @@ export namespace IndividualInDirectory {
85
90
  }
86
91
  }
87
92
 
93
+ export interface DirectoryListParams extends IndividualsPageParams {}
94
+
88
95
  export interface DirectoryListIndividualsParams extends IndividualsPageParams {}
89
96
 
90
97
  export namespace Directory {
91
- export import IndividualInDirectory = API.IndividualInDirectory;
92
- export import DirectoryListIndividualsParams = API.DirectoryListIndividualsParams;
98
+ export import IndividualInDirectory = DirectoryAPI.IndividualInDirectory;
99
+ export import DirectoryListParams = DirectoryAPI.DirectoryListParams;
100
+ export import DirectoryListIndividualsParams = DirectoryAPI.DirectoryListIndividualsParams;
93
101
  }