-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocuments.ts
More file actions
263 lines (226 loc) · 6.17 KB
/
documents.ts
File metadata and controls
263 lines (226 loc) · 6.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as Shared from '../shared';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Documents extends APIResource {
/**
* **Beta:** This endpoint is in beta and may change. Retrieve a list of
* company-wide documents.
*
* @example
* ```ts
* const documents = await client.hris.documents.list();
* ```
*/
list(
query: DocumentListParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<DocumentListResponse> {
return this._client.get('/employer/documents', { query, ...options, __security: { bearerAuth: true } });
}
/**
* **Beta:** This endpoint is in beta and may change. Retrieve details of a
* specific document by its ID.
*
* @example
* ```ts
* const response = await client.hris.documents.retreive(
* 'document_id',
* );
* ```
*/
retreive(
documentID: string,
query: DocumentRetreiveParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<DocumentRetreiveResponse> {
return this._client.get(path`/employer/documents/${documentID}`, {
query,
...options,
__security: { bearerAuth: true },
});
}
}
export interface DocumentResponse {
/**
* A stable Finch id for the document.
*/
id: string;
/**
* The ID of the individual associated with the document. This will be null for
* employer-level documents.
*/
individual_id: string | null;
/**
* The type of document.
*/
type: 'w4_2020' | 'w4_2005';
/**
* A URL to access the document. Format:
* `https://api.tryfinch.com/employer/documents/:document_id`.
*/
url: string;
/**
* The year the document applies to, if available.
*/
year: number;
}
/**
* A 2005 version of the W-4 tax form containing information on an individual's
* filing status, dependents, and withholding details.
*/
export interface W42005 {
/**
* Detailed information specific to the 2005 W4 form.
*/
data: W42005.Data;
/**
* Specifies the form type, indicating that this document is a 2005 W4 form.
*/
type: 'w4_2005';
/**
* The tax year this W4 document applies to.
*/
year: number;
}
export namespace W42005 {
/**
* Detailed information specific to the 2005 W4 form.
*/
export interface Data {
/**
* Additional withholding amount (in cents).
*/
additional_withholding: number;
/**
* Indicates exemption status from federal tax withholding.
*/
exemption: 'exempt' | 'non_exempt' | null;
/**
* The individual's filing status for tax purposes.
*/
filing_status: 'married' | 'married_but_withhold_at_higher_single_rate' | 'single' | null;
/**
* The unique identifier for the individual associated with this 2005 W4 form.
*/
individual_id: string;
/**
* Total number of allowances claimed (in cents).
*/
total_number_of_allowances: number;
}
}
/**
* A 2020 version of the W-4 tax form containing information on an individual's
* filing status, dependents, and withholding details.
*/
export interface W42020 {
/**
* Detailed information specific to the 2020 W4 form.
*/
data: W42020.Data;
/**
* Specifies the form type, indicating that this document is a 2020 W4 form.
*/
type: 'w4_2020';
/**
* The tax year this W4 document applies to.
*/
year: number;
}
export namespace W42020 {
/**
* Detailed information specific to the 2020 W4 form.
*/
export interface Data {
/**
* Amount claimed for dependents other than qualifying children under 17 (in
* cents).
*/
amount_for_other_dependents: number;
/**
* Amount claimed for dependents under 17 years old (in cents).
*/
amount_for_qualifying_children_under_17: number;
/**
* Deductible expenses (in cents).
*/
deductions: number;
/**
* Additional withholding amount (in cents).
*/
extra_withholding: number;
/**
* The individual's filing status for tax purposes.
*/
filing_status:
| 'head_of_household'
| 'married_filing_jointly_or_qualifying_surviving_spouse'
| 'single_or_married_filing_separately'
| null;
/**
* The unique identifier for the individual associated with this document.
*/
individual_id: string;
/**
* Additional income from sources outside of primary employment (in cents).
*/
other_income: number;
/**
* Total amount claimed for dependents and other credits (in cents).
*/
total_claim_dependent_and_other_credits: number;
}
}
export interface DocumentListResponse {
documents: Array<DocumentResponse>;
paging: Shared.Paging;
}
/**
* A 2020 version of the W-4 tax form containing information on an individual's
* filing status, dependents, and withholding details.
*/
export type DocumentRetreiveResponse = W42020 | W42005;
export interface DocumentListParams {
/**
* The entity IDs to specify which entities' data to access.
*/
entity_ids?: Array<string>;
/**
* Comma-delimited list of stable Finch uuids for each individual. If empty,
* defaults to all individuals
*/
individual_ids?: Array<string>;
/**
* Number of documents to return (defaults to all)
*/
limit?: number;
/**
* Index to start from (defaults to 0)
*/
offset?: number;
/**
* Comma-delimited list of document types to filter on. If empty, defaults to all
* types
*/
types?: Array<'w4_2020' | 'w4_2005'>;
}
export interface DocumentRetreiveParams {
/**
* The entity IDs to specify which entities' data to access.
*/
entity_ids?: Array<string>;
}
export declare namespace Documents {
export {
type DocumentResponse as DocumentResponse,
type W42005 as W42005,
type W42020 as W42020,
type DocumentListResponse as DocumentListResponse,
type DocumentRetreiveResponse as DocumentRetreiveResponse,
type DocumentListParams as DocumentListParams,
type DocumentRetreiveParams as DocumentRetreiveParams,
};
}