@tryfinch/finch-api 3.1.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +39 -15
  3. package/_shims/ReadableStream.d.ts +38 -0
  4. package/_shims/ReadableStream.js +5 -0
  5. package/_shims/ReadableStream.mjs +7 -0
  6. package/_shims/ReadableStream.node.d.ts +6 -0
  7. package/_shims/ReadableStream.node.d.ts.map +1 -0
  8. package/_shims/ReadableStream.node.js +14 -0
  9. package/_shims/ReadableStream.node.js.map +1 -0
  10. package/_shims/ReadableStream.node.mjs +3 -0
  11. package/_shims/ReadableStream.node.mjs.map +1 -0
  12. package/_shims/fetch.d.ts +8 -1
  13. package/_shims/fetch.js +1 -1
  14. package/_shims/fetch.node.d.ts +11 -1
  15. package/core.d.ts +87 -38
  16. package/core.d.ts.map +1 -1
  17. package/core.js +245 -114
  18. package/core.js.map +1 -1
  19. package/core.mjs +231 -74
  20. package/core.mjs.map +1 -1
  21. package/error.d.ts +1 -0
  22. package/error.d.ts.map +1 -1
  23. package/error.js +12 -3
  24. package/error.js.map +1 -1
  25. package/error.mjs +12 -3
  26. package/error.mjs.map +1 -1
  27. package/index.d.mts +3 -5
  28. package/index.d.ts +3 -5
  29. package/index.d.ts.map +1 -1
  30. package/index.js +24 -27
  31. package/index.js.map +1 -1
  32. package/index.mjs +24 -27
  33. package/index.mjs.map +1 -1
  34. package/package.json +5 -7
  35. package/pagination.d.ts +17 -8
  36. package/pagination.d.ts.map +1 -1
  37. package/pagination.js +26 -26
  38. package/pagination.js.map +1 -1
  39. package/pagination.mjs +26 -26
  40. package/pagination.mjs.map +1 -1
  41. package/resources/account.d.ts +2 -2
  42. package/resources/account.d.ts.map +1 -1
  43. package/resources/ats/applications.d.ts +6 -3
  44. package/resources/ats/applications.d.ts.map +1 -1
  45. package/resources/ats/applications.js.map +1 -1
  46. package/resources/ats/applications.mjs.map +1 -1
  47. package/resources/ats/ats.d.ts.map +1 -1
  48. package/resources/ats/ats.js.map +1 -1
  49. package/resources/ats/candidates.d.ts +6 -3
  50. package/resources/ats/candidates.d.ts.map +1 -1
  51. package/resources/ats/candidates.js.map +1 -1
  52. package/resources/ats/candidates.mjs.map +1 -1
  53. package/resources/ats/jobs.d.ts +3 -3
  54. package/resources/ats/jobs.d.ts.map +1 -1
  55. package/resources/ats/offers.d.ts +3 -3
  56. package/resources/ats/offers.d.ts.map +1 -1
  57. package/resources/ats/stages.d.ts +1 -1
  58. package/resources/ats/stages.d.ts.map +1 -1
  59. package/resources/hris/benefits/benefits.d.ts +9 -10
  60. package/resources/hris/benefits/benefits.d.ts.map +1 -1
  61. package/resources/hris/benefits/benefits.js.map +1 -1
  62. package/resources/hris/benefits/benefits.mjs.map +1 -1
  63. package/resources/hris/benefits/individuals.d.ts +6 -6
  64. package/resources/hris/benefits/individuals.d.ts.map +1 -1
  65. package/resources/hris/company.d.ts +1 -1
  66. package/resources/hris/company.d.ts.map +1 -1
  67. package/resources/hris/directory.d.ts +2 -2
  68. package/resources/hris/directory.d.ts.map +1 -1
  69. package/resources/hris/hris.d.ts.map +1 -1
  70. package/resources/hris/hris.js.map +1 -1
  71. package/resources/hris/index.d.ts.map +1 -1
  72. package/resources/hris/index.js +7 -7
  73. package/resources/hris/index.js.map +1 -1
  74. package/resources/hris/individuals/employment-data.d.ts +1 -1
  75. package/resources/hris/individuals/employment-data.d.ts.map +1 -1
  76. package/resources/hris/individuals/employment-data.js.map +1 -1
  77. package/resources/hris/individuals/individuals.d.ts +4 -2
  78. package/resources/hris/individuals/individuals.d.ts.map +1 -1
  79. package/resources/hris/individuals/individuals.js.map +1 -1
  80. package/resources/hris/individuals/individuals.mjs.map +1 -1
  81. package/resources/hris/pay-statements.d.ts +1 -1
  82. package/resources/hris/pay-statements.d.ts.map +1 -1
  83. package/resources/hris/payments.d.ts +4 -1
  84. package/resources/hris/payments.d.ts.map +1 -1
  85. package/resources/hris/payments.js.map +1 -1
  86. package/resources/hris/payments.mjs.map +1 -1
  87. package/resources/index.d.ts +1 -0
  88. package/resources/index.d.ts.map +1 -1
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/providers.d.ts +1 -1
  92. package/resources/providers.d.ts.map +1 -1
  93. package/src/_shims/ReadableStream.d.ts +38 -0
  94. package/src/_shims/ReadableStream.js +5 -0
  95. package/src/_shims/ReadableStream.mjs +7 -0
  96. package/src/_shims/ReadableStream.node.ts +6 -0
  97. package/src/_shims/fetch.d.ts +8 -1
  98. package/src/_shims/fetch.deno.ts +23 -0
  99. package/src/_shims/fetch.js +1 -1
  100. package/src/_shims/fetch.node.d.ts +11 -1
  101. package/src/_shims/formdata.deno.ts +16 -0
  102. package/src/core.ts +302 -93
  103. package/src/error.ts +11 -1
  104. package/src/index.ts +28 -27
  105. package/src/pagination.ts +34 -29
  106. package/src/resources/account.ts +3 -3
  107. package/src/resources/ats/applications.ts +8 -5
  108. package/src/resources/ats/ats.ts +1 -1
  109. package/src/resources/ats/candidates.ts +8 -5
  110. package/src/resources/ats/jobs.ts +5 -5
  111. package/src/resources/ats/offers.ts +5 -5
  112. package/src/resources/ats/stages.ts +2 -2
  113. package/src/resources/hris/benefits/benefits.ts +12 -13
  114. package/src/resources/hris/benefits/individuals.ts +9 -9
  115. package/src/resources/hris/company.ts +2 -2
  116. package/src/resources/hris/directory.ts +4 -4
  117. package/src/resources/hris/hris.ts +1 -1
  118. package/src/resources/hris/index.ts +2 -2
  119. package/src/resources/hris/individuals/employment-data.ts +2 -2
  120. package/src/resources/hris/individuals/individuals.ts +6 -4
  121. package/src/resources/hris/pay-statements.ts +2 -2
  122. package/src/resources/hris/payments.ts +5 -2
  123. package/src/resources/index.ts +1 -0
  124. package/src/resources/providers.ts +2 -2
  125. package/src/uploads.ts +7 -6
  126. package/src/version.ts +1 -1
  127. package/uploads.d.ts +5 -4
  128. package/uploads.d.ts.map +1 -1
  129. package/uploads.js +2 -2
  130. package/uploads.js.map +1 -1
  131. package/uploads.mjs +2 -2
  132. package/uploads.mjs.map +1 -1
  133. package/version.d.ts +1 -1
  134. package/version.js +1 -1
  135. package/version.mjs +1 -1
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import * as qs from 'qs';
4
3
  import * as Core from './core';
5
4
  import * as Pagination from './pagination';
6
5
  import * as API from './resources/index';
@@ -8,7 +7,7 @@ import * as Errors from './error';
8
7
  import type { Agent } from './_shims/agent';
9
8
  import * as Uploads from './uploads';
10
9
 
11
- type Config = {
10
+ export interface ClientOptions {
12
11
  /**
13
12
  * Set it to null if you want to send unauthenticated requests.
14
13
  */
@@ -71,7 +70,7 @@ type Config = {
71
70
  clientId?: string | null;
72
71
 
73
72
  clientSecret?: string | null;
74
- };
73
+ }
75
74
 
76
75
  /** Instantiate the API Client. */
77
76
  export class Finch extends Core.APIClient {
@@ -79,27 +78,36 @@ export class Finch extends Core.APIClient {
79
78
  clientId?: string | null;
80
79
  clientSecret?: string | null;
81
80
 
82
- private _options: Config;
83
-
84
- constructor(config?: Config) {
85
- const options: Config = {
86
- accessToken: null,
87
- baseURL: 'https://api.tryfinch.com',
88
- ...config,
81
+ private _options: ClientOptions;
82
+
83
+ constructor({
84
+ accessToken = null,
85
+ clientId = Core.readEnv('FINCH_CLIENT_ID') ?? null,
86
+ clientSecret = Core.readEnv('FINCH_CLIENT_SECRET') ?? null,
87
+ ...opts
88
+ }: ClientOptions = {}) {
89
+ undefined;
90
+
91
+ const options: ClientOptions = {
92
+ accessToken,
93
+ clientId,
94
+ clientSecret,
95
+ baseURL: `https://api.tryfinch.com`,
96
+ ...opts,
89
97
  };
90
98
 
91
99
  super({
92
100
  baseURL: options.baseURL!,
93
- timeout: options.timeout,
101
+ timeout: options.timeout ?? 60000 /* 1 minute */,
94
102
  httpAgent: options.httpAgent,
95
103
  maxRetries: options.maxRetries,
96
104
  fetch: options.fetch,
97
105
  });
98
- this.accessToken = options.accessToken || null;
99
106
  this._options = options;
100
107
 
101
- this.clientId = config?.clientId || process.env['FINCH_CLIENT_ID'] || null;
102
- this.clientSecret = config?.clientSecret || process.env['FINCH_CLIENT_SECRET'] || null;
108
+ this.accessToken = accessToken;
109
+ this.clientId = clientId;
110
+ this.clientSecret = clientSecret;
103
111
  }
104
112
 
105
113
  ats: API.ATS = new API.ATS(this);
@@ -150,15 +158,12 @@ export class Finch extends Core.APIClient {
150
158
  throw new Error('Expected the clientId to be set in order to call getAuthUrl');
151
159
  }
152
160
  const url = new URL('/authorize', 'https://connect.tryfinch.com/authorize');
153
- url.search = qs.stringify(
154
- {
155
- client_id: this.clientId,
156
- products: products,
157
- redirect_uri: redirectUri,
158
- sandbox: sandbox,
159
- },
160
- this.qsOptions(),
161
- );
161
+ url.search = this.stringifyQuery({
162
+ client_id: this.clientId,
163
+ products: products,
164
+ redirect_uri: redirectUri,
165
+ sandbox: sandbox,
166
+ });
162
167
  return url.toString();
163
168
  }
164
169
 
@@ -194,10 +199,6 @@ export class Finch extends Core.APIClient {
194
199
  return { Authorization: `Bearer ${this.accessToken}` };
195
200
  }
196
201
 
197
- protected override qsOptions(): qs.IStringifyOptions {
198
- return { arrayFormat: 'comma' };
199
- }
200
-
201
202
  static Finch = this;
202
203
 
203
204
  static APIError = Errors.APIError;
package/src/pagination.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  // File generated from our OpenAPI spec by Stainless.
2
2
 
3
- import { AbstractPage, APIResponse, APIClient, FinalRequestOptions, PageInfo } from './core';
4
- import * as HRIS from './resources/hris';
5
- import * as ATS from './resources/ats';
3
+ import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core';
4
+ import * as HRIS from './resources/hris/index';
5
+ import * as ATS from './resources/ats/index';
6
6
 
7
7
  export type SinglePageResponse<Item> = Item[];
8
8
 
@@ -11,12 +11,13 @@ export class SinglePage<Item> extends AbstractPage<Item> {
11
11
 
12
12
  constructor(
13
13
  client: APIClient,
14
- response: APIResponse<SinglePageResponse<Item>>,
14
+ response: Response,
15
+ body: SinglePageResponse<Item>,
15
16
  options: FinalRequestOptions,
16
17
  ) {
17
- super(client, response, options);
18
+ super(client, response, body, options);
18
19
 
19
- this.items = response || [];
20
+ this.items = body || [];
20
21
  }
21
22
 
22
23
  getPaginatedItems(): Item[] {
@@ -46,12 +47,13 @@ export class ResponsesPage<Item> extends AbstractPage<Item> implements Responses
46
47
 
47
48
  constructor(
48
49
  client: APIClient,
49
- response: APIResponse<ResponsesPageResponse<Item>>,
50
+ response: Response,
51
+ body: ResponsesPageResponse<Item>,
50
52
  options: FinalRequestOptions,
51
53
  ) {
52
- super(client, response, options);
54
+ super(client, response, body, options);
53
55
 
54
- this.responses = response.responses;
56
+ this.responses = body.responses;
55
57
  }
56
58
 
57
59
  getPaginatedItems(): Item[] {
@@ -106,13 +108,14 @@ export class IndividualsPage
106
108
 
107
109
  constructor(
108
110
  client: APIClient,
109
- response: APIResponse<IndividualsPageResponse>,
111
+ response: Response,
112
+ body: IndividualsPageResponse,
110
113
  options: FinalRequestOptions,
111
114
  ) {
112
- super(client, response, options);
115
+ super(client, response, body, options);
113
116
 
114
- this.paging = response.paging;
115
- this.individuals = response.individuals;
117
+ this.paging = body.paging;
118
+ this.individuals = body.individuals;
116
119
  }
117
120
 
118
121
  getPaginatedItems(): HRIS.IndividualInDirectory[] {
@@ -172,13 +175,14 @@ export class CandidatesPage extends AbstractPage<ATS.Candidate> implements Candi
172
175
 
173
176
  constructor(
174
177
  client: APIClient,
175
- response: APIResponse<CandidatesPageResponse>,
178
+ response: Response,
179
+ body: CandidatesPageResponse,
176
180
  options: FinalRequestOptions,
177
181
  ) {
178
- super(client, response, options);
182
+ super(client, response, body, options);
179
183
 
180
- this.paging = response.paging;
181
- this.candidates = response.candidates;
184
+ this.paging = body.paging;
185
+ this.candidates = body.candidates;
182
186
  }
183
187
 
184
188
  getPaginatedItems(): ATS.Candidate[] {
@@ -238,13 +242,14 @@ export class ApplicationsPage extends AbstractPage<ATS.Application> implements A
238
242
 
239
243
  constructor(
240
244
  client: APIClient,
241
- response: APIResponse<ApplicationsPageResponse>,
245
+ response: Response,
246
+ body: ApplicationsPageResponse,
242
247
  options: FinalRequestOptions,
243
248
  ) {
244
- super(client, response, options);
249
+ super(client, response, body, options);
245
250
 
246
- this.paging = response.paging;
247
- this.applications = response.applications;
251
+ this.paging = body.paging;
252
+ this.applications = body.applications;
248
253
  }
249
254
 
250
255
  getPaginatedItems(): ATS.Application[] {
@@ -302,11 +307,11 @@ export class JobsPage extends AbstractPage<ATS.Job> implements JobsPageResponse
302
307
 
303
308
  jobs: Array<ATS.Job>;
304
309
 
305
- constructor(client: APIClient, response: APIResponse<JobsPageResponse>, options: FinalRequestOptions) {
306
- super(client, response, options);
310
+ constructor(client: APIClient, response: Response, body: JobsPageResponse, options: FinalRequestOptions) {
311
+ super(client, response, body, options);
307
312
 
308
- this.paging = response.paging;
309
- this.jobs = response.jobs;
313
+ this.paging = body.paging;
314
+ this.jobs = body.jobs;
310
315
  }
311
316
 
312
317
  getPaginatedItems(): ATS.Job[] {
@@ -364,11 +369,11 @@ export class OffersPage extends AbstractPage<ATS.Offer> implements OffersPageRes
364
369
 
365
370
  offers: Array<ATS.Offer>;
366
371
 
367
- constructor(client: APIClient, response: APIResponse<OffersPageResponse>, options: FinalRequestOptions) {
368
- super(client, response, options);
372
+ constructor(client: APIClient, response: Response, body: OffersPageResponse, options: FinalRequestOptions) {
373
+ super(client, response, body, options);
369
374
 
370
- this.paging = response.paging;
371
- this.offers = response.offers;
375
+ this.paging = body.paging;
376
+ this.offers = body.offers;
372
377
  }
373
378
 
374
379
  getPaginatedItems(): ATS.Offer[] {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as Core from '../core';
4
4
  import { APIResource } from '../resource';
5
- import * as API from '.';
5
+ import * as API from './index';
6
6
 
7
7
  export class Account extends APIResource {
8
8
  /**
@@ -10,14 +10,14 @@ export class Account extends APIResource {
10
10
  * associated with the employer. We require applications to implement the
11
11
  * Disconnect endpoint for billing and security purposes.
12
12
  */
13
- disconnect(options?: Core.RequestOptions): Promise<Core.APIResponse<DisconnectResponse>> {
13
+ disconnect(options?: Core.RequestOptions): Core.APIPromise<DisconnectResponse> {
14
14
  return this.post('/disconnect', options);
15
15
  }
16
16
 
17
17
  /**
18
18
  * Read account information associated with an `access_token`
19
19
  */
20
- introspect(options?: Core.RequestOptions): Promise<Core.APIResponse<Introspection>> {
20
+ introspect(options?: Core.RequestOptions): Core.APIPromise<Introspection> {
21
21
  return this.get('/introspect', options);
22
22
  }
23
23
  }
@@ -4,26 +4,29 @@ import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import { isRequestOptions } from '../../core';
6
6
  import * as Stages from './stages';
7
- import * as API from '.';
7
+ import * as API from './index';
8
8
  import { ApplicationsPage, ApplicationsPageParams } from '../../pagination';
9
9
 
10
10
  export class Applications extends APIResource {
11
11
  /**
12
12
  * Gets an application from an organization.
13
13
  */
14
- retrieve(applicationId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Application>> {
14
+ retrieve(applicationId: string, options?: Core.RequestOptions): Core.APIPromise<Application> {
15
15
  return this.get(`/ats/applications/${applicationId}`, options);
16
16
  }
17
17
 
18
18
  /**
19
19
  * Gets all of an organization's applications.
20
20
  */
21
- list(query?: ApplicationListParams, options?: Core.RequestOptions): Core.PagePromise<ApplicationsPage>;
22
- list(options?: Core.RequestOptions): Core.PagePromise<ApplicationsPage>;
21
+ list(
22
+ query?: ApplicationListParams,
23
+ options?: Core.RequestOptions,
24
+ ): Core.PagePromise<ApplicationsPage, Application>;
25
+ list(options?: Core.RequestOptions): Core.PagePromise<ApplicationsPage, Application>;
23
26
  list(
24
27
  query: ApplicationListParams | Core.RequestOptions = {},
25
28
  options?: Core.RequestOptions,
26
- ): Core.PagePromise<ApplicationsPage> {
29
+ ): Core.PagePromise<ApplicationsPage, Application> {
27
30
  if (isRequestOptions(query)) {
28
31
  return this.list({}, query);
29
32
  }
@@ -6,7 +6,7 @@ import { Applications } from './applications';
6
6
  import { Stages } from './stages';
7
7
  import { Jobs } from './jobs';
8
8
  import { Offers } from './offers';
9
- import * as API from '.';
9
+ import * as API from './index';
10
10
 
11
11
  export class ATS extends APIResource {
12
12
  candidates: Candidates = new Candidates(this.client);
@@ -3,7 +3,7 @@
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import { isRequestOptions } from '../../core';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
  import { CandidatesPage, CandidatesPageParams } from '../../pagination';
8
8
 
9
9
  export class Candidates extends APIResource {
@@ -11,7 +11,7 @@ export class Candidates extends APIResource {
11
11
  * Gets a candidate from an organization. A candidate represents an individual
12
12
  * associated with one or more applications.
13
13
  */
14
- retrieve(candidateId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Candidate>> {
14
+ retrieve(candidateId: string, options?: Core.RequestOptions): Core.APIPromise<Candidate> {
15
15
  return this.get(`/ats/candidates/${candidateId}`, options);
16
16
  }
17
17
 
@@ -19,12 +19,15 @@ export class Candidates extends APIResource {
19
19
  * Gets all of an organization's candidates. A candidate represents an individual
20
20
  * associated with one or more applications.
21
21
  */
22
- list(query?: CandidateListParams, options?: Core.RequestOptions): Core.PagePromise<CandidatesPage>;
23
- list(options?: Core.RequestOptions): Core.PagePromise<CandidatesPage>;
22
+ list(
23
+ query?: CandidateListParams,
24
+ options?: Core.RequestOptions,
25
+ ): Core.PagePromise<CandidatesPage, Candidate>;
26
+ list(options?: Core.RequestOptions): Core.PagePromise<CandidatesPage, Candidate>;
24
27
  list(
25
28
  query: CandidateListParams | Core.RequestOptions = {},
26
29
  options?: Core.RequestOptions,
27
- ): Core.PagePromise<CandidatesPage> {
30
+ ): Core.PagePromise<CandidatesPage, Candidate> {
28
31
  if (isRequestOptions(query)) {
29
32
  return this.list({}, query);
30
33
  }
@@ -3,26 +3,26 @@
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import { isRequestOptions } from '../../core';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
  import { JobsPage, JobsPageParams } from '../../pagination';
8
8
 
9
9
  export class Jobs extends APIResource {
10
10
  /**
11
11
  * Gets a job from an organization.
12
12
  */
13
- retrieve(jobId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Job>> {
13
+ retrieve(jobId: string, options?: Core.RequestOptions): Core.APIPromise<Job> {
14
14
  return this.get(`/ats/jobs/${jobId}`, options);
15
15
  }
16
16
 
17
17
  /**
18
18
  * Gets all of an organization's jobs.
19
19
  */
20
- list(query?: JobListParams, options?: Core.RequestOptions): Core.PagePromise<JobsPage>;
21
- list(options?: Core.RequestOptions): Core.PagePromise<JobsPage>;
20
+ list(query?: JobListParams, options?: Core.RequestOptions): Core.PagePromise<JobsPage, Job>;
21
+ list(options?: Core.RequestOptions): Core.PagePromise<JobsPage, Job>;
22
22
  list(
23
23
  query: JobListParams | Core.RequestOptions = {},
24
24
  options?: Core.RequestOptions,
25
- ): Core.PagePromise<JobsPage> {
25
+ ): Core.PagePromise<JobsPage, Job> {
26
26
  if (isRequestOptions(query)) {
27
27
  return this.list({}, query);
28
28
  }
@@ -3,26 +3,26 @@
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import { isRequestOptions } from '../../core';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
  import { OffersPage, OffersPageParams } from '../../pagination';
8
8
 
9
9
  export class Offers extends APIResource {
10
10
  /**
11
11
  * Get a single offer from an organization.
12
12
  */
13
- retrieve(offerId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<Offer>> {
13
+ retrieve(offerId: string, options?: Core.RequestOptions): Core.APIPromise<Offer> {
14
14
  return this.get(`/ats/offers/${offerId}`, options);
15
15
  }
16
16
 
17
17
  /**
18
18
  * Get all offers put out by an organization.
19
19
  */
20
- list(query?: OfferListParams, options?: Core.RequestOptions): Core.PagePromise<OffersPage>;
21
- list(options?: Core.RequestOptions): Core.PagePromise<OffersPage>;
20
+ list(query?: OfferListParams, options?: Core.RequestOptions): Core.PagePromise<OffersPage, Offer>;
21
+ list(options?: Core.RequestOptions): Core.PagePromise<OffersPage, Offer>;
22
22
  list(
23
23
  query: OfferListParams | Core.RequestOptions = {},
24
24
  options?: Core.RequestOptions,
25
- ): Core.PagePromise<OffersPage> {
25
+ ): Core.PagePromise<OffersPage, Offer> {
26
26
  if (isRequestOptions(query)) {
27
27
  return this.list({}, query);
28
28
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
- import * as API from '.';
5
+ import * as API from './index';
6
6
  import { SinglePage } from '../../pagination';
7
7
 
8
8
  export class Stages extends APIResource {
@@ -12,7 +12,7 @@ export class Stages extends APIResource {
12
12
  * in the system. Use the `job_id` to determine whether a job applies specifically
13
13
  * to a job.
14
14
  */
15
- list(options?: Core.RequestOptions): Core.PagePromise<StagesSinglePage> {
15
+ list(options?: Core.RequestOptions): Core.PagePromise<StagesSinglePage, Stage> {
16
16
  return this.getAPIList('/ats/stages', StagesSinglePage, options);
17
17
  }
18
18
  }
@@ -4,7 +4,7 @@ import * as Core from '../../../core';
4
4
  import { APIResource } from '../../../resource';
5
5
  import { isRequestOptions } from '../../../core';
6
6
  import { Individuals } from './individuals';
7
- import * as API from '.';
7
+ import * as API from './index';
8
8
  import { SinglePage } from '../../../pagination';
9
9
 
10
10
  export class Benefits extends APIResource {
@@ -19,12 +19,12 @@ export class Benefits extends APIResource {
19
19
  create(
20
20
  body?: BenefitCreateParams,
21
21
  options?: Core.RequestOptions,
22
- ): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>>;
23
- create(options?: Core.RequestOptions): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>>;
22
+ ): Core.APIPromise<CreateCompanyBenefitsResponse>;
23
+ create(options?: Core.RequestOptions): Core.APIPromise<CreateCompanyBenefitsResponse>;
24
24
  create(
25
25
  body: BenefitCreateParams | Core.RequestOptions = {},
26
26
  options?: Core.RequestOptions,
27
- ): Promise<Core.APIResponse<CreateCompanyBenefitsResponse>> {
27
+ ): Core.APIPromise<CreateCompanyBenefitsResponse> {
28
28
  if (isRequestOptions(body)) {
29
29
  return this.create({}, body);
30
30
  }
@@ -36,7 +36,7 @@ export class Benefits extends APIResource {
36
36
  *
37
37
  * Lists benefit information for a given benefit
38
38
  */
39
- retrieve(benefitId: string, options?: Core.RequestOptions): Promise<Core.APIResponse<CompanyBenefit>> {
39
+ retrieve(benefitId: string, options?: Core.RequestOptions): Core.APIPromise<CompanyBenefit> {
40
40
  return this.get(`/employer/benefits/${benefitId}`, options);
41
41
  }
42
42
 
@@ -49,16 +49,13 @@ export class Benefits extends APIResource {
49
49
  benefitId: string,
50
50
  body?: BenefitUpdateParams,
51
51
  options?: Core.RequestOptions,
52
- ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>>;
53
- update(
54
- benefitId: string,
55
- options?: Core.RequestOptions,
56
- ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>>;
52
+ ): Core.APIPromise<UpdateCompanyBenefitResponse>;
53
+ update(benefitId: string, options?: Core.RequestOptions): Core.APIPromise<UpdateCompanyBenefitResponse>;
57
54
  update(
58
55
  benefitId: string,
59
56
  body: BenefitUpdateParams | Core.RequestOptions = {},
60
57
  options?: Core.RequestOptions,
61
- ): Promise<Core.APIResponse<UpdateCompanyBenefitResponse>> {
58
+ ): Core.APIPromise<UpdateCompanyBenefitResponse> {
62
59
  if (isRequestOptions(body)) {
63
60
  return this.update(benefitId, {}, body);
64
61
  }
@@ -70,7 +67,7 @@ export class Benefits extends APIResource {
70
67
  *
71
68
  * List all company-wide benefits.
72
69
  */
73
- list(options?: Core.RequestOptions): Core.PagePromise<CompanyBenefitsSinglePage> {
70
+ list(options?: Core.RequestOptions): Core.PagePromise<CompanyBenefitsSinglePage, CompanyBenefit> {
74
71
  return this.getAPIList('/employer/benefits', CompanyBenefitsSinglePage, options);
75
72
  }
76
73
 
@@ -80,7 +77,9 @@ export class Benefits extends APIResource {
80
77
  * Lists available types and configurations for the provider associated with the
81
78
  * access token.
82
79
  */
83
- listSupportedBenefits(options?: Core.RequestOptions): Core.PagePromise<SupportedBenefitsSinglePage> {
80
+ listSupportedBenefits(
81
+ options?: Core.RequestOptions,
82
+ ): Core.PagePromise<SupportedBenefitsSinglePage, SupportedBenefit> {
84
83
  return this.getAPIList('/employer/benefits/meta', SupportedBenefitsSinglePage, options);
85
84
  }
86
85
  }
@@ -4,7 +4,7 @@ import * as Core from '../../../core';
4
4
  import { APIResource } from '../../../resource';
5
5
  import { isRequestOptions } from '../../../core';
6
6
  import * as Benefits from './index';
7
- import * as API from '.';
7
+ import * as API from './index';
8
8
  import { SinglePage } from '../../../pagination';
9
9
 
10
10
  export class Individuals extends APIResource {
@@ -24,7 +24,7 @@ export class Individuals extends APIResource {
24
24
  benefitId: string,
25
25
  body: IndividualEnrollManyParams,
26
26
  options?: Core.RequestOptions,
27
- ): Core.PagePromise<EnrolledIndividualsSinglePage> {
27
+ ): Core.PagePromise<EnrolledIndividualsSinglePage, EnrolledIndividual> {
28
28
  return this.getAPIList(`/employer/benefits/${benefitId}/individuals`, EnrolledIndividualsSinglePage, {
29
29
  body,
30
30
  method: 'post',
@@ -40,7 +40,7 @@ export class Individuals extends APIResource {
40
40
  enrolledIds(
41
41
  benefitId: string,
42
42
  options?: Core.RequestOptions,
43
- ): Promise<Core.APIResponse<IndividualEnrolledIDsResponse>> {
43
+ ): Core.APIPromise<IndividualEnrolledIDsResponse> {
44
44
  return this.get(`/employer/benefits/${benefitId}/enrolled`, options);
45
45
  }
46
46
 
@@ -53,16 +53,16 @@ export class Individuals extends APIResource {
53
53
  benefitId: string,
54
54
  query?: IndividualRetrieveManyBenefitsParams,
55
55
  options?: Core.RequestOptions,
56
- ): Core.PagePromise<IndividualBenefitsSinglePage>;
56
+ ): Core.PagePromise<IndividualBenefitsSinglePage, IndividualBenefit>;
57
57
  retrieveManyBenefits(
58
58
  benefitId: string,
59
59
  options?: Core.RequestOptions,
60
- ): Core.PagePromise<IndividualBenefitsSinglePage>;
60
+ ): Core.PagePromise<IndividualBenefitsSinglePage, IndividualBenefit>;
61
61
  retrieveManyBenefits(
62
62
  benefitId: string,
63
63
  query: IndividualRetrieveManyBenefitsParams | Core.RequestOptions = {},
64
64
  options?: Core.RequestOptions,
65
- ): Core.PagePromise<IndividualBenefitsSinglePage> {
65
+ ): Core.PagePromise<IndividualBenefitsSinglePage, IndividualBenefit> {
66
66
  if (isRequestOptions(query)) {
67
67
  return this.retrieveManyBenefits(benefitId, {}, query);
68
68
  }
@@ -81,16 +81,16 @@ export class Individuals extends APIResource {
81
81
  benefitId: string,
82
82
  body?: IndividualUnenrollParams,
83
83
  options?: Core.RequestOptions,
84
- ): Core.PagePromise<UnenrolledIndividualsSinglePage>;
84
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage, UnenrolledIndividual>;
85
85
  unenroll(
86
86
  benefitId: string,
87
87
  options?: Core.RequestOptions,
88
- ): Core.PagePromise<UnenrolledIndividualsSinglePage>;
88
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage, UnenrolledIndividual>;
89
89
  unenroll(
90
90
  benefitId: string,
91
91
  body: IndividualUnenrollParams | Core.RequestOptions = {},
92
92
  options?: Core.RequestOptions,
93
- ): Core.PagePromise<UnenrolledIndividualsSinglePage> {
93
+ ): Core.PagePromise<UnenrolledIndividualsSinglePage, UnenrolledIndividual> {
94
94
  if (isRequestOptions(body)) {
95
95
  return this.unenroll(benefitId, {}, body);
96
96
  }
@@ -3,13 +3,13 @@
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import * as HRIS from './index';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
 
8
8
  export class CompanyResource extends APIResource {
9
9
  /**
10
10
  * Read basic company data
11
11
  */
12
- retrieve(options?: Core.RequestOptions): Promise<Core.APIResponse<Company>> {
12
+ retrieve(options?: Core.RequestOptions): Core.APIPromise<Company> {
13
13
  return this.get('/employer/company', options);
14
14
  }
15
15
  }
@@ -3,7 +3,7 @@
3
3
  import * as Core from '../../core';
4
4
  import { APIResource } from '../../resource';
5
5
  import { isRequestOptions } from '../../core';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
  import { IndividualsPage, IndividualsPageParams } from '../../pagination';
8
8
 
9
9
  export class Directory extends APIResource {
@@ -13,12 +13,12 @@ export class Directory extends APIResource {
13
13
  listIndividuals(
14
14
  query?: DirectoryListIndividualsParams,
15
15
  options?: Core.RequestOptions,
16
- ): Core.PagePromise<IndividualsPage>;
17
- listIndividuals(options?: Core.RequestOptions): Core.PagePromise<IndividualsPage>;
16
+ ): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
17
+ listIndividuals(options?: Core.RequestOptions): Core.PagePromise<IndividualsPage, IndividualInDirectory>;
18
18
  listIndividuals(
19
19
  query: DirectoryListIndividualsParams | Core.RequestOptions = {},
20
20
  options?: Core.RequestOptions,
21
- ): Core.PagePromise<IndividualsPage> {
21
+ ): Core.PagePromise<IndividualsPage, IndividualInDirectory> {
22
22
  if (isRequestOptions(query)) {
23
23
  return this.listIndividuals({}, query);
24
24
  }
@@ -7,7 +7,7 @@ import { PayStatements } from './pay-statements';
7
7
  import { Directory } from './directory';
8
8
  import { Individuals } from './individuals/individuals';
9
9
  import { Benefits } from './benefits/benefits';
10
- import * as API from '.';
10
+ import * as API from './index';
11
11
 
12
12
  export class HRIS extends APIResource {
13
13
  company: CompanyResource = new CompanyResource(this.client);
@@ -13,7 +13,7 @@ export {
13
13
  CompanyBenefitsSinglePage,
14
14
  SupportedBenefitsSinglePage,
15
15
  Benefits,
16
- } from './benefits';
16
+ } from './benefits/index';
17
17
  export { Company, CompanyResource } from './company';
18
18
  export { Income, Location, Money, Paging, HRIS } from './hris';
19
19
  export {
@@ -22,7 +22,7 @@ export {
22
22
  IndividualRetrieveManyParams,
23
23
  IndividualResponsesResponsesPage,
24
24
  Individuals,
25
- } from './individuals';
25
+ } from './individuals/index';
26
26
  export { IndividualInDirectory, DirectoryListIndividualsParams, Directory } from './directory';
27
27
  export {
28
28
  PayStatement,
@@ -3,7 +3,7 @@
3
3
  import * as Core from '../../../core';
4
4
  import { APIResource } from '../../../resource';
5
5
  import * as HRIS from '../index';
6
- import * as API from '.';
6
+ import * as API from './index';
7
7
  import { ResponsesPage } from '../../../pagination';
8
8
 
9
9
  export class EmploymentData extends APIResource {
@@ -17,7 +17,7 @@ export class EmploymentData extends APIResource {
17
17
  retrieveMany(
18
18
  body: EmploymentDataRetrieveManyParams,
19
19
  options?: Core.RequestOptions,
20
- ): Core.PagePromise<EmploymentDataResponsesResponsesPage> {
20
+ ): Core.PagePromise<EmploymentDataResponsesResponsesPage, EmploymentDataResponse> {
21
21
  return this.getAPIList('/employer/employment', EmploymentDataResponsesResponsesPage, {
22
22
  body,
23
23
  method: 'post',