-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsessions.ts
More file actions
175 lines (152 loc) · 4.04 KB
/
sessions.ts
File metadata and controls
175 lines (152 loc) · 4.04 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
export class Sessions extends APIResource {
/**
* Create a new connect session for an employer
*/
new(body: SessionNewParams, options?: RequestOptions): APIPromise<SessionNewResponse> {
return this._client.post('/connect/sessions', { body, ...options, __security: { basicAuth: true } });
}
/**
* Create a new Connect session for reauthenticating an existing connection
*/
reauthenticate(
body: SessionReauthenticateParams,
options?: RequestOptions,
): APIPromise<SessionReauthenticateResponse> {
return this._client.post('/connect/sessions/reauthenticate', {
body,
...options,
__security: { basicAuth: true },
});
}
}
export interface SessionNewResponse {
/**
* The Connect URL to redirect the user to for authentication
*/
connect_url: string;
/**
* The unique identifier for the created connect session
*/
session_id: string;
}
export interface SessionReauthenticateResponse {
/**
* The Connect URL to redirect the user to for reauthentication
*/
connect_url: string;
/**
* The unique identifier for the created connect session
*/
session_id: string;
}
export interface SessionNewParams {
/**
* Unique identifier for the customer
*/
customer_id: string;
/**
* Name of the customer
*/
customer_name: string;
/**
* The Finch products to request access to. Use `benefits` to access deductions
* endpoints — `deduction` is a deprecated alias that is still accepted but should
* not be combined with `benefits`.
*/
products: Array<
| 'benefits'
| 'company'
| 'deduction'
| 'directory'
| 'documents'
| 'employment'
| 'individual'
| 'payment'
| 'pay_statement'
| 'ssn'
>;
/**
* Email address of the customer
*/
customer_email?: string | null;
/**
* Integration configuration for the connect session
*/
integration?: SessionNewParams.Integration | null;
/**
* Enable manual authentication mode
*/
manual?: boolean | null;
/**
* The number of minutes until the session expires (defaults to 129,600, which is
* 90 days)
*/
minutes_to_expire?: number | null;
/**
* The URI to redirect to after the Connect flow is completed
*/
redirect_uri?: string | null;
/**
* Sandbox mode for testing
*/
sandbox?: 'finch' | 'provider' | null;
}
export namespace SessionNewParams {
/**
* Integration configuration for the connect session
*/
export interface Integration {
/**
* The provider to integrate with
*/
provider: string;
/**
* The authentication method to use
*/
auth_method?: 'assisted' | 'credential' | 'oauth' | 'api_token' | null;
}
}
export interface SessionReauthenticateParams {
/**
* The ID of the existing connection to reauthenticate
*/
connection_id: string;
/**
* The number of minutes until the session expires (defaults to 43,200, which is 30
* days)
*/
minutes_to_expire?: number;
/**
* The products to request access to (optional for reauthentication). Use
* `benefits` to access deductions endpoints — `deduction` is a deprecated alias
* that is still accepted but should not be combined with `benefits`.
*/
products?: Array<
| 'benefits'
| 'company'
| 'deduction'
| 'directory'
| 'documents'
| 'employment'
| 'individual'
| 'payment'
| 'pay_statement'
| 'ssn'
> | null;
/**
* The URI to redirect to after the Connect flow is completed
*/
redirect_uri?: string | null;
}
export declare namespace Sessions {
export {
type SessionNewResponse as SessionNewResponse,
type SessionReauthenticateResponse as SessionReauthenticateResponse,
type SessionNewParams as SessionNewParams,
type SessionReauthenticateParams as SessionReauthenticateParams,
};
}