@tryfinch/finch-api 5.14.2 → 5.15.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 +35 -0
- package/LICENSE +1 -1
- package/README.md +6 -3
- package/_shims/index.d.ts +1 -1
- package/_shims/registry.d.ts +1 -1
- package/_shims/registry.d.ts.map +1 -1
- package/core.d.ts +12 -12
- package/core.d.ts.map +1 -1
- package/core.js +39 -13
- package/core.js.map +1 -1
- package/core.mjs +39 -13
- package/core.mjs.map +1 -1
- package/index.d.mts +15 -0
- package/index.d.ts +15 -0
- package/index.d.ts.map +1 -1
- package/index.js +15 -2
- package/index.js.map +1 -1
- package/index.mjs +15 -2
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/access-tokens.d.ts +23 -0
- package/resources/access-tokens.d.ts.map +1 -0
- package/resources/access-tokens.js +17 -0
- package/resources/access-tokens.js.map +1 -0
- package/resources/access-tokens.mjs +13 -0
- package/resources/access-tokens.mjs.map +1 -0
- package/resources/account.d.ts +14 -0
- package/resources/account.d.ts.map +1 -1
- package/resources/account.js.map +1 -1
- package/resources/account.mjs.map +1 -1
- package/resources/auth.d.ts +20 -0
- package/resources/auth.d.ts.map +1 -0
- package/resources/auth.js +17 -0
- package/resources/auth.js.map +1 -0
- package/resources/auth.mjs +13 -0
- package/resources/auth.mjs.map +1 -0
- package/resources/index.d.ts +3 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -0
- package/resources/index.mjs.map +1 -1
- package/resources/sandbox/company.d.ts +195 -0
- package/resources/sandbox/company.d.ts.map +1 -0
- package/resources/sandbox/company.js +17 -0
- package/resources/sandbox/company.js.map +1 -0
- package/resources/sandbox/company.mjs +13 -0
- package/resources/sandbox/company.mjs.map +1 -0
- package/resources/sandbox/connections/accounts.d.ts +51 -0
- package/resources/sandbox/connections/accounts.d.ts.map +1 -0
- package/resources/sandbox/connections/accounts.js +24 -0
- package/resources/sandbox/connections/accounts.js.map +1 -0
- package/resources/sandbox/connections/accounts.mjs +20 -0
- package/resources/sandbox/connections/accounts.mjs.map +1 -0
- package/resources/sandbox/connections/connections.d.ts +39 -0
- package/resources/sandbox/connections/connections.d.ts.map +1 -0
- package/resources/sandbox/connections/connections.js +46 -0
- package/resources/sandbox/connections/connections.js.map +1 -0
- package/resources/sandbox/connections/connections.mjs +19 -0
- package/resources/sandbox/connections/connections.mjs.map +1 -0
- package/resources/sandbox/connections/index.d.ts +3 -0
- package/resources/sandbox/connections/index.d.ts.map +1 -0
- package/resources/sandbox/connections/index.js +9 -0
- package/resources/sandbox/connections/index.js.map +1 -0
- package/resources/sandbox/connections/index.mjs +4 -0
- package/resources/sandbox/connections/index.mjs.map +1 -0
- package/resources/sandbox/directory.d.ts +156 -0
- package/resources/sandbox/directory.d.ts.map +1 -0
- package/resources/sandbox/directory.js +17 -0
- package/resources/sandbox/directory.js.map +1 -0
- package/resources/sandbox/directory.mjs +13 -0
- package/resources/sandbox/directory.mjs.map +1 -0
- package/resources/sandbox/employment.d.ts +216 -0
- package/resources/sandbox/employment.d.ts.map +1 -0
- package/resources/sandbox/employment.js +18 -0
- package/resources/sandbox/employment.js.map +1 -0
- package/resources/sandbox/employment.mjs +14 -0
- package/resources/sandbox/employment.mjs.map +1 -0
- package/resources/sandbox/index.d.ts +9 -0
- package/resources/sandbox/index.d.ts.map +1 -0
- package/resources/sandbox/index.js +21 -0
- package/resources/sandbox/index.js.map +1 -0
- package/resources/sandbox/index.mjs +10 -0
- package/resources/sandbox/index.mjs.map +1 -0
- package/resources/sandbox/individual.d.ts +124 -0
- package/resources/sandbox/individual.d.ts.map +1 -0
- package/resources/sandbox/individual.js +18 -0
- package/resources/sandbox/individual.js.map +1 -0
- package/resources/sandbox/individual.mjs +14 -0
- package/resources/sandbox/individual.mjs.map +1 -0
- package/resources/sandbox/jobs/configuration.d.ts +28 -0
- package/resources/sandbox/jobs/configuration.d.ts.map +1 -0
- package/resources/sandbox/jobs/configuration.js +23 -0
- package/resources/sandbox/jobs/configuration.js.map +1 -0
- package/resources/sandbox/jobs/configuration.mjs +19 -0
- package/resources/sandbox/jobs/configuration.mjs.map +1 -0
- package/resources/sandbox/jobs/index.d.ts +3 -0
- package/resources/sandbox/jobs/index.d.ts.map +1 -0
- package/resources/sandbox/jobs/index.js +9 -0
- package/resources/sandbox/jobs/index.js.map +1 -0
- package/resources/sandbox/jobs/index.mjs +4 -0
- package/resources/sandbox/jobs/index.mjs.map +1 -0
- package/resources/sandbox/jobs/jobs.d.ts +12 -0
- package/resources/sandbox/jobs/jobs.d.ts.map +1 -0
- package/resources/sandbox/jobs/jobs.js +40 -0
- package/resources/sandbox/jobs/jobs.js.map +1 -0
- package/resources/sandbox/jobs/jobs.mjs +13 -0
- package/resources/sandbox/jobs/jobs.mjs.map +1 -0
- package/resources/sandbox/payment.d.ts +154 -0
- package/resources/sandbox/payment.d.ts.map +1 -0
- package/resources/sandbox/payment.js +18 -0
- package/resources/sandbox/payment.js.map +1 -0
- package/resources/sandbox/payment.mjs +14 -0
- package/resources/sandbox/payment.mjs.map +1 -0
- package/resources/sandbox/sandbox.d.ts +39 -0
- package/resources/sandbox/sandbox.d.ts.map +1 -0
- package/resources/sandbox/sandbox.js +58 -0
- package/resources/sandbox/sandbox.js.map +1 -0
- package/resources/sandbox/sandbox.mjs +31 -0
- package/resources/sandbox/sandbox.mjs.map +1 -0
- package/resources/shared.d.ts +1 -0
- package/resources/shared.d.ts.map +1 -1
- package/src/_shims/index.d.ts +1 -1
- package/src/_shims/node-runtime.ts +1 -1
- package/src/_shims/registry.ts +1 -1
- package/src/_shims/web-runtime.ts +1 -1
- package/src/core.ts +65 -30
- package/src/index.ts +23 -2
- package/src/lib/.keep +4 -0
- package/src/resources/access-tokens.ts +36 -0
- package/src/resources/account.ts +19 -0
- package/src/resources/auth.ts +32 -0
- package/src/resources/index.ts +3 -0
- package/src/resources/sandbox/company.ts +252 -0
- package/src/resources/sandbox/connections/accounts.ts +83 -0
- package/src/resources/sandbox/connections/connections.ts +58 -0
- package/src/resources/sandbox/connections/index.ts +10 -0
- package/src/resources/sandbox/directory.ts +210 -0
- package/src/resources/sandbox/employment.ts +279 -0
- package/src/resources/sandbox/index.ts +10 -0
- package/src/resources/sandbox/individual.ts +193 -0
- package/src/resources/sandbox/jobs/configuration.ts +44 -0
- package/src/resources/sandbox/jobs/index.ts +9 -0
- package/src/resources/sandbox/jobs/jobs.ts +15 -0
- package/src/resources/sandbox/payment.ts +215 -0
- package/src/resources/sandbox/sandbox.ts +42 -0
- package/src/resources/shared.ts +8 -0
- package/src/uploads.ts +2 -2
- package/src/version.ts +1 -1
- package/uploads.d.ts +2 -2
- package/uploads.d.ts.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/_shims/registry.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface Shims {
|
|
|
13
13
|
Blob: any;
|
|
14
14
|
File: any;
|
|
15
15
|
ReadableStream: any;
|
|
16
|
-
getMultipartRequestOptions: <T
|
|
16
|
+
getMultipartRequestOptions: <T = Record<string, unknown>>(
|
|
17
17
|
form: Shims['FormData'],
|
|
18
18
|
opts: RequestOptions<T>,
|
|
19
19
|
) => Promise<RequestOptions<T>>;
|
|
@@ -84,7 +84,7 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
),
|
|
87
|
-
getMultipartRequestOptions: async <T
|
|
87
|
+
getMultipartRequestOptions: async <T = Record<string, unknown>>(
|
|
88
88
|
// @ts-ignore
|
|
89
89
|
form: FormData,
|
|
90
90
|
opts: RequestOptions<T>,
|
package/src/core.ts
CHANGED
|
@@ -208,27 +208,27 @@ export abstract class APIClient {
|
|
|
208
208
|
return `stainless-node-retry-${uuid4()}`;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
get<Req
|
|
211
|
+
get<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
212
212
|
return this.methodRequest('get', path, opts);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
post<Req
|
|
215
|
+
post<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
216
216
|
return this.methodRequest('post', path, opts);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
patch<Req
|
|
219
|
+
patch<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
220
220
|
return this.methodRequest('patch', path, opts);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
put<Req
|
|
223
|
+
put<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
224
224
|
return this.methodRequest('put', path, opts);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
delete<Req
|
|
227
|
+
delete<Req, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
228
228
|
return this.methodRequest('delete', path, opts);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
private methodRequest<Req
|
|
231
|
+
private methodRequest<Req, Rsp>(
|
|
232
232
|
method: HTTPMethod,
|
|
233
233
|
path: string,
|
|
234
234
|
opts?: PromiseOrValue<RequestOptions<Req>>,
|
|
@@ -260,9 +260,7 @@ export abstract class APIClient {
|
|
|
260
260
|
return null;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
buildRequest<Req
|
|
264
|
-
options: FinalRequestOptions<Req>,
|
|
265
|
-
): { req: RequestInit; url: string; timeout: number } {
|
|
263
|
+
buildRequest<Req>(options: FinalRequestOptions<Req>): { req: RequestInit; url: string; timeout: number } {
|
|
266
264
|
const { method, path, query, headers: headers = {} } = options;
|
|
267
265
|
|
|
268
266
|
const body =
|
|
@@ -292,18 +290,7 @@ export abstract class APIClient {
|
|
|
292
290
|
headers[this.idempotencyHeader] = options.idempotencyKey;
|
|
293
291
|
}
|
|
294
292
|
|
|
295
|
-
const reqHeaders
|
|
296
|
-
...(contentLength && { 'Content-Length': contentLength }),
|
|
297
|
-
...this.defaultHeaders(options),
|
|
298
|
-
...headers,
|
|
299
|
-
};
|
|
300
|
-
// let builtin fetch set the Content-Type for multipart bodies
|
|
301
|
-
if (isMultipartBody(options.body) && shimsKind !== 'node') {
|
|
302
|
-
delete reqHeaders['Content-Type'];
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Strip any headers being explicitly omitted with null
|
|
306
|
-
Object.keys(reqHeaders).forEach((key) => reqHeaders[key] === null && delete reqHeaders[key]);
|
|
293
|
+
const reqHeaders = this.buildHeaders({ options, headers, contentLength });
|
|
307
294
|
|
|
308
295
|
const req: RequestInit = {
|
|
309
296
|
method,
|
|
@@ -315,9 +302,35 @@ export abstract class APIClient {
|
|
|
315
302
|
signal: options.signal ?? null,
|
|
316
303
|
};
|
|
317
304
|
|
|
305
|
+
return { req, url, timeout };
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
private buildHeaders({
|
|
309
|
+
options,
|
|
310
|
+
headers,
|
|
311
|
+
contentLength,
|
|
312
|
+
}: {
|
|
313
|
+
options: FinalRequestOptions;
|
|
314
|
+
headers: Record<string, string | null | undefined>;
|
|
315
|
+
contentLength: string | null | undefined;
|
|
316
|
+
}): Record<string, string> {
|
|
317
|
+
const reqHeaders: Record<string, string> = {};
|
|
318
|
+
if (contentLength) {
|
|
319
|
+
reqHeaders['content-length'] = contentLength;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const defaultHeaders = this.defaultHeaders(options);
|
|
323
|
+
applyHeadersMut(reqHeaders, defaultHeaders);
|
|
324
|
+
applyHeadersMut(reqHeaders, headers);
|
|
325
|
+
|
|
326
|
+
// let builtin fetch set the Content-Type for multipart bodies
|
|
327
|
+
if (isMultipartBody(options.body) && shimsKind !== 'node') {
|
|
328
|
+
delete reqHeaders['content-type'];
|
|
329
|
+
}
|
|
330
|
+
|
|
318
331
|
this.validateHeaders(reqHeaders, headers);
|
|
319
332
|
|
|
320
|
-
return
|
|
333
|
+
return reqHeaders;
|
|
321
334
|
}
|
|
322
335
|
|
|
323
336
|
/**
|
|
@@ -349,15 +362,15 @@ export abstract class APIClient {
|
|
|
349
362
|
return APIError.generate(status, error, message, headers);
|
|
350
363
|
}
|
|
351
364
|
|
|
352
|
-
request<Req
|
|
365
|
+
request<Req, Rsp>(
|
|
353
366
|
options: PromiseOrValue<FinalRequestOptions<Req>>,
|
|
354
367
|
remainingRetries: number | null = null,
|
|
355
368
|
): APIPromise<Rsp> {
|
|
356
369
|
return new APIPromise(this.makeRequest(options, remainingRetries));
|
|
357
370
|
}
|
|
358
371
|
|
|
359
|
-
private async makeRequest(
|
|
360
|
-
optionsInput: PromiseOrValue<FinalRequestOptions
|
|
372
|
+
private async makeRequest<Req>(
|
|
373
|
+
optionsInput: PromiseOrValue<FinalRequestOptions<Req>>,
|
|
361
374
|
retriesRemaining: number | null,
|
|
362
375
|
): Promise<APIResponseProps> {
|
|
363
376
|
const options = await optionsInput;
|
|
@@ -419,7 +432,7 @@ export abstract class APIClient {
|
|
|
419
432
|
return new PagePromise<PageClass, Item>(this, request, Page);
|
|
420
433
|
}
|
|
421
434
|
|
|
422
|
-
buildURL<Req
|
|
435
|
+
buildURL<Req>(path: string, query: Req | null | undefined): string {
|
|
423
436
|
const url =
|
|
424
437
|
isAbsoluteURL(path) ?
|
|
425
438
|
new URL(path)
|
|
@@ -593,7 +606,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
593
606
|
);
|
|
594
607
|
}
|
|
595
608
|
const nextOptions = { ...this.options };
|
|
596
|
-
if ('params' in nextInfo) {
|
|
609
|
+
if ('params' in nextInfo && typeof nextOptions.query === 'object') {
|
|
597
610
|
nextOptions.query = { ...nextOptions.query, ...nextInfo.params };
|
|
598
611
|
} else if ('url' in nextInfo) {
|
|
599
612
|
const params = [...Object.entries(nextOptions.query || {}), ...nextInfo.url.searchParams.entries()];
|
|
@@ -691,7 +704,7 @@ export type Headers = Record<string, string | null | undefined>;
|
|
|
691
704
|
export type DefaultQuery = Record<string, string | undefined>;
|
|
692
705
|
export type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
|
693
706
|
|
|
694
|
-
export type RequestOptions<Req
|
|
707
|
+
export type RequestOptions<Req = unknown | Record<string, unknown> | Readable> = {
|
|
695
708
|
method?: HTTPMethod;
|
|
696
709
|
path?: string;
|
|
697
710
|
query?: Req | undefined;
|
|
@@ -728,7 +741,7 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
|
|
|
728
741
|
__binaryResponse: true,
|
|
729
742
|
};
|
|
730
743
|
|
|
731
|
-
export const isRequestOptions = (obj: unknown): obj is RequestOptions
|
|
744
|
+
export const isRequestOptions = (obj: unknown): obj is RequestOptions => {
|
|
732
745
|
return (
|
|
733
746
|
typeof obj === 'object' &&
|
|
734
747
|
obj !== null &&
|
|
@@ -737,7 +750,7 @@ export const isRequestOptions = (obj: unknown): obj is RequestOptions<Record<str
|
|
|
737
750
|
);
|
|
738
751
|
};
|
|
739
752
|
|
|
740
|
-
export type FinalRequestOptions<Req
|
|
753
|
+
export type FinalRequestOptions<Req = unknown | Record<string, unknown> | Readable> = RequestOptions<Req> & {
|
|
741
754
|
method: HTTPMethod;
|
|
742
755
|
path: string;
|
|
743
756
|
};
|
|
@@ -1004,6 +1017,28 @@ export function hasOwn(obj: Object, key: string): boolean {
|
|
|
1004
1017
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
1005
1018
|
}
|
|
1006
1019
|
|
|
1020
|
+
/**
|
|
1021
|
+
* Copies headers from "newHeaders" onto "targetHeaders",
|
|
1022
|
+
* using lower-case for all properties,
|
|
1023
|
+
* ignoring any keys with undefined values,
|
|
1024
|
+
* and deleting any keys with null values.
|
|
1025
|
+
*/
|
|
1026
|
+
function applyHeadersMut(targetHeaders: Headers, newHeaders: Headers): void {
|
|
1027
|
+
for (const k in newHeaders) {
|
|
1028
|
+
if (!hasOwn(newHeaders, k)) continue;
|
|
1029
|
+
const lowerKey = k.toLowerCase();
|
|
1030
|
+
if (!lowerKey) continue;
|
|
1031
|
+
|
|
1032
|
+
const val = newHeaders[k];
|
|
1033
|
+
|
|
1034
|
+
if (val === null) {
|
|
1035
|
+
delete targetHeaders[lowerKey];
|
|
1036
|
+
} else if (val !== undefined) {
|
|
1037
|
+
targetHeaders[lowerKey] = val;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1007
1042
|
export function debug(action: string, ...args: any[]) {
|
|
1008
1043
|
if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') {
|
|
1009
1044
|
console.log(`Finch:DEBUG:${action}`, ...args);
|
package/src/index.ts
CHANGED
|
@@ -138,12 +138,15 @@ export class Finch extends Core.APIClient {
|
|
|
138
138
|
this.webhookSecret = webhookSecret;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
+
accessTokens: API.AccessTokens = new API.AccessTokens(this);
|
|
141
142
|
hris: API.HRIS = new API.HRIS(this);
|
|
142
143
|
providers: API.Providers = new API.Providers(this);
|
|
143
144
|
account: API.Account = new API.Account(this);
|
|
144
145
|
webhooks: API.Webhooks = new API.Webhooks(this);
|
|
145
146
|
requestForwarding: API.RequestForwarding = new API.RequestForwarding(this);
|
|
146
147
|
jobs: API.Jobs = new API.Jobs(this);
|
|
148
|
+
auth: API.Auth = new API.Auth(this);
|
|
149
|
+
sandbox: API.Sandbox = new API.Sandbox(this);
|
|
147
150
|
|
|
148
151
|
/**
|
|
149
152
|
* Returns an access token for the Finch API given an authorization code. An
|
|
@@ -196,6 +199,14 @@ export class Finch extends Core.APIClient {
|
|
|
196
199
|
return url.toString();
|
|
197
200
|
}
|
|
198
201
|
|
|
202
|
+
/**
|
|
203
|
+
* Returns a copy of the current Finch client with the given access token for
|
|
204
|
+
* authentication.
|
|
205
|
+
*/
|
|
206
|
+
withAccessToken(accessToken: string): Finch {
|
|
207
|
+
return new Finch({ ...this._options, accessToken });
|
|
208
|
+
}
|
|
209
|
+
|
|
199
210
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
200
211
|
return this._options.defaultQuery;
|
|
201
212
|
}
|
|
@@ -209,10 +220,10 @@ export class Finch extends Core.APIClient {
|
|
|
209
220
|
}
|
|
210
221
|
|
|
211
222
|
protected override validateHeaders(headers: Core.Headers, customHeaders: Core.Headers) {
|
|
212
|
-
if (this.accessToken && headers['
|
|
223
|
+
if (this.accessToken && headers['authorization']) {
|
|
213
224
|
return;
|
|
214
225
|
}
|
|
215
|
-
if (customHeaders['
|
|
226
|
+
if (customHeaders['authorization'] === null) {
|
|
216
227
|
return;
|
|
217
228
|
}
|
|
218
229
|
|
|
@@ -285,6 +296,10 @@ export namespace Finch {
|
|
|
285
296
|
export import PageParams = Pagination.PageParams;
|
|
286
297
|
export import PageResponse = Pagination.PageResponse;
|
|
287
298
|
|
|
299
|
+
export import AccessTokens = API.AccessTokens;
|
|
300
|
+
export import CreateAccessTokenResponse = API.CreateAccessTokenResponse;
|
|
301
|
+
export import AccessTokenCreateParams = API.AccessTokenCreateParams;
|
|
302
|
+
|
|
288
303
|
export import HRIS = API.HRIS;
|
|
289
304
|
export import Income = API.Income;
|
|
290
305
|
export import Location = API.Location;
|
|
@@ -306,6 +321,12 @@ export namespace Finch {
|
|
|
306
321
|
|
|
307
322
|
export import Jobs = API.Jobs;
|
|
308
323
|
|
|
324
|
+
export import Auth = API.Auth;
|
|
325
|
+
export import AuthCreateTokenParams = API.AuthCreateTokenParams;
|
|
326
|
+
|
|
327
|
+
export import Sandbox = API.Sandbox;
|
|
328
|
+
|
|
329
|
+
export import IntrospectResponseConnectionStatus = API.IntrospectResponseConnectionStatus;
|
|
309
330
|
export import OperationSupport = API.OperationSupport;
|
|
310
331
|
export import OperationSupportMatrix = API.OperationSupportMatrix;
|
|
311
332
|
export import Paging = API.Paging;
|
package/src/lib/.keep
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
import * as Core from "../core";
|
|
4
|
+
import { APIResource } from "../resource";
|
|
5
|
+
import * as AccessTokensAPI from "./access-tokens";
|
|
6
|
+
|
|
7
|
+
export class AccessTokens extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Exchange the authorization code for an access token
|
|
10
|
+
*/
|
|
11
|
+
create(
|
|
12
|
+
body: AccessTokenCreateParams,
|
|
13
|
+
options?: Core.RequestOptions,
|
|
14
|
+
): Core.APIPromise<CreateAccessTokenResponse> {
|
|
15
|
+
return this._client.post('/auth/token', { body, ...options });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface CreateAccessTokenResponse {
|
|
20
|
+
access_token: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface AccessTokenCreateParams {
|
|
24
|
+
client_id: string;
|
|
25
|
+
|
|
26
|
+
client_secret: string;
|
|
27
|
+
|
|
28
|
+
code: string;
|
|
29
|
+
|
|
30
|
+
redirect_uri: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export namespace AccessTokens {
|
|
34
|
+
export import CreateAccessTokenResponse = AccessTokensAPI.CreateAccessTokenResponse;
|
|
35
|
+
export import AccessTokenCreateParams = AccessTokensAPI.AccessTokenCreateParams;
|
|
36
|
+
}
|
package/src/resources/account.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import * as Core from "../core";
|
|
4
4
|
import { APIResource } from "../resource";
|
|
5
5
|
import * as AccountAPI from "./account";
|
|
6
|
+
import * as Shared from "./shared";
|
|
6
7
|
|
|
7
8
|
export class Account extends APIResource {
|
|
8
9
|
/**
|
|
@@ -35,6 +36,8 @@ export interface Introspection {
|
|
|
35
36
|
*/
|
|
36
37
|
account_id: string;
|
|
37
38
|
|
|
39
|
+
authentication_methods: Introspection.AuthenticationMethods;
|
|
40
|
+
|
|
38
41
|
/**
|
|
39
42
|
* The client id of the application associated with the `access_token`.
|
|
40
43
|
*/
|
|
@@ -82,6 +85,22 @@ export interface Introspection {
|
|
|
82
85
|
username: string;
|
|
83
86
|
}
|
|
84
87
|
|
|
88
|
+
export namespace Introspection {
|
|
89
|
+
export interface AuthenticationMethods {
|
|
90
|
+
connection_status?: AuthenticationMethods.ConnectionStatus;
|
|
91
|
+
|
|
92
|
+
type?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export namespace AuthenticationMethods {
|
|
96
|
+
export interface ConnectionStatus {
|
|
97
|
+
message?: string;
|
|
98
|
+
|
|
99
|
+
status?: Shared.IntrospectResponseConnectionStatus;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
85
104
|
export namespace Account {
|
|
86
105
|
export import DisconnectResponse = AccountAPI.DisconnectResponse;
|
|
87
106
|
export import Introspection = AccountAPI.Introspection;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
import * as Core from "../core";
|
|
4
|
+
import { APIResource } from "../resource";
|
|
5
|
+
import * as AuthAPI from "./auth";
|
|
6
|
+
import * as AccessTokensAPI from "./access-tokens";
|
|
7
|
+
|
|
8
|
+
export class Auth extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Exchange the authorization code for an access token
|
|
11
|
+
*/
|
|
12
|
+
createToken(
|
|
13
|
+
body: AuthCreateTokenParams,
|
|
14
|
+
options?: Core.RequestOptions,
|
|
15
|
+
): Core.APIPromise<AccessTokensAPI.CreateAccessTokenResponse> {
|
|
16
|
+
return this._client.post('/auth/token', { body, ...options });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface AuthCreateTokenParams {
|
|
21
|
+
client_id: string;
|
|
22
|
+
|
|
23
|
+
client_secret: string;
|
|
24
|
+
|
|
25
|
+
code: string;
|
|
26
|
+
|
|
27
|
+
redirect_uri: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export namespace Auth {
|
|
31
|
+
export import AuthCreateTokenParams = AuthAPI.AuthCreateTokenParams;
|
|
32
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
3
|
export * from './shared';
|
|
4
|
+
export { AuthCreateTokenParams, Auth } from './auth';
|
|
5
|
+
export { CreateAccessTokenResponse, AccessTokenCreateParams, AccessTokens } from './access-tokens';
|
|
4
6
|
export { DisconnectResponse, Introspection, Account } from './account';
|
|
5
7
|
export { Income, Location, Money, HRIS } from './hris/hris';
|
|
6
8
|
export { Jobs } from './jobs/jobs';
|
|
@@ -10,4 +12,5 @@ export {
|
|
|
10
12
|
RequestForwardingForwardParams,
|
|
11
13
|
RequestForwarding,
|
|
12
14
|
} from './request-forwarding';
|
|
15
|
+
export { Sandbox } from './sandbox/sandbox';
|
|
13
16
|
export { Webhooks } from './webhooks';
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless.
|
|
2
|
+
|
|
3
|
+
import * as Core from "../../core";
|
|
4
|
+
import { APIResource } from "../../resource";
|
|
5
|
+
import * as CompanyAPI from "./company";
|
|
6
|
+
import * as HRISAPI from "../hris/hris";
|
|
7
|
+
|
|
8
|
+
export class Company extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Update a sandbox company's data
|
|
11
|
+
*/
|
|
12
|
+
update(body: CompanyUpdateParams, options?: Core.RequestOptions): Core.APIPromise<CompanyUpdateResponse> {
|
|
13
|
+
return this._client.put('/sandbox/company', { body, ...options });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CompanyUpdateResponse {
|
|
18
|
+
/**
|
|
19
|
+
* An array of bank account objects associated with the payroll/HRIS system.
|
|
20
|
+
*/
|
|
21
|
+
accounts: Array<CompanyUpdateResponse.Account> | null;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The array of company departments.
|
|
25
|
+
*/
|
|
26
|
+
departments: Array<CompanyUpdateResponse.Department | null> | null;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The employer identification number.
|
|
30
|
+
*/
|
|
31
|
+
ein: string | null;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The entity type object.
|
|
35
|
+
*/
|
|
36
|
+
entity: CompanyUpdateResponse.Entity | null;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The legal name of the company.
|
|
40
|
+
*/
|
|
41
|
+
legal_name: string | null;
|
|
42
|
+
|
|
43
|
+
locations: Array<HRISAPI.Location | null> | null;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The email of the main administrator on the account.
|
|
47
|
+
*/
|
|
48
|
+
primary_email: string | null;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
|
|
52
|
+
*/
|
|
53
|
+
primary_phone_number: string | null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export namespace CompanyUpdateResponse {
|
|
57
|
+
export interface Account {
|
|
58
|
+
/**
|
|
59
|
+
* The name of the bank associated in the payroll/HRIS system.
|
|
60
|
+
*/
|
|
61
|
+
account_name?: string | null;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 10-12 digit number to specify the bank account
|
|
65
|
+
*/
|
|
66
|
+
account_number?: string | null;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The type of bank account.
|
|
70
|
+
*/
|
|
71
|
+
account_type?: 'checking' | 'savings' | null;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Name of the banking institution.
|
|
75
|
+
*/
|
|
76
|
+
institution_name?: string | null;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A nine-digit code that's based on the U.S. Bank location where your account was
|
|
80
|
+
* opened.
|
|
81
|
+
*/
|
|
82
|
+
routing_number?: string | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface Department {
|
|
86
|
+
/**
|
|
87
|
+
* The department name.
|
|
88
|
+
*/
|
|
89
|
+
name?: string | null;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The parent department, if present.
|
|
93
|
+
*/
|
|
94
|
+
parent?: Department.Parent | null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export namespace Department {
|
|
98
|
+
/**
|
|
99
|
+
* The parent department, if present.
|
|
100
|
+
*/
|
|
101
|
+
export interface Parent {
|
|
102
|
+
/**
|
|
103
|
+
* The parent department's name.
|
|
104
|
+
*/
|
|
105
|
+
name?: string | null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The entity type object.
|
|
111
|
+
*/
|
|
112
|
+
export interface Entity {
|
|
113
|
+
/**
|
|
114
|
+
* The tax payer subtype of the company.
|
|
115
|
+
*/
|
|
116
|
+
subtype?: 's_corporation' | 'c_corporation' | 'b_corporation' | null;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The tax payer type of the company.
|
|
120
|
+
*/
|
|
121
|
+
type?:
|
|
122
|
+
| 'llc'
|
|
123
|
+
| 'lp'
|
|
124
|
+
| 'corporation'
|
|
125
|
+
| 'sole_proprietor'
|
|
126
|
+
| 'non_profit'
|
|
127
|
+
| 'partnership'
|
|
128
|
+
| 'cooperative'
|
|
129
|
+
| null;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface CompanyUpdateParams {
|
|
134
|
+
/**
|
|
135
|
+
* An array of bank account objects associated with the payroll/HRIS system.
|
|
136
|
+
*/
|
|
137
|
+
accounts: Array<CompanyUpdateParams.Account> | null;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The array of company departments.
|
|
141
|
+
*/
|
|
142
|
+
departments: Array<CompanyUpdateParams.Department | null> | null;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The employer identification number.
|
|
146
|
+
*/
|
|
147
|
+
ein: string | null;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The entity type object.
|
|
151
|
+
*/
|
|
152
|
+
entity: CompanyUpdateParams.Entity | null;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* The legal name of the company.
|
|
156
|
+
*/
|
|
157
|
+
legal_name: string | null;
|
|
158
|
+
|
|
159
|
+
locations: Array<HRISAPI.Location | null> | null;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* The email of the main administrator on the account.
|
|
163
|
+
*/
|
|
164
|
+
primary_email: string | null;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
|
|
168
|
+
*/
|
|
169
|
+
primary_phone_number: string | null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export namespace CompanyUpdateParams {
|
|
173
|
+
export interface Account {
|
|
174
|
+
/**
|
|
175
|
+
* The name of the bank associated in the payroll/HRIS system.
|
|
176
|
+
*/
|
|
177
|
+
account_name?: string | null;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* 10-12 digit number to specify the bank account
|
|
181
|
+
*/
|
|
182
|
+
account_number?: string | null;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* The type of bank account.
|
|
186
|
+
*/
|
|
187
|
+
account_type?: 'checking' | 'savings' | null;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Name of the banking institution.
|
|
191
|
+
*/
|
|
192
|
+
institution_name?: string | null;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* A nine-digit code that's based on the U.S. Bank location where your account was
|
|
196
|
+
* opened.
|
|
197
|
+
*/
|
|
198
|
+
routing_number?: string | null;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface Department {
|
|
202
|
+
/**
|
|
203
|
+
* The department name.
|
|
204
|
+
*/
|
|
205
|
+
name?: string | null;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The parent department, if present.
|
|
209
|
+
*/
|
|
210
|
+
parent?: Department.Parent | null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export namespace Department {
|
|
214
|
+
/**
|
|
215
|
+
* The parent department, if present.
|
|
216
|
+
*/
|
|
217
|
+
export interface Parent {
|
|
218
|
+
/**
|
|
219
|
+
* The parent department's name.
|
|
220
|
+
*/
|
|
221
|
+
name?: string | null;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The entity type object.
|
|
227
|
+
*/
|
|
228
|
+
export interface Entity {
|
|
229
|
+
/**
|
|
230
|
+
* The tax payer subtype of the company.
|
|
231
|
+
*/
|
|
232
|
+
subtype?: 's_corporation' | 'c_corporation' | 'b_corporation' | null;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* The tax payer type of the company.
|
|
236
|
+
*/
|
|
237
|
+
type?:
|
|
238
|
+
| 'llc'
|
|
239
|
+
| 'lp'
|
|
240
|
+
| 'corporation'
|
|
241
|
+
| 'sole_proprietor'
|
|
242
|
+
| 'non_profit'
|
|
243
|
+
| 'partnership'
|
|
244
|
+
| 'cooperative'
|
|
245
|
+
| null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export namespace Company {
|
|
250
|
+
export import CompanyUpdateResponse = CompanyAPI.CompanyUpdateResponse;
|
|
251
|
+
export import CompanyUpdateParams = CompanyAPI.CompanyUpdateParams;
|
|
252
|
+
}
|