conductor-node 11.0.0 → 11.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.
- package/README.md +50 -54
- package/dist/package.json +1 -1
- package/dist/src/Client.d.ts +6 -1
- package/dist/src/Client.js +6 -1
- package/dist/src/resources/EndUsersResource.d.ts +1 -1
- package/dist/src/utils/error.d.ts +3 -0
- package/dist/src/utils/error.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,11 +32,11 @@ import Conductor from "conductor-node";
|
|
|
32
32
|
// Instantiate `Conductor` with your account's secret key.
|
|
33
33
|
const conductor = new Conductor("sk_test_...");
|
|
34
34
|
|
|
35
|
-
// Fetch all authorized
|
|
36
|
-
const
|
|
35
|
+
// Fetch all authorized end-users.
|
|
36
|
+
const endUsers = await conductor.endUsers.list();
|
|
37
37
|
|
|
38
|
-
// Execute any QBD API against your
|
|
39
|
-
const newAccount = await conductor.qbd.account.add(
|
|
38
|
+
// Execute any QBD API against your end-user.
|
|
39
|
+
const newAccount = await conductor.qbd.account.add(endUsers[0].id, {
|
|
40
40
|
Name: "Test Account",
|
|
41
41
|
AccountType: "Bank",
|
|
42
42
|
OpenBalance: "100",
|
|
@@ -45,29 +45,31 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
|
|
|
45
45
|
|
|
46
46
|
## APIs
|
|
47
47
|
|
|
48
|
-
### `
|
|
48
|
+
### `qbd.*`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Executes any QuickBooks Desktop (QBD) API against the specified end-user. See the official [QuickBooks Desktop API Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) for a complete list of available APIs.
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
const
|
|
53
|
+
const qbdAccount = await conductor.qbd.account.add(endUserId, {
|
|
54
|
+
Name: "Test Account",
|
|
55
|
+
AccountType: "Bank",
|
|
56
|
+
OpenBalance: "100",
|
|
57
|
+
});
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
### `
|
|
60
|
+
### `endUsers.create(input: EndUserCreateInput)`
|
|
57
61
|
|
|
58
|
-
Creates a new
|
|
62
|
+
Creates a new end-user.
|
|
59
63
|
|
|
60
64
|
```ts
|
|
61
|
-
const
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// distinct from your other connections for the same integration.
|
|
66
|
-
endUserSourceId: "1234-abcd",
|
|
65
|
+
const newEndUser = await conductor.endUsers.create({
|
|
66
|
+
// Your end-user's unique ID in *your* database. Must be
|
|
67
|
+
// distinct from your other end-users.
|
|
68
|
+
sourceId: "1234-abcd",
|
|
67
69
|
// Your end-user's email address.
|
|
68
|
-
|
|
70
|
+
email: "danny@constructionco.com",
|
|
69
71
|
// Your end-user's company name shown elsewhere in Conductor.
|
|
70
|
-
|
|
72
|
+
name: "Construction Corp",
|
|
71
73
|
});
|
|
72
74
|
```
|
|
73
75
|
|
|
@@ -76,25 +78,31 @@ The response looks like the following:
|
|
|
76
78
|
```ts
|
|
77
79
|
{
|
|
78
80
|
// ❗ Save this `id` to your database for executing requests to this
|
|
79
|
-
// end-user's integration in the future.
|
|
80
|
-
id: '
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
endUserCompanyName: 'Construction Corp',
|
|
81
|
+
// end-user's integration(s) in the future.
|
|
82
|
+
id: 'end_usr_1234abcd',
|
|
83
|
+
sourceId: "1234-abcd",
|
|
84
|
+
email: 'danny@construction.com',
|
|
85
|
+
name: 'Construction Corp',
|
|
85
86
|
}
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
### `
|
|
89
|
+
### `endUsers.list()`
|
|
90
|
+
|
|
91
|
+
Returns a list of all end-users associated with your Conductor account.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
const endUsers = await conductor.endUsers.list();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `endUsers.retrieve(id: string)`
|
|
89
98
|
|
|
90
|
-
Retrieves the specified
|
|
99
|
+
Retrieves the specified end-User.
|
|
91
100
|
|
|
92
101
|
```ts
|
|
93
|
-
const
|
|
94
|
-
await conductor.integrationConnections.retrieve(qbdConnectionId);
|
|
102
|
+
const endUser = await conductor.endUsers.retrieve(endUserId);
|
|
95
103
|
```
|
|
96
104
|
|
|
97
|
-
### `
|
|
105
|
+
### `endUsers.ping(id: string, integrationSlug: string)`
|
|
98
106
|
|
|
99
107
|
Checks whether the specified integration-connection can connect and process requests end-to-end.
|
|
100
108
|
|
|
@@ -104,7 +112,7 @@ Using `async`/`await`:
|
|
|
104
112
|
|
|
105
113
|
```ts
|
|
106
114
|
try {
|
|
107
|
-
await conductor.
|
|
115
|
+
await conductor.endUsers.ping(endUserId, "quickbooks-desktop");
|
|
108
116
|
} catch (error) {
|
|
109
117
|
if (error instanceof ConductorError) {
|
|
110
118
|
// Update your app's UI to display `error.userFacingMessage`.
|
|
@@ -116,7 +124,7 @@ try {
|
|
|
116
124
|
Or in the form of a rejected promise:
|
|
117
125
|
|
|
118
126
|
```ts
|
|
119
|
-
conductor.
|
|
127
|
+
conductor.endUsers.ping(endUserId, "quickbooks-desktop").catch((error) => {
|
|
120
128
|
if (error instanceof ConductorError) {
|
|
121
129
|
// Update your app's UI to display `error.userFacingMessage`.
|
|
122
130
|
}
|
|
@@ -124,23 +132,11 @@ conductor.integrationConnections.ping(qbdConnectionId).catch((error) => {
|
|
|
124
132
|
});
|
|
125
133
|
```
|
|
126
134
|
|
|
127
|
-
### `qbd.*`
|
|
128
|
-
|
|
129
|
-
Executes any QuickBooks Desktop (QBD) API against a specific integration-connection id. See the official [QuickBooks Desktop API Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) for a complete list of available APIs.
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
133
|
-
Name: "Test Account",
|
|
134
|
-
AccountType: "Bank",
|
|
135
|
-
OpenBalance: "100",
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
135
|
## TypeScript
|
|
140
136
|
|
|
141
137
|
Access the entire QuickBooks Desktop API through TypeScript. The `qbd.*` APIs are fully typed with inline documentation and will autocomplete in your editor.
|
|
142
138
|
|
|
143
|
-
To
|
|
139
|
+
To access the QBD types directly, import them from `conductor-node` like so:
|
|
144
140
|
|
|
145
141
|
```ts
|
|
146
142
|
import { QbdTypes } from "conductor-node";
|
|
@@ -173,15 +169,15 @@ All errors thrown by the Conductor API are instances of `ConductorError` or its
|
|
|
173
169
|
|
|
174
170
|
The error object you receive will have one of the following error types:
|
|
175
171
|
|
|
176
|
-
| Name | Description
|
|
177
|
-
| ------------------------------------- |
|
|
178
|
-
| `ConductorIntegrationError` | Raised when the third-party integration encounters an error while processing the end-user's request. This often results from an issue with the request or data handling that requires your attention to resolve.<br><br>E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an accounting value you supplied did not adhere to the integration's accounting rules.<br><br>Refer to `error.integrationCode` for the error code returned by the integration, if available.
|
|
179
|
-
| `ConductorIntegrationConnectionError` | Raised when a connection error occurs with the third-party integration on the end-user's side. This typically indicates an issue with the end-user's integration-connection or configuration, which they must resolve. In other words, you cannot take action to fix these errors.<br><br>E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop on the end-user's computer.<br><br>Refer to `error.integrationCode` for the error code returned by the integration connector, if available.<br><br>❗ We recommend _not_
|
|
180
|
-
| `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way.
|
|
181
|
-
| `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key.
|
|
182
|
-
| `ConductorPermissionError` | Raised when you attempt to access a resource that is not allowed.
|
|
183
|
-
| `ConductorConnectionError` | Raised when there was a network problem between the client (on your server) and Conductor's servers. E.g., a downed network or a bad TLS certificate.
|
|
184
|
-
| `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.)
|
|
172
|
+
| Name | Description |
|
|
173
|
+
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `ConductorIntegrationError` | Raised when the third-party integration encounters an error while processing the end-user's request. This often results from an issue with the request or data handling that requires your attention to resolve.<br><br>E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an accounting value you supplied did not adhere to the integration's accounting rules.<br><br>Refer to `error.integrationCode` for the error code returned by the integration, if available. |
|
|
175
|
+
| `ConductorIntegrationConnectionError` | Raised when a connection error occurs with the third-party integration on the end-user's side. This typically indicates an issue with the end-user's integration-connection or configuration, which they must resolve. In other words, you cannot take action to fix these errors.<br><br>E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop on the end-user's computer.<br><br>Refer to `error.integrationCode` for the error code returned by the integration connector, if available.<br><br>❗ We recommend _not_ triggering alerts for these errors because only the end-user can fix them. See [Global Error Handling](#global-error-handling) for an example of this. |
|
|
176
|
+
| `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way. |
|
|
177
|
+
| `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
|
|
178
|
+
| `ConductorPermissionError` | Raised when you attempt to access a resource that is not allowed. |
|
|
179
|
+
| `ConductorConnectionError` | Raised when there was a network problem between the client (on your server) and Conductor's servers. E.g., a downed network or a bad TLS certificate. |
|
|
180
|
+
| `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.) |
|
|
185
181
|
|
|
186
182
|
### Specific Error Handling
|
|
187
183
|
|
|
@@ -191,7 +187,7 @@ Using `async`/`await`:
|
|
|
191
187
|
|
|
192
188
|
```ts
|
|
193
189
|
try {
|
|
194
|
-
const newAccount = await conductor.qbd.account.add(
|
|
190
|
+
const newAccount = await conductor.qbd.account.add(endUserId, {
|
|
195
191
|
Name: "Test Account",
|
|
196
192
|
AccountType: "Bank",
|
|
197
193
|
OpenBalance: "100",
|
|
@@ -209,7 +205,7 @@ Or in the form of a rejected promise:
|
|
|
209
205
|
|
|
210
206
|
```ts
|
|
211
207
|
conductor.qbd.account
|
|
212
|
-
.add(
|
|
208
|
+
.add(endUserId, {
|
|
213
209
|
Name: "Test Account",
|
|
214
210
|
AccountType: "Bank",
|
|
215
211
|
OpenBalance: "100",
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -12,7 +12,12 @@ export interface ClientOptions {
|
|
|
12
12
|
export default class Client {
|
|
13
13
|
readonly endUsers: EndUsersResource;
|
|
14
14
|
readonly integrationConnections: IntegrationConnectionsResource;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Executes any QuickBooks Desktop (QBD) API against the specified end-user.
|
|
17
|
+
* See the official [QuickBooks Desktop API
|
|
18
|
+
* Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop)
|
|
19
|
+
* for a complete list of available APIs.
|
|
20
|
+
*/
|
|
16
21
|
readonly qbd: QbdIntegration;
|
|
17
22
|
private readonly httpClient;
|
|
18
23
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
package/dist/src/Client.js
CHANGED
|
@@ -15,7 +15,12 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
15
15
|
class Client {
|
|
16
16
|
endUsers;
|
|
17
17
|
integrationConnections;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Executes any QuickBooks Desktop (QBD) API against the specified end-user.
|
|
20
|
+
* See the official [QuickBooks Desktop API
|
|
21
|
+
* Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop)
|
|
22
|
+
* for a complete list of available APIs.
|
|
23
|
+
*/
|
|
19
24
|
qbd;
|
|
20
25
|
httpClient;
|
|
21
26
|
constructor(apiKey, { verbose = false, serverEnvironment = "production" } = {}) {
|
|
@@ -6,7 +6,7 @@ export interface EndUser {
|
|
|
6
6
|
*/
|
|
7
7
|
readonly id: string;
|
|
8
8
|
/**
|
|
9
|
-
* Your end-user's unique ID in your database. Must be distinct from your
|
|
9
|
+
* Your end-user's unique ID in *your* database. Must be distinct from your
|
|
10
10
|
* other end-users.
|
|
11
11
|
*/
|
|
12
12
|
readonly sourceId: string;
|
|
@@ -122,6 +122,9 @@ export declare class ConductorIntegrationError extends ConductorError {
|
|
|
122
122
|
*
|
|
123
123
|
* Refer to `error.integrationCode` for the error code returned by the
|
|
124
124
|
* integration connector, if available.
|
|
125
|
+
*
|
|
126
|
+
* ❗ We recommend _not_ triggering alerts for these errors because only the
|
|
127
|
+
* end-user can fix them.
|
|
125
128
|
*/
|
|
126
129
|
export declare class ConductorIntegrationConnectionError extends ConductorError {
|
|
127
130
|
static readonly rawType = "INTEGRATION_CONNECTION_ERROR";
|
package/dist/src/utils/error.js
CHANGED
|
@@ -139,6 +139,9 @@ exports.ConductorIntegrationError = ConductorIntegrationError;
|
|
|
139
139
|
*
|
|
140
140
|
* Refer to `error.integrationCode` for the error code returned by the
|
|
141
141
|
* integration connector, if available.
|
|
142
|
+
*
|
|
143
|
+
* ❗ We recommend _not_ triggering alerts for these errors because only the
|
|
144
|
+
* end-user can fix them.
|
|
142
145
|
*/
|
|
143
146
|
class ConductorIntegrationConnectionError extends ConductorError {
|
|
144
147
|
static rawType = "INTEGRATION_CONNECTION_ERROR";
|