-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaccounts.ts
More file actions
149 lines (125 loc) · 3.52 KB
/
accounts.ts
File metadata and controls
149 lines (125 loc) · 3.52 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
// 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';
export class Accounts extends APIResource {
/**
* Create a new account for an existing connection (company/provider pair)
*
* @example
* ```ts
* const account =
* await client.sandbox.connections.accounts.create({
* company_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* provider_id: 'provider_id',
* });
* ```
*/
create(body: AccountCreateParams, options?: RequestOptions): APIPromise<AccountCreateResponse> {
return this._client.post('/sandbox/connections/accounts', {
body,
...options,
__security: { basicAuth: true },
});
}
/**
* Update an existing sandbox account. Change the connection status to understand
* how the Finch API responds.
*
* @example
* ```ts
* const account =
* await client.sandbox.connections.accounts.update({
* connection_status: 'reauth',
* });
* ```
*/
update(
body: AccountUpdateParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<AccountUpdateResponse> {
return this._client.put('/sandbox/connections/accounts', {
body,
...options,
__security: { bearerAuth: true },
});
}
}
export interface AccountCreateResponse {
access_token: string;
/**
* @deprecated [DEPRECATED] Use `connection_id` to associate a connection with an
* access token
*/
account_id: string;
authentication_type: 'credential' | 'api_token' | 'oauth' | 'assisted';
/**
* @deprecated [DEPRECATED] Use `connection_id` to associate a connection with an
* access token
*/
company_id: string;
/**
* The ID of the new connection
*/
connection_id: string;
/**
* The ID of the entity for this connection
*/
entity_id: string;
products: Array<string>;
/**
* The ID of the provider associated with the `access_token`
*/
provider_id: string;
}
export interface AccountUpdateResponse {
/**
* @deprecated [DEPRECATED] Use `connection_id` to associate a connection with an
* access token
*/
account_id: string;
authentication_type: 'credential' | 'api_token' | 'oauth' | 'assisted';
/**
* @deprecated [DEPRECATED] Use `connection_id` to associate a connection with an
* access token
*/
company_id: string;
/**
* The ID of the new connection
*/
connection_id: string;
/**
* The ID of the entity whose status was updated
*/
entity_id: string;
products: Array<string>;
/**
* The ID of the provider associated with the `access_token`
*/
provider_id: string;
}
export interface AccountCreateParams {
company_id: string;
/**
* The provider associated with the `access_token`
*/
provider_id: string;
authentication_type?: 'credential' | 'api_token' | 'oauth' | 'assisted';
/**
* Optional, defaults to Organization products (`company`, `directory`,
* `employment`, `individual`)
*/
products?: Array<string>;
}
export interface AccountUpdateParams {
connection_status?: Shared.ConnectionStatusType;
}
export declare namespace Accounts {
export {
type AccountCreateResponse as AccountCreateResponse,
type AccountUpdateResponse as AccountUpdateResponse,
type AccountCreateParams as AccountCreateParams,
type AccountUpdateParams as AccountUpdateParams,
};
}