conductor-node 0.0.0
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 +32 -0
- package/package.json +11 -0
- package/src/Client.ts +21 -0
- package/tsconfig.json +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Conductor Node.js Library
|
|
2
|
+
|
|
3
|
+
The Conductor Node library provides convenient access to the Conductor API from applications written in server-side JavaScript.
|
|
4
|
+
|
|
5
|
+
There are zero dependencies.
|
|
6
|
+
|
|
7
|
+
Currently supports executing any [QuickBooks Desktop API](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) via JSON and receiving the response in JSON. In the future, these API will have extensive TypeScript typings.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
yarn add conductor-node
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
The package must be configured with your account's secret key, which is available from Danny.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import Conductor from "conductor";
|
|
21
|
+
const conductor = new Conductor("sk_test_...");
|
|
22
|
+
|
|
23
|
+
conductor
|
|
24
|
+
.sendRequest("mock_qbwc_username", {
|
|
25
|
+
CustomerQueryRq: {
|
|
26
|
+
MaxReturned: 1,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
.then((customer) => {
|
|
30
|
+
console.log("Response:", customer);
|
|
31
|
+
});
|
|
32
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "conductor-node",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "Conductor API wrapper",
|
|
5
|
+
"author": "Danny Nemer <hi@DannyNemer.com>",
|
|
6
|
+
"repository": "git@github.com:conductor-io/conductor-node.git",
|
|
7
|
+
"main": "src/Client.ts",
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"typescript": "^4.7.4"
|
|
10
|
+
}
|
|
11
|
+
}
|
package/src/Client.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export default class Client {
|
|
2
|
+
private readonly apiKey: string;
|
|
3
|
+
|
|
4
|
+
public constructor(apiKey: string) {
|
|
5
|
+
this.apiKey = apiKey;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
public async sendRequest(
|
|
9
|
+
qbwcUsername: string,
|
|
10
|
+
requestObj: object
|
|
11
|
+
): Promise<object> {
|
|
12
|
+
return fetch("https://conductor.ngrok.io", {
|
|
13
|
+
body: JSON.stringify({ qbwcUsername, requestObj }),
|
|
14
|
+
headers: {
|
|
15
|
+
"Content-Type": "application/json",
|
|
16
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
17
|
+
},
|
|
18
|
+
method: "POST",
|
|
19
|
+
}).then((res) => res.json());
|
|
20
|
+
}
|
|
21
|
+
}
|