apimatic-plaid-sdk 0.0.2 → 0.0.5
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.
- package/README.md +48 -48
- package/dist/cjs/client.js +3 -3
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/configuration.js +4 -2
- package/dist/cjs/configuration.js.map +1 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/plaidApi.js +109 -0
- package/dist/cjs/plaidApi.js.map +1 -0
- package/dist/cjs/plaidEnvironments.js +15 -0
- package/dist/cjs/plaidEnvironments.js.map +1 -0
- package/dist/cjs/types/client.d.ts.map +1 -1
- package/dist/cjs/types/configuration.d.ts +2 -2
- package/dist/cjs/types/configuration.d.ts.map +1 -1
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/plaidApi.d.ts +60 -0
- package/dist/cjs/types/plaidApi.d.ts.map +1 -0
- package/dist/cjs/types/plaidEnvironments.d.ts +13 -0
- package/dist/cjs/types/plaidEnvironments.d.ts.map +1 -0
- package/dist/esm/client.js +3 -3
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/configuration.js +4 -2
- package/dist/esm/configuration.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/plaidApi.js +102 -0
- package/dist/esm/plaidApi.js.map +1 -0
- package/dist/esm/plaidEnvironments.js +12 -0
- package/dist/esm/plaidEnvironments.js.map +1 -0
- package/dist/esm/types/client.d.ts.map +1 -1
- package/dist/esm/types/configuration.d.ts +2 -2
- package/dist/esm/types/configuration.d.ts.map +1 -1
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/plaidApi.d.ts +60 -0
- package/dist/esm/types/plaidApi.d.ts.map +1 -0
- package/dist/esm/types/plaidEnvironments.d.ts +13 -0
- package/dist/esm/types/plaidEnvironments.d.ts.map +1 -0
- package/package.json +6 -9
- package/src/client.ts +3 -5
- package/src/configuration.ts +4 -2
- package/src/index.ts +4 -0
- package/src/plaidApi.ts +139 -0
- package/src/plaidEnvironments.ts +16 -0
package/src/client.ts
CHANGED
|
@@ -58,9 +58,7 @@ export class Client implements ClientInterface {
|
|
|
58
58
|
typeof this._config.httpClientOptions?.timeout != 'undefined'
|
|
59
59
|
? this._config.httpClientOptions.timeout
|
|
60
60
|
: this._config.timeout;
|
|
61
|
-
this._userAgent = updateUserAgent(
|
|
62
|
-
'TypeScript SDK, Version: 0.0.2, on OS {os-info}'
|
|
63
|
-
);
|
|
61
|
+
this._userAgent = updateUserAgent('Plaid Node v0.0.5');
|
|
64
62
|
this._requestBuilderFactory = createRequestHandlerFactory(
|
|
65
63
|
(server) => getBaseUri(server, this._config),
|
|
66
64
|
createAuthProviderFromConfig(this._config),
|
|
@@ -127,12 +125,12 @@ function getBaseUri(server: Server = 'default', config: Configuration): string {
|
|
|
127
125
|
return 'https://production.plaid.com';
|
|
128
126
|
}
|
|
129
127
|
}
|
|
130
|
-
if (config.environment === Environment.
|
|
128
|
+
if (config.environment === Environment.Development) {
|
|
131
129
|
if (server === 'default') {
|
|
132
130
|
return 'https://development.plaid.com';
|
|
133
131
|
}
|
|
134
132
|
}
|
|
135
|
-
if (config.environment === Environment.
|
|
133
|
+
if (config.environment === Environment.Sandbox) {
|
|
136
134
|
if (server === 'default') {
|
|
137
135
|
return 'https://sandbox.plaid.com';
|
|
138
136
|
}
|
package/src/configuration.ts
CHANGED
|
@@ -41,8 +41,10 @@ export interface Configuration {
|
|
|
41
41
|
/** Environments available for API */
|
|
42
42
|
export enum Environment {
|
|
43
43
|
Production = 'production',
|
|
44
|
-
Environment2
|
|
45
|
-
|
|
44
|
+
// Renamed from the generated `Environment2`/`Environment3` to match the
|
|
45
|
+
// server names in the spec and the official plaid-node SDK.
|
|
46
|
+
Development = 'development',
|
|
47
|
+
Sandbox = 'sandbox',
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
export namespace Configuration {
|
package/src/index.ts
CHANGED
|
@@ -538,3 +538,7 @@ export type { WebhookVerificationKeyGetRequest } from './models/webhookVerificat
|
|
|
538
538
|
export type { WebhookVerificationKeyGetResponse } from './models/webhookVerificationKeyGetResponse.js';
|
|
539
539
|
export type { YtdGrossIncomeSummaryFieldNumber } from './models/ytdGrossIncomeSummaryFieldNumber.js';
|
|
540
540
|
export type { YtdNetIncomeSummaryFieldNumber } from './models/ytdNetIncomeSummaryFieldNumber.js';
|
|
541
|
+
|
|
542
|
+
// Stainless-parity customizations (hand-written; see plaidApi.ts / plaidEnvironments.ts)
|
|
543
|
+
export { PlaidApi, DEFAULT_PLAID_VERSION } from './plaidApi.js';
|
|
544
|
+
export { PlaidEnvironments } from './plaidEnvironments.js';
|
package/src/plaidApi.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plaid
|
|
3
|
+
*
|
|
4
|
+
* Stainless-parity customization (hand-written, not generated by APIMatic).
|
|
5
|
+
*
|
|
6
|
+
* Provides a single `PlaidApi` facade that mirrors the shape of the official
|
|
7
|
+
* `plaid-node` (Stainless / OpenAPI-Generator) SDK: one class, constructed with
|
|
8
|
+
* `new PlaidApi(config)`, exposing every endpoint as a flat, fully-typed method
|
|
9
|
+
* (e.g. `plaid.authGet(...)`, `plaid.accountsGet(...)`).
|
|
10
|
+
*
|
|
11
|
+
* Under the hood it still uses APIMatic's modular controllers and the
|
|
12
|
+
* `@apimatic/core` runtime — a single shared `Client` backs all controllers,
|
|
13
|
+
* and their methods are mixed onto the facade instance. No controller files are
|
|
14
|
+
* modified, so this stays compatible across regenerations.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { Client } from './client.js';
|
|
18
|
+
import { Configuration } from './configuration.js';
|
|
19
|
+
import { AccountsApi } from './controllers/accountsApi.js';
|
|
20
|
+
import { ApplicationApi } from './controllers/applicationApi.js';
|
|
21
|
+
import { AssetReportApi } from './controllers/assetReportApi.js';
|
|
22
|
+
import { AuthApi } from './controllers/authApi.js';
|
|
23
|
+
import { BankTransferApi } from './controllers/bankTransferApi.js';
|
|
24
|
+
import { CategoriesApi } from './controllers/categoriesApi.js';
|
|
25
|
+
import { DepositSwitchApi } from './controllers/depositSwitchApi.js';
|
|
26
|
+
import { EmployersApi } from './controllers/employersApi.js';
|
|
27
|
+
import { IdentityApi } from './controllers/identityApi.js';
|
|
28
|
+
import { IncomeApi } from './controllers/incomeApi.js';
|
|
29
|
+
import { InstitutionsApi } from './controllers/institutionsApi.js';
|
|
30
|
+
import { InvestmentsApi } from './controllers/investmentsApi.js';
|
|
31
|
+
import { ItemApi } from './controllers/itemApi.js';
|
|
32
|
+
import { LiabilitiesApi } from './controllers/liabilitiesApi.js';
|
|
33
|
+
import { LinkApi } from './controllers/linkApi.js';
|
|
34
|
+
import { PaymentInitiationApi } from './controllers/paymentInitiationApi.js';
|
|
35
|
+
import { ProcessorApi } from './controllers/processorApi.js';
|
|
36
|
+
import { SandboxApi } from './controllers/sandboxApi.js';
|
|
37
|
+
import { SignalApi } from './controllers/signalApi.js';
|
|
38
|
+
import { TransactionsApi } from './controllers/transactionsApi.js';
|
|
39
|
+
import { TransferApi } from './controllers/transferApi.js';
|
|
40
|
+
import { WebhookVerificationKeyApi } from './controllers/webhookVerificationKeyApi.js';
|
|
41
|
+
|
|
42
|
+
/** Default Plaid API version header, matching the official plaid-node SDK. */
|
|
43
|
+
export const DEFAULT_PLAID_VERSION = '2020-09-14';
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The flat surface of `PlaidApi`: the union of every controller's endpoint
|
|
47
|
+
* methods, so `new PlaidApi(config)` exposes all endpoints directly.
|
|
48
|
+
*/
|
|
49
|
+
export type PlaidApi = AccountsApi &
|
|
50
|
+
ApplicationApi &
|
|
51
|
+
AssetReportApi &
|
|
52
|
+
AuthApi &
|
|
53
|
+
BankTransferApi &
|
|
54
|
+
CategoriesApi &
|
|
55
|
+
DepositSwitchApi &
|
|
56
|
+
EmployersApi &
|
|
57
|
+
IdentityApi &
|
|
58
|
+
IncomeApi &
|
|
59
|
+
InstitutionsApi &
|
|
60
|
+
InvestmentsApi &
|
|
61
|
+
ItemApi &
|
|
62
|
+
LiabilitiesApi &
|
|
63
|
+
LinkApi &
|
|
64
|
+
PaymentInitiationApi &
|
|
65
|
+
ProcessorApi &
|
|
66
|
+
SandboxApi &
|
|
67
|
+
SignalApi &
|
|
68
|
+
TransactionsApi &
|
|
69
|
+
TransferApi &
|
|
70
|
+
WebhookVerificationKeyApi;
|
|
71
|
+
|
|
72
|
+
class PlaidApiClient {
|
|
73
|
+
constructor(config?: Partial<Configuration>) {
|
|
74
|
+
const merged: Partial<Configuration> = { ...config };
|
|
75
|
+
// Mirror plaid-node, which sends `Plaid-Version: 2020-09-14` by default.
|
|
76
|
+
if (!merged.plaidVersionCredentials) {
|
|
77
|
+
merged.plaidVersionCredentials = { 'Plaid-Version': DEFAULT_PLAID_VERSION };
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const client = new Client(merged);
|
|
81
|
+
const controllers = [
|
|
82
|
+
new AccountsApi(client),
|
|
83
|
+
new ApplicationApi(client),
|
|
84
|
+
new AssetReportApi(client),
|
|
85
|
+
new AuthApi(client),
|
|
86
|
+
new BankTransferApi(client),
|
|
87
|
+
new CategoriesApi(client),
|
|
88
|
+
new DepositSwitchApi(client),
|
|
89
|
+
new EmployersApi(client),
|
|
90
|
+
new IdentityApi(client),
|
|
91
|
+
new IncomeApi(client),
|
|
92
|
+
new InstitutionsApi(client),
|
|
93
|
+
new InvestmentsApi(client),
|
|
94
|
+
new ItemApi(client),
|
|
95
|
+
new LiabilitiesApi(client),
|
|
96
|
+
new LinkApi(client),
|
|
97
|
+
new PaymentInitiationApi(client),
|
|
98
|
+
new ProcessorApi(client),
|
|
99
|
+
new SandboxApi(client),
|
|
100
|
+
new SignalApi(client),
|
|
101
|
+
new TransactionsApi(client),
|
|
102
|
+
new TransferApi(client),
|
|
103
|
+
new WebhookVerificationKeyApi(client),
|
|
104
|
+
];
|
|
105
|
+
|
|
106
|
+
// Flatten every controller's endpoint methods onto this instance. Method
|
|
107
|
+
// names are unique across controllers, so there are no collisions. Each
|
|
108
|
+
// method is bound to its controller so `this.createRequest` stays intact.
|
|
109
|
+
for (const controller of controllers) {
|
|
110
|
+
const proto = Object.getPrototypeOf(controller);
|
|
111
|
+
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
112
|
+
if (name === 'constructor') {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const value = (controller as unknown as Record<string, unknown>)[name];
|
|
116
|
+
if (typeof value === 'function') {
|
|
117
|
+
(this as unknown as Record<string, unknown>)[name] = value.bind(
|
|
118
|
+
controller
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* A single client for the entire Plaid API.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* const plaid = new PlaidApi({
|
|
131
|
+
* environment: Environment.Sandbox,
|
|
132
|
+
* plaidClientIdCredentials: { 'PLAID-CLIENT-ID': clientId },
|
|
133
|
+
* plaidSecretCredentials: { 'PLAID-SECRET': secret },
|
|
134
|
+
* });
|
|
135
|
+
* const { result } = await plaid.authGet({ accessToken });
|
|
136
|
+
*/
|
|
137
|
+
export const PlaidApi = PlaidApiClient as unknown as {
|
|
138
|
+
new (config?: Partial<Configuration>): PlaidApi;
|
|
139
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plaid
|
|
3
|
+
*
|
|
4
|
+
* Stainless-parity customization (hand-written, not generated by APIMatic).
|
|
5
|
+
* Mirrors the `PlaidEnvironments` map exported by the official `plaid-node`
|
|
6
|
+
* SDK so consumers can reference base URLs by environment name.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface PlaidEnvironment {
|
|
10
|
+
[env: string]: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const PlaidEnvironments: PlaidEnvironment = {
|
|
14
|
+
production: 'https://production.plaid.com',
|
|
15
|
+
sandbox: 'https://sandbox.plaid.com',
|
|
16
|
+
};
|