wealthica-sdk-js 0.0.1

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.
@@ -0,0 +1,212 @@
1
+ import { ApisauceInstance } from "apisauce";
2
+
3
+ export = Wealthica
4
+
5
+ declare var Wealthica: {
6
+ init(config: APIConfig): APIInterface;
7
+ };
8
+
9
+ interface APIInterface {
10
+ constructor(config: APIConfig)
11
+ __init(): APIInterface
12
+ login(loginName: string): APIUserInterface
13
+ getToken(options: TokenOptions): Promise<string>
14
+ fetchToken(): Promise<string>
15
+ authApi: ApisauceInstance
16
+ api: ApisauceInstance
17
+ getTeam(): string;
18
+ getConnectData(options: ConnectDataOptions): Promise<ConnectData>
19
+ connect(options?: APIConfig): APIInterface
20
+ reconnect(accountId: string): APIUserInterface
21
+ onConnection(callback: Function): APIInterface
22
+ onError(callback: Function): APIInterface
23
+ onEvent(callback: Function): APIInterface
24
+ providers: ProvidersInterface
25
+ teams: TeamsInterface
26
+ }
27
+
28
+ interface ProvidersInterface {
29
+ constructor(api: APIInterface)
30
+ getList(): Promise<Provider[]>
31
+ getOne(id: string): Promise<Provider>
32
+ }
33
+
34
+ interface TeamsInterface {
35
+ constructor(api: APIInterface)
36
+ info(): Promise<{}>
37
+ }
38
+
39
+ interface APIUserInterface extends APIInterface {
40
+ userApi: ApisauceInstance
41
+ institutions: InstitutionsInterface
42
+ history: HistoryInterface
43
+ transactions: TransactionsInterface
44
+ }
45
+
46
+ interface InstitutionsInterface {
47
+ constructor(api: APIUserInterface)
48
+ getList(): Promise<Account[]> | Promise<never>
49
+ getOne(id: string, params?: {}): Promise<Account> | Promise<never>
50
+ sync(id): Promise<Account> | Promise<never>
51
+ remove(id): Promise<void> | Promise<never>
52
+ }
53
+
54
+ interface HistoryInterface {
55
+ constructor(api: APIUserInterface)
56
+ getList(options: HistoryListOptions): Promise<BalanceHistory[]> | Promise<never>
57
+ }
58
+
59
+ interface TransactionsInterface {
60
+ constructor(api: APIUserInterface)
61
+ getList(options: TransactionsOptions): Promise<Transactions[]> | Promise<never>
62
+ getOne(options: TransactionOptions): Promise<Transactions> | Promise<never>
63
+ }
64
+
65
+ type APIConfig = {
66
+ clientId: string;
67
+ secret: string;
68
+ baseURL?: string;
69
+ connectURL?: string;
70
+ redirectURI?: string;
71
+ loginName?: string | null;
72
+ authEndpoint?: string
73
+ auth?: {
74
+ headers?: object;
75
+ params?: object;
76
+ }
77
+ }
78
+
79
+ type TokenOptions = {
80
+ minimumLifetime: number;
81
+ }
82
+
83
+ type ConnectDataOptions = {
84
+ provider: string;
85
+ accountId: string;
86
+ state: string;
87
+ origin: string | undefined;
88
+ lang: string;
89
+ redirectURI: string;
90
+ providers: Array<string> | undefined;
91
+ }
92
+
93
+ type ConnectData = {
94
+ url: string;
95
+ token: string;
96
+ }
97
+
98
+ type TransactionsOptions = {
99
+ accountId: string;
100
+ from?: string;
101
+ to?: string;
102
+ wallet?: string;
103
+ last?: string;
104
+ limit?: number;
105
+ }
106
+
107
+ type TransactionOptions = {
108
+ accountId: string;
109
+ txId: string;
110
+ }
111
+
112
+ type Part = {
113
+ direction: string;
114
+ ticker: string;
115
+ provider_ticker: string;
116
+ amount: string;
117
+ asset_is_verified?: boolean | null;
118
+ fiat_ticker: string;
119
+ fiat_value: string;
120
+ fiat_asset_is_verified?: boolean | null;
121
+ other_parties: any[];
122
+ }
123
+
124
+ type Fee = {
125
+ type?: string | null;
126
+ ticker: string;
127
+ provider_ticker: string;
128
+ amount: string;
129
+ asset_is_verified?: boolean | null;
130
+ fiat_ticker: string;
131
+ fiat_value: string;
132
+ fiat_asset_is_verified?: boolean | null;
133
+ resource_type: string;
134
+ }
135
+
136
+ type Transactions = {
137
+ id: string;
138
+ status?: string | null;
139
+ transaction_type: string;
140
+ parts: Part[];
141
+ fees: Fee[];
142
+ misc: any[];
143
+ fiat_calculated_at: number;
144
+ initiated_at: number;
145
+ confirmed_at: number;
146
+ resource_type: string;
147
+ }
148
+
149
+ type HistoryListOptions = {
150
+ accountId: string;
151
+ from?: string;
152
+ to?: string;
153
+ wallet?: string;
154
+ }
155
+
156
+ type BalanceHistory = {
157
+ id: string;
158
+ date: number;
159
+ wallet: string;
160
+ fiat_ticker: string;
161
+ fiat_value: string;
162
+ }
163
+
164
+ type Provider = {
165
+ name: string;
166
+ display_name: string;
167
+ logo: string;
168
+ auth_type: string;
169
+ available_scopes: any[];
170
+ available_currencies?: any;
171
+ resource_type: string;
172
+ status?: any;
173
+ is_beta: boolean;
174
+ connect_notice: string;
175
+ credentials: string[];
176
+ }
177
+
178
+ type AccountProvider = {
179
+ name: string;
180
+ display_name: string;
181
+ logo: string;
182
+ type: string;
183
+ scopes: any[];
184
+ resource_type: string;
185
+ }
186
+
187
+ type Balance = {
188
+ ticker: string;
189
+ provider_ticker: string;
190
+ name: string;
191
+ asset_is_verified?: any;
192
+ asset_type: string;
193
+ amount: string;
194
+ decimals: number;
195
+ fiat_ticker: string;
196
+ fiat_value: string;
197
+ fiat_asset_is_verified?: any;
198
+ logo: string;
199
+ updated_at: number;
200
+ misc?: any;
201
+ resource_type: string;
202
+ }
203
+
204
+ type Account = {
205
+ id: string;
206
+ provider: AccountProvider;
207
+ balances: Balance[];
208
+ blockchain?: any;
209
+ created_at: number;
210
+ updated_at: number;
211
+ resource_type: string;
212
+ }
@@ -0,0 +1,212 @@
1
+ import { ApisauceInstance } from "apisauce";
2
+
3
+ export = Wealthica
4
+
5
+ declare var Wealthica: {
6
+ init(config: APIConfig): APIInterface;
7
+ };
8
+
9
+ interface APIInterface {
10
+ constructor(config: APIConfig)
11
+ __init(): APIInterface
12
+ login(loginName: string): APIUserInterface
13
+ getToken(options: TokenOptions): Promise<string>
14
+ fetchToken(): Promise<string>
15
+ authApi: ApisauceInstance
16
+ api: ApisauceInstance
17
+ getTeam(): string;
18
+ getConnectData(options: ConnectDataOptions): Promise<ConnectData>
19
+ connect(options?: APIConfig): APIInterface
20
+ reconnect(accountId: string): APIUserInterface
21
+ onConnection(callback: Function): APIInterface
22
+ onError(callback: Function): APIInterface
23
+ onEvent(callback: Function): APIInterface
24
+ providers: ProvidersInterface
25
+ teams: TeamsInterface
26
+ }
27
+
28
+ interface ProvidersInterface {
29
+ constructor(api: APIInterface)
30
+ getList(): Promise<Provider[]>
31
+ getOne(id: string): Promise<Provider>
32
+ }
33
+
34
+ interface TeamsInterface {
35
+ constructor(api: APIInterface)
36
+ info(): Promise<{}>
37
+ }
38
+
39
+ interface APIUserInterface extends APIInterface {
40
+ userApi: ApisauceInstance
41
+ institutions: InstitutionsInterface
42
+ history: HistoryInterface
43
+ transactions: TransactionsInterface
44
+ }
45
+
46
+ interface InstitutionsInterface {
47
+ constructor(api: APIUserInterface)
48
+ getList(): Promise<Account[]> | Promise<never>
49
+ getOne(id: string, params?: {}): Promise<Account> | Promise<never>
50
+ sync(id): Promise<Account> | Promise<never>
51
+ remove(id): Promise<void> | Promise<never>
52
+ }
53
+
54
+ interface HistoryInterface {
55
+ constructor(api: APIUserInterface)
56
+ getList(options: HistoryListOptions): Promise<BalanceHistory[]> | Promise<never>
57
+ }
58
+
59
+ interface TransactionsInterface {
60
+ constructor(api: APIUserInterface)
61
+ getList(options: TransactionsOptions): Promise<Transactions[]> | Promise<never>
62
+ getOne(options: TransactionOptions): Promise<Transactions> | Promise<never>
63
+ }
64
+
65
+ type APIConfig = {
66
+ clientId: string;
67
+ secret: string;
68
+ baseURL?: string;
69
+ connectURL?: string;
70
+ redirectURI?: string;
71
+ loginName?: string | null;
72
+ authEndpoint?: string
73
+ auth?: {
74
+ headers?: object;
75
+ params?: object;
76
+ }
77
+ }
78
+
79
+ type TokenOptions = {
80
+ minimumLifetime: number;
81
+ }
82
+
83
+ type ConnectDataOptions = {
84
+ provider: string;
85
+ accountId: string;
86
+ state: string;
87
+ origin: string | undefined;
88
+ lang: string;
89
+ redirectURI: string;
90
+ providers: Array<string> | undefined;
91
+ }
92
+
93
+ type ConnectData = {
94
+ url: string;
95
+ token: string;
96
+ }
97
+
98
+ type TransactionsOptions = {
99
+ accountId: string;
100
+ from?: string;
101
+ to?: string;
102
+ wallet?: string;
103
+ last?: string;
104
+ limit?: number;
105
+ }
106
+
107
+ type TransactionOptions = {
108
+ accountId: string;
109
+ txId: string;
110
+ }
111
+
112
+ type Part = {
113
+ direction: string;
114
+ ticker: string;
115
+ provider_ticker: string;
116
+ amount: string;
117
+ asset_is_verified?: boolean | null;
118
+ fiat_ticker: string;
119
+ fiat_value: string;
120
+ fiat_asset_is_verified?: boolean | null;
121
+ other_parties: any[];
122
+ }
123
+
124
+ type Fee = {
125
+ type?: string | null;
126
+ ticker: string;
127
+ provider_ticker: string;
128
+ amount: string;
129
+ asset_is_verified?: boolean | null;
130
+ fiat_ticker: string;
131
+ fiat_value: string;
132
+ fiat_asset_is_verified?: boolean | null;
133
+ resource_type: string;
134
+ }
135
+
136
+ type Transactions = {
137
+ id: string;
138
+ status?: string | null;
139
+ transaction_type: string;
140
+ parts: Part[];
141
+ fees: Fee[];
142
+ misc: any[];
143
+ fiat_calculated_at: number;
144
+ initiated_at: number;
145
+ confirmed_at: number;
146
+ resource_type: string;
147
+ }
148
+
149
+ type HistoryListOptions = {
150
+ accountId: string;
151
+ from?: string;
152
+ to?: string;
153
+ wallet?: string;
154
+ }
155
+
156
+ type BalanceHistory = {
157
+ id: string;
158
+ date: number;
159
+ wallet: string;
160
+ fiat_ticker: string;
161
+ fiat_value: string;
162
+ }
163
+
164
+ type Provider = {
165
+ name: string;
166
+ display_name: string;
167
+ logo: string;
168
+ auth_type: string;
169
+ available_scopes: any[];
170
+ available_currencies?: any;
171
+ resource_type: string;
172
+ status?: any;
173
+ is_beta: boolean;
174
+ connect_notice: string;
175
+ credentials: string[];
176
+ }
177
+
178
+ type AccountProvider = {
179
+ name: string;
180
+ display_name: string;
181
+ logo: string;
182
+ type: string;
183
+ scopes: any[];
184
+ resource_type: string;
185
+ }
186
+
187
+ type Balance = {
188
+ ticker: string;
189
+ provider_ticker: string;
190
+ name: string;
191
+ asset_is_verified?: any;
192
+ asset_type: string;
193
+ amount: string;
194
+ decimals: number;
195
+ fiat_ticker: string;
196
+ fiat_value: string;
197
+ fiat_asset_is_verified?: any;
198
+ logo: string;
199
+ updated_at: number;
200
+ misc?: any;
201
+ resource_type: string;
202
+ }
203
+
204
+ type Account = {
205
+ id: string;
206
+ provider: AccountProvider;
207
+ balances: Balance[];
208
+ blockchain?: any;
209
+ created_at: number;
210
+ updated_at: number;
211
+ resource_type: string;
212
+ }