@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.
- package/CHANGELOG.md +41 -0
- package/README.md +16 -19
- package/_shims/auto/types.d.ts +3 -1
- package/_shims/index.d.ts +2 -0
- package/_shims/node-runtime.d.ts.map +1 -1
- package/_shims/node-runtime.js +5 -2
- package/_shims/node-runtime.js.map +1 -1
- package/_shims/node-runtime.mjs +4 -2
- package/_shims/node-runtime.mjs.map +1 -1
- package/_shims/node-types.d.ts +1 -1
- package/_shims/registry.d.ts +2 -0
- package/_shims/registry.d.ts.map +1 -1
- package/_shims/registry.js +3 -1
- package/_shims/registry.js.map +1 -1
- package/_shims/registry.mjs +2 -0
- package/_shims/registry.mjs.map +1 -1
- package/_shims/web-runtime.d.ts.map +1 -1
- package/_shims/web-runtime.js +8 -0
- package/_shims/web-runtime.js.map +1 -1
- package/_shims/web-runtime.mjs +8 -0
- package/_shims/web-runtime.mjs.map +1 -1
- package/_shims/web-types.d.ts +2 -1
- package/core.d.ts +1 -1
- package/core.d.ts.map +1 -1
- package/core.js +43 -34
- package/core.js.map +1 -1
- package/core.mjs +41 -32
- package/core.mjs.map +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +15 -5
- package/error.js.map +1 -1
- package/error.mjs +15 -5
- package/error.mjs.map +1 -1
- package/index.d.mts +19 -13
- package/index.d.ts +19 -13
- package/index.d.ts.map +1 -1
- package/index.js +8 -10
- package/index.js.map +1 -1
- package/index.mjs +8 -10
- package/index.mjs.map +1 -1
- package/package.json +4 -2
- package/pagination.d.ts +8 -7
- package/pagination.d.ts.map +1 -1
- package/pagination.js.map +1 -1
- package/pagination.mjs.map +1 -1
- package/resources/account.d.ts +3 -3
- package/resources/account.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.d.ts +41 -36
- package/resources/hris/benefits/benefits.d.ts.map +1 -1
- package/resources/hris/benefits/benefits.js +9 -7
- package/resources/hris/benefits/benefits.js.map +1 -1
- package/resources/hris/benefits/benefits.mjs +9 -7
- package/resources/hris/benefits/benefits.mjs.map +1 -1
- package/resources/hris/benefits/index.d.ts +1 -1
- package/resources/hris/benefits/index.d.ts.map +1 -1
- package/resources/hris/benefits/index.js.map +1 -1
- package/resources/hris/benefits/index.mjs.map +1 -1
- package/resources/hris/benefits/individuals.d.ts +14 -18
- package/resources/hris/benefits/individuals.d.ts.map +1 -1
- package/resources/hris/benefits/individuals.js +27 -0
- package/resources/hris/benefits/individuals.js.map +1 -1
- package/resources/hris/benefits/individuals.mjs +4 -0
- package/resources/hris/benefits/individuals.mjs.map +1 -1
- package/resources/hris/company.d.ts +4 -4
- package/resources/hris/company.d.ts.map +1 -1
- package/resources/hris/directory.d.ts +16 -6
- package/resources/hris/directory.d.ts.map +1 -1
- package/resources/hris/directory.js +9 -2
- package/resources/hris/directory.js.map +1 -1
- package/resources/hris/directory.mjs +9 -2
- package/resources/hris/directory.mjs.map +1 -1
- package/resources/hris/employments.d.ts +9 -11
- package/resources/hris/employments.d.ts.map +1 -1
- package/resources/hris/employments.js +25 -0
- package/resources/hris/employments.js.map +1 -1
- package/resources/hris/employments.mjs +2 -0
- package/resources/hris/employments.mjs.map +1 -1
- package/resources/hris/hris.d.ts +61 -56
- package/resources/hris/hris.d.ts.map +1 -1
- package/resources/hris/hris.js +27 -28
- package/resources/hris/hris.js.map +1 -1
- package/resources/hris/hris.mjs +27 -28
- package/resources/hris/hris.mjs.map +1 -1
- package/resources/hris/index.d.ts +2 -2
- package/resources/hris/index.d.ts.map +1 -1
- package/resources/hris/index.js.map +1 -1
- package/resources/hris/index.mjs +1 -1
- package/resources/hris/index.mjs.map +1 -1
- package/resources/hris/individuals.d.ts +7 -9
- package/resources/hris/individuals.d.ts.map +1 -1
- package/resources/hris/individuals.js +25 -0
- package/resources/hris/individuals.js.map +1 -1
- package/resources/hris/individuals.mjs +2 -0
- package/resources/hris/individuals.mjs.map +1 -1
- package/resources/hris/pay-statements.d.ts +13 -15
- package/resources/hris/pay-statements.d.ts.map +1 -1
- package/resources/hris/pay-statements.js +25 -0
- package/resources/hris/pay-statements.js.map +1 -1
- package/resources/hris/pay-statements.mjs +2 -0
- package/resources/hris/pay-statements.mjs.map +1 -1
- package/resources/hris/payments.d.ts +10 -12
- package/resources/hris/payments.d.ts.map +1 -1
- package/resources/hris/payments.js +25 -0
- package/resources/hris/payments.js.map +1 -1
- package/resources/hris/payments.mjs +2 -0
- package/resources/hris/payments.mjs.map +1 -1
- package/resources/providers.d.ts +3 -5
- package/resources/providers.d.ts.map +1 -1
- package/resources/providers.js +25 -0
- package/resources/providers.js.map +1 -1
- package/resources/providers.mjs +2 -0
- package/resources/providers.mjs.map +1 -1
- package/resources/request-forwarding.d.ts +3 -3
- package/resources/request-forwarding.d.ts.map +1 -1
- package/resources/webhooks.d.ts.map +1 -1
- package/resources/webhooks.js +3 -12
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +4 -13
- package/resources/webhooks.mjs.map +1 -1
- package/shims/node.d.ts +1 -1
- package/shims/node.d.ts.map +1 -1
- package/shims/web.d.ts +1 -1
- package/shims/web.d.ts.map +1 -1
- package/src/_shims/auto/types.d.ts +3 -1
- package/src/_shims/index.d.ts +2 -0
- package/src/_shims/node-runtime.ts +6 -2
- package/src/_shims/node-types.d.ts +1 -1
- package/src/_shims/registry.ts +3 -0
- package/src/_shims/web-runtime.ts +12 -0
- package/src/_shims/web-types.d.ts +2 -1
- package/src/core.ts +26 -9
- package/src/error.ts +15 -5
- package/src/index.ts +22 -16
- package/src/pagination.ts +8 -7
- package/src/resources/account.ts +3 -3
- package/src/resources/hris/benefits/benefits.ts +47 -43
- package/src/resources/hris/benefits/index.ts +1 -0
- package/src/resources/hris/benefits/individuals.ts +14 -20
- package/src/resources/hris/company.ts +4 -4
- package/src/resources/hris/directory.ts +18 -10
- package/src/resources/hris/employments.ts +9 -11
- package/src/resources/hris/hris.ts +61 -63
- package/src/resources/hris/index.ts +7 -1
- package/src/resources/hris/individuals.ts +7 -9
- package/src/resources/hris/pay-statements.ts +13 -15
- package/src/resources/hris/payments.ts +10 -12
- package/src/resources/providers.ts +3 -5
- package/src/resources/request-forwarding.ts +3 -3
- package/src/resources/webhooks.ts +4 -15
- package/src/shims/node.ts +1 -1
- package/src/shims/web.ts +1 -1
- package/src/version.ts +1 -1
- package/uploads.js +5 -9
- package/uploads.js.map +1 -1
- package/uploads.mjs +5 -9
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/_shims/index.d.ts
CHANGED
|
@@ -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-
|
|
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 {
|
|
10
|
+
export { ReadableStream } from 'web-streams-polyfill';
|
|
11
11
|
|
|
12
12
|
export const fetch: typeof nf.default;
|
|
13
13
|
|
package/src/_shims/registry.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
1056
|
-
const
|
|
1057
|
-
if (isHeadersProtocol(headers))
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
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
|
-
|
|
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(`${
|
|
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
|
-
|
|
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
|
|
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
|
-
*
|
|
14
|
+
* Defaults to process.env['FINCH_CLIENT_ID'].
|
|
13
15
|
*/
|
|
14
|
-
|
|
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
|
|
81
|
-
clientSecret
|
|
82
|
-
webhookSecret
|
|
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
|
|
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
|
|
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<
|
|
81
|
+
individuals: Array<DirectoryAPI.IndividualInDirectory>;
|
|
81
82
|
|
|
82
|
-
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<
|
|
99
|
+
extends AbstractPage<DirectoryAPI.IndividualInDirectory>
|
|
99
100
|
implements IndividualsPageResponse
|
|
100
101
|
{
|
|
101
|
-
paging:
|
|
102
|
+
paging: HRISAPI.Paging;
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
105
|
* The array of employees.
|
|
105
106
|
*/
|
|
106
|
-
individuals: Array<
|
|
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():
|
|
121
|
+
getPaginatedItems(): DirectoryAPI.IndividualInDirectory[] {
|
|
121
122
|
return this.individuals;
|
|
122
123
|
}
|
|
123
124
|
|
package/src/resources/account.ts
CHANGED
|
@@ -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
|
|
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 =
|
|
68
|
-
export import 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
|
|
7
|
-
import * as
|
|
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
|
-
|
|
93
|
-
|
|
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
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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:
|
|
138
|
+
company_contribution: BenefitContribution | null;
|
|
138
139
|
|
|
139
140
|
description: string | null;
|
|
140
141
|
|
|
141
|
-
employee_deduction:
|
|
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
|
|
222
|
-
export import
|
|
223
|
-
export import
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
export import
|
|
228
|
-
export
|
|
229
|
-
export
|
|
230
|
-
export import
|
|
231
|
-
export import
|
|
232
|
-
|
|
233
|
-
export import
|
|
234
|
-
export import
|
|
235
|
-
export import
|
|
236
|
-
export import
|
|
237
|
-
export import
|
|
238
|
-
export import
|
|
239
|
-
export import
|
|
240
|
-
export import
|
|
241
|
-
export import
|
|
242
|
-
export import
|
|
243
|
-
export import
|
|
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
|
}
|
|
@@ -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
|
|
7
|
-
import * as
|
|
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?:
|
|
162
|
+
company_contribution?: BenefitsAPI.BenefitContribution | null;
|
|
169
163
|
|
|
170
|
-
employee_deduction?:
|
|
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 =
|
|
245
|
-
export import IndividualBenefit =
|
|
246
|
-
export import UnenrolledIndividual =
|
|
247
|
-
export import IndividualEnrolledIDsResponse =
|
|
248
|
-
export
|
|
249
|
-
export
|
|
250
|
-
export
|
|
251
|
-
export import IndividualEnrollManyParams =
|
|
252
|
-
export import IndividualRetrieveManyBenefitsParams =
|
|
253
|
-
export import 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
|
|
6
|
-
import * as
|
|
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<
|
|
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 =
|
|
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
|
|
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
|
-
|
|
14
|
-
query?:
|
|
13
|
+
list(
|
|
14
|
+
query?: DirectoryListParams,
|
|
15
15
|
options?: Core.RequestOptions,
|
|
16
16
|
): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
query:
|
|
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.
|
|
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 =
|
|
92
|
-
export import
|
|
98
|
+
export import IndividualInDirectory = DirectoryAPI.IndividualInDirectory;
|
|
99
|
+
export import DirectoryListParams = DirectoryAPI.DirectoryListParams;
|
|
100
|
+
export import DirectoryListIndividualsParams = DirectoryAPI.DirectoryListIndividualsParams;
|
|
93
101
|
}
|