conductor-node 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 CHANGED
@@ -4,6 +4,11 @@ The Conductor Node.js library provides convenient access to the Conductor API fr
4
4
 
5
5
  There are zero dependencies.
6
6
 
7
+ ## Requirements
8
+
9
+ 1. A running version of QuickBooks Desktop with QuickBooks Web Connector configured for Conductor. See the [Conductor Getting Started guide](https://www.notion.so/conductor-io/Conductor-Documentation-Getting-Started-7f0f42593d444337b0b3200c771d98e6) for help.
10
+ 2. A Conductor API key from Danny.
11
+
7
12
  ## Installation
8
13
 
9
14
  ```sh
@@ -0,0 +1,6 @@
1
+ import type { QBXMLRequest, QBXMLResponse } from "@conductor/client/qbXMLTypes";
2
+ export default class Client {
3
+ private readonly apiKey;
4
+ constructor(apiKey: string);
5
+ sendRequest<T extends QBXMLRequest>(qbwcUsername: string, requestObj: T): Promise<QBXMLResponse<T>>;
6
+ }
@@ -6,14 +6,17 @@ class Client {
6
6
  this.apiKey = apiKey;
7
7
  }
8
8
  async sendRequest(qbwcUsername, requestObj) {
9
- return fetch("https://conductor.ngrok.io", {
9
+ const response = await fetch("https://conductor.ngrok.io", {
10
10
  body: JSON.stringify({ qbwcUsername, requestObj }),
11
11
  headers: {
12
12
  "Content-Type": "application/json",
13
13
  Authorization: `Bearer ${this.apiKey}`,
14
14
  },
15
15
  method: "POST",
16
- }).then((res) => res.json());
16
+ });
17
+ const responseJSON = (await response.json());
18
+ console.log("Client received response:", responseJSON);
19
+ return responseJSON;
17
20
  }
18
21
  }
19
22
  exports.default = Client;
@@ -0,0 +1,98 @@
1
+ export interface AccountAddRq {
2
+ AccountAdd: AccountAdd;
3
+ }
4
+ export interface AccountAddRs {
5
+ AccountRet?: AccountRet;
6
+ }
7
+ interface AccountAdd {
8
+ Name: string;
9
+ IsActive?: boolean;
10
+ ParentRef?: ParentRef;
11
+ AccountType: AccountType;
12
+ AccountNumber?: string;
13
+ BankNumber?: string;
14
+ Desc?: string;
15
+ OpenBalance?: string;
16
+ OpenBalanceDate?: Date;
17
+ SalesTaxCodeRef?: SalesTaxCodeRef;
18
+ TaxLineID?: number;
19
+ CurrencyRef?: CurrencyRef;
20
+ }
21
+ export interface AccountQueryRq {
22
+ ListID?: string;
23
+ FullName?: string;
24
+ MaxReturned?: number;
25
+ ActiveStatus?: ActiveStatus;
26
+ FromModifiedDate?: Date;
27
+ ToModifiedDate?: Date;
28
+ NameFilter?: NameFilter;
29
+ NameRangeFilter?: NameRangeFilter;
30
+ AccountType?: AccountType;
31
+ CurrencyFilter?: CurrencyFilter;
32
+ }
33
+ export interface AccountQueryRs {
34
+ AccountRet?: AccountRet;
35
+ }
36
+ interface AccountRet {
37
+ ListID: string;
38
+ TimeCreated: string;
39
+ TimeModified: string;
40
+ EditSequence: string;
41
+ Name: string;
42
+ FullName: string;
43
+ IsActive?: boolean;
44
+ ParentRef?: ParentRef;
45
+ Sublevel: number;
46
+ AccountType: AccountType;
47
+ SpecialAccountType?: SpecialAccountType;
48
+ IsTaxAccount?: boolean;
49
+ AccountNumber?: string;
50
+ BankNumber?: string;
51
+ Desc?: string;
52
+ Balance?: string;
53
+ TotalBalance?: string;
54
+ SalesTaxCodeRef?: SalesTaxCodeRef;
55
+ TaxLineInfoRet?: {
56
+ TaxLineID: number;
57
+ TaxLineName?: string;
58
+ };
59
+ CashFlowClassification?: CashFlowClassification;
60
+ CurrencyRef?: CurrencyRef;
61
+ DataExtRet?: {
62
+ OwnerID?: string;
63
+ DataExtName: string;
64
+ DataExtType: DataExtType;
65
+ DataExtValue: string;
66
+ };
67
+ }
68
+ interface NameFilter {
69
+ MatchCriterion: MatchCriterion;
70
+ Name: string;
71
+ }
72
+ interface NameRangeFilter {
73
+ FromName?: string;
74
+ ToName?: string;
75
+ }
76
+ interface CurrencyFilter {
77
+ ListID?: string;
78
+ FullName?: string;
79
+ }
80
+ declare type MatchCriterion = "Contains" | "EndsWith" | "StartsWith";
81
+ declare type ActiveStatus = "ActiveOnly" | "All" | "InactiveOnly";
82
+ interface ParentRef {
83
+ ListID?: string;
84
+ FullName?: string;
85
+ }
86
+ interface SalesTaxCodeRef {
87
+ ListID?: string;
88
+ FullName?: string;
89
+ }
90
+ interface CurrencyRef {
91
+ ListID?: string;
92
+ FullName?: string;
93
+ }
94
+ declare type AccountType = "AccountsPayable" | "AccountsReceivable" | "Bank" | "CostOfGoodsSold" | "CreditCard" | "Equity" | "Expense" | "FixedAsset" | "Income" | "LongTermLiability" | "NonPosting" | "OtherAsset" | "OtherCurrentAsset" | "OtherCurrentLiability" | "OtherExpense" | "OtherIncome";
95
+ declare type SpecialAccountType = "AccountsPayable" | "AccountsReceivable" | "CondenseItemAdjustmentExpenses" | "CostOfGoodsSold" | "DirectDepositLiabilities" | "Estimates" | "ExchangeGainLoss" | "InventoryAssets" | "ItemReceiptAccount" | "OpeningBalanceEquity" | "PayrollExpenses" | "PayrollLiabilities" | "PettyCash" | "PurchaseOrders" | "ReconciliationDifferences" | "RetainedEarnings" | "SalesOrders" | "SalesTaxPayable" | "UncategorizedExpenses" | "UncategorizedIncome" | "UndepositedFunds";
96
+ declare type CashFlowClassification = "Financing" | "Investing" | "None" | "NotApplicable" | "Operating";
97
+ declare type DataExtType = "AMTTYPE" | "Date" | "number" | "PERCENTTYPE" | "PRICETYPE" | "QUANTYPE" | "STR255TYPE" | "STR1024TYPE";
98
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,15 @@
1
+ import type { AccountAddRq, AccountAddRs, AccountQueryRq, AccountQueryRs } from "@conductor/client/qbXMLTypes/Account";
2
+ export declare type QBXMLRequest = {
3
+ AccountAddRq: AccountAddRq;
4
+ } | {
5
+ AccountQueryRq: AccountQueryRq;
6
+ };
7
+ declare type GetSubtype<T> = T extends {
8
+ [key: string]: infer U;
9
+ } ? U : never;
10
+ export declare type QBXMLResponse<T extends QBXMLRequest> = GetSubtype<T> extends AccountAddRq ? {
11
+ AccountAddRs: AccountAddRs;
12
+ } : GetSubtype<T> extends AccountQueryRq ? {
13
+ AccountQueryRs: AccountQueryRs;
14
+ } : unknown;
15
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../node_modules/typescript/lib/lib.esnext.full.d.ts","../src/qbxmltypes/account.ts","../src/qbxmltypes/index.ts","../src/client.ts","../../../node_modules/@types/node/assert.d.ts","../../../node_modules/@types/node/assert/strict.d.ts","../../../node_modules/@types/node/globals.d.ts","../../../node_modules/@types/node/async_hooks.d.ts","../../../node_modules/@types/node/buffer.d.ts","../../../node_modules/@types/node/child_process.d.ts","../../../node_modules/@types/node/cluster.d.ts","../../../node_modules/@types/node/console.d.ts","../../../node_modules/@types/node/constants.d.ts","../../../node_modules/@types/node/crypto.d.ts","../../../node_modules/@types/node/dgram.d.ts","../../../node_modules/@types/node/diagnostics_channel.d.ts","../../../node_modules/@types/node/dns.d.ts","../../../node_modules/@types/node/dns/promises.d.ts","../../../node_modules/@types/node/domain.d.ts","../../../node_modules/@types/node/events.d.ts","../../../node_modules/@types/node/fs.d.ts","../../../node_modules/@types/node/fs/promises.d.ts","../../../node_modules/@types/node/http.d.ts","../../../node_modules/@types/node/http2.d.ts","../../../node_modules/@types/node/https.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/module.d.ts","../../../node_modules/@types/node/net.d.ts","../../../node_modules/@types/node/os.d.ts","../../../node_modules/@types/node/path.d.ts","../../../node_modules/@types/node/perf_hooks.d.ts","../../../node_modules/@types/node/process.d.ts","../../../node_modules/@types/node/punycode.d.ts","../../../node_modules/@types/node/querystring.d.ts","../../../node_modules/@types/node/readline.d.ts","../../../node_modules/@types/node/readline/promises.d.ts","../../../node_modules/@types/node/repl.d.ts","../../../node_modules/@types/node/stream.d.ts","../../../node_modules/@types/node/stream/promises.d.ts","../../../node_modules/@types/node/stream/consumers.d.ts","../../../node_modules/@types/node/stream/web.d.ts","../../../node_modules/@types/node/string_decoder.d.ts","../../../node_modules/@types/node/test.d.ts","../../../node_modules/@types/node/timers.d.ts","../../../node_modules/@types/node/timers/promises.d.ts","../../../node_modules/@types/node/tls.d.ts","../../../node_modules/@types/node/trace_events.d.ts","../../../node_modules/@types/node/tty.d.ts","../../../node_modules/@types/node/url.d.ts","../../../node_modules/@types/node/util.d.ts","../../../node_modules/@types/node/v8.d.ts","../../../node_modules/@types/node/vm.d.ts","../../../node_modules/@types/node/wasi.d.ts","../../../node_modules/@types/node/worker_threads.d.ts","../../../node_modules/@types/node/zlib.d.ts","../../../node_modules/@types/node/globals.global.d.ts","../../../node_modules/@types/node/index.d.ts","../../../node_modules/keyv/src/index.d.ts","../../../node_modules/@types/http-cache-semantics/index.d.ts","../../../node_modules/@types/responselike/index.d.ts","../../../node_modules/@types/cacheable-request/index.d.ts","../../../node_modules/@types/json-buffer/index.d.ts","../../../node_modules/@types/json-schema/index.d.ts","../../../node_modules/@types/json5/index.d.ts","../../../node_modules/@types/keyv/index.d.ts","../../../node_modules/@types/uuid/index.d.ts","../../../node_modules/@types/yauzl/index.d.ts"],"fileInfos":[{"version":"f5c28122bee592cfaf5c72ed7bcc47f453b79778ffa6e301f45d21a0970719d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","impliedFormat":1},{"version":"7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","impliedFormat":1},{"version":"8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","impliedFormat":1},{"version":"5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","impliedFormat":1},{"version":"e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","impliedFormat":1},{"version":"1fc5ab7a764205c68fa10d381b08417795fc73111d6dd16b5b1ed36badb743d9","impliedFormat":1},{"version":"746d62152361558ea6d6115cf0da4dd10ede041d14882ede3568bce5dc4b4f1f","impliedFormat":1},{"version":"3eb679a56cab01203a1ba7edeade937f6a2a4c718513b2cd930b579807fa9359","impliedFormat":1},{"version":"aea179452def8a6152f98f63b191b84e7cbd69b0e248c91e61fb2e52328abe8c","impliedFormat":1},{"version":"3f149f903dd20dfeb7c80e228b659f0e436532de772469980dbd00702cc05cc1","affectsGlobalScope":true,"impliedFormat":1},{"version":"1272277fe7daa738e555eb6cc45ded42cc2d0f76c07294142283145d49e96186","affectsGlobalScope":true,"impliedFormat":1},{"version":"7fac8cb5fc820bc2a59ae11ef1c5b38d3832c6d0dfaec5acdb5569137d09a481","affectsGlobalScope":true,"impliedFormat":1},{"version":"097a57355ded99c68e6df1b738990448e0bf170e606707df5a7c0481ff2427cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"adb996790133eb33b33aadb9c09f15c2c575e71fb57a62de8bf74dbf59ec7dfb","affectsGlobalScope":true,"impliedFormat":1},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true,"impliedFormat":1},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5c05907c02476e4bde6b7e76a79ffcd948aedd14b6a8f56e4674221b0417398","affectsGlobalScope":true,"impliedFormat":1},{"version":"0d5f52b3174bee6edb81260ebcd792692c32c81fd55499d69531496f3f2b25e7","affectsGlobalScope":true,"impliedFormat":1},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true,"impliedFormat":1},{"version":"181f1784c6c10b751631b24ce60c7f78b20665db4550b335be179217bacc0d5f","affectsGlobalScope":true,"impliedFormat":1},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true,"impliedFormat":1},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true,"impliedFormat":1},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true,"impliedFormat":1},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true,"impliedFormat":1},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true,"impliedFormat":1},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true,"impliedFormat":1},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true,"impliedFormat":1},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d154ea5bb7f7f9001ed9153e876b2d5b8f5c2bb9ec02b3ae0d239ec769f1f2ae","affectsGlobalScope":true,"impliedFormat":1},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true,"impliedFormat":1},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true,"impliedFormat":1},{"version":"6e7997ef61de3132e4d4b2250e75343f487903ddf5370e7ce33cf1b9db9a63ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true,"impliedFormat":1},{"version":"09aa50414b80c023553090e2f53827f007a301bc34b0495bfb2c3c08ab9ad1eb","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7f680a43f8cd12a6b6122c07c54ba40952b0c8aa140dcfcf32eb9e6cb028596","affectsGlobalScope":true,"impliedFormat":1},{"version":"3787b83e297de7c315d55d4a7c546ae28e5f6c0a361b7a1dcec1f1f50a54ef11","affectsGlobalScope":true,"impliedFormat":1},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true,"impliedFormat":1},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true,"impliedFormat":1},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd483c056da900716879771893a3c9772b66c3c88f8943b4205aec738a94b1d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"b248e32ca52e8f5571390a4142558ae4f203ae2f94d5bac38a3084d529ef4e58","affectsGlobalScope":true,"impliedFormat":1},{"version":"6c55633c733c8378db65ac3da7a767c3cf2cf3057f0565a9124a16a3a2019e87","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true,"impliedFormat":1},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true,"impliedFormat":1},{"version":"ff667ee99e5a28c3dc5063a3cfd4d3436699e3fb035d4451037da7f567da542a","affectsGlobalScope":true,"impliedFormat":1},{"version":"34478567f8a80171f88f2f30808beb7da15eac0538ae91282dd33dce928d98ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"6ea9ab679ea030cf46c16a711a316078e9e02619ebaf07a7fcd16964aba88f2d","affectsGlobalScope":true,"impliedFormat":1},{"version":"6bda95ea27a59a276e46043b7065b55bd4b316c25e70e29b572958fa77565d43","affectsGlobalScope":true,"impliedFormat":1},{"version":"aedb8de1abb2ff1095c153854a6df7deae4a5709c37297f9d6e9948b6806fa66","affectsGlobalScope":true,"impliedFormat":1},{"version":"11ffe3c281f375fff9ffdde8bbec7669b4dd671905509079f866f2354a788064","affectsGlobalScope":true,"impliedFormat":1},{"version":"c37f8a49593a0030eecb51bbfa270e709bec9d79a6cc3bb851ef348d4e6b26f8","affectsGlobalScope":true,"impliedFormat":1},{"version":"d96fa8a56871904776165ceb8e00bd56127e1a017bb2664cae76223b5f815141","impliedFormat":1},{"version":"f7447abe766081241f8e24208dc11a28db2b3b11f2d130a6f090cafedf2e6ad6","signature":"97426fdfa22c55f53db5a95d04f09a728e0e5a5418c1f963f294f70fc3ed7a36","impliedFormat":1},{"version":"480b8b231a26b5e4dbd4e306b1caeb2809fababe3a8c2ec805f25a71f7672ea9","signature":"3065cb95c6bdd883dc567e7e755507448e4aa00728ab94bfea4e78a65629d0da","impliedFormat":1},{"version":"0345af3c59c3c47473fa19012ddf5e4ed6a75870941d2572032161ae1bd216aa","signature":"dce713224062a81db3a319f766cebf8a6624ae145fe882440fa787abd567cf37","impliedFormat":1},{"version":"9122ed7070e054b73ebab37c2373a196def2d90e7d1a9a7fcd9d46b0e51fae78","impliedFormat":1},{"version":"a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a","impliedFormat":1},{"version":"77f0b5c6a193a699c9f7d7fb0578e64e562d271afa740783665d2a827104a873","affectsGlobalScope":true,"impliedFormat":1},{"version":"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9","impliedFormat":1},{"version":"002d6d5f044365b3fbfba0ba9be3bb57cac09b81547c8df4b0795755d2081d90","affectsGlobalScope":true,"impliedFormat":1},{"version":"0c0cee62cb619aed81133b904f644515ba3064487002a7da83fd8aa07b1b4abd","impliedFormat":1},{"version":"5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713","impliedFormat":1},{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true,"impliedFormat":1},{"version":"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","impliedFormat":1},{"version":"c4cfc9a6e2ebb8bc8c0e2392dfc4056993ced3b35069ebf132ac18ca7a562881","impliedFormat":1},{"version":"bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","impliedFormat":1},{"version":"75ecef44f126e2ae018b4abbd85b6e8a2e2ba1638ebec56cc64274643ce3567b","impliedFormat":1},{"version":"f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","impliedFormat":1},{"version":"14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","impliedFormat":1},{"version":"5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea","impliedFormat":1},{"version":"bae4ea23beb8397755b935cb84d3cdc6cdb0b1b4a329b90de9fc6c8774d71994","affectsGlobalScope":true,"impliedFormat":1},{"version":"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","impliedFormat":1},{"version":"df36874d9e56aff601e921c4b3971d37cf66d14f6455935ce821e6cad13b1823","impliedFormat":1},{"version":"68915895d4a136df5cf5f90aaa41d8e1e47ec047e7781a150b5d0cf273dbb7a9","impliedFormat":1},{"version":"acfbb5aaef964e1d441f961a1846197f03241dba3c63b1e4d1903684888ef465","impliedFormat":1},{"version":"09416dd69576b03a3f485adf329a02f043e4a481e060ef5b208194e488d31fd9","impliedFormat":1},{"version":"2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58","impliedFormat":1},{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true,"impliedFormat":1},{"version":"76527127c8b749bee5977408861ce3ee56ec19ddcea8704c628f98ca610283e6","impliedFormat":1},{"version":"a907bf91df26df2400858ef75f749498fb5cf00062bf90a737ac3949cc07978d","impliedFormat":1},{"version":"cb92bc2e42b261e4299025756f1beb826b3d9666a3f0d46f8a7254ca512f57e4","impliedFormat":1},{"version":"cb4f3f03480e1727eae46400606cecaa97f550186ff8fa909ebc00db4180531b","impliedFormat":1},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true,"impliedFormat":1},{"version":"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","impliedFormat":1},{"version":"d1a78a3c5708807e8de3e399f91df4797c62e44b02195eefc2209b2e713e54ee","impliedFormat":1},{"version":"36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","impliedFormat":1},{"version":"0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","impliedFormat":1},{"version":"25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","impliedFormat":1},{"version":"556bf5c36deb62cffa1bf697c1789fe008ec82db0273025001db66732714e9d9","impliedFormat":1},{"version":"1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","impliedFormat":1},{"version":"806ef4cac3b3d9fa4a48d849c8e084d7c72fcd7b16d76e06049a9ed742ff79c0","affectsGlobalScope":true,"impliedFormat":1},{"version":"44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","impliedFormat":1},{"version":"23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","impliedFormat":1},{"version":"0830071706fa0e477fb5e95f0955cc1062b5948b146b7d4e03a126f12ad6085f","impliedFormat":1},{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true,"impliedFormat":1},{"version":"664d8f2d59164f2e08c543981453893bc7e003e4dfd29651ce09db13e9457980","impliedFormat":1},{"version":"4c8525f256873c7ba3135338c647eaf0ca7115a1a2805ae2d0056629461186ce","impliedFormat":1},{"version":"3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","impliedFormat":1},{"version":"5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2","impliedFormat":1},{"version":"bfe39beb986d2a2e512c091cbe924f1c415bc65de54de0e2f6a0dc6f84c183d9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2d526e6f21d8cc66ac11ada32874e95ae88d870c6c9d3d9d4e03b1d1f9ad7b8e","impliedFormat":1},{"version":"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","impliedFormat":1},{"version":"ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","impliedFormat":1},{"version":"e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa","impliedFormat":1},{"version":"d2ec52f565f0570e90b659811347bd689f8c6039b11eaaccd0f243759d46da6e","impliedFormat":1},{"version":"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e","impliedFormat":1},{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a12806a1bde5e9f137bb79728d87a4ceaedf04e95efc9967d3288a3c252d9a7b","impliedFormat":1},{"version":"a7d9d2a35530516e191ade6dc804d7de42d45ff6620c0319cfb4469dbdbd8044","impliedFormat":1},{"version":"cab425b5559edac18327eb2c3c0f47e7e9f71b667290b7689faafd28aac69eae","impliedFormat":1},{"version":"3cfb0cb51cc2c2e1b313d7c4df04dbf7e5bda0a133c6b309bf6af77cf614b971","impliedFormat":1},{"version":"f992cd6cc0bcbaa4e6c810468c90f2d8595f8c6c3cf050c806397d3de8585562","impliedFormat":1},{"version":"75bdc1b420f0ffc6cc6fd0b6694d89f5072bf755b4e6c7e65a2fda797ca0bb8a","impliedFormat":1},{"version":"f3e604694b624fa3f83f6684185452992088f5efb2cf136b62474aa106d6f1b6","impliedFormat":1},{"version":"96d14f21b7652903852eef49379d04dbda28c16ed36468f8c9fa08f7c14c9538","impliedFormat":1},{"version":"fec943fdb3275eb6e006b35e04a8e2e99e9adf3f4b969ddf15315ac7575a93e4","impliedFormat":1},{"version":"fab58e600970e66547644a44bc9918e3223aa2cbd9e8763cec004b2cfb48827e","impliedFormat":1},{"version":"65dfa4bc49ccd1355789abb6ae215b302a5b050fdee9651124fe7e826f33113c","impliedFormat":1}],"options":{"allowSyntheticDefaultImports":true,"allowUnreachableCode":false,"allowUnusedLabels":false,"declaration":true,"esModuleInterop":true,"exactOptionalPropertyTypes":true,"module":199,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noImplicitReturns":true,"noUncheckedIndexedAccess":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":99},"fileIdsList":[[76,79,105,106,113,114,115,116],[106],[76,106,113],[61,106],[64,106],[65,70,106],[66,76,77,84,94,105,106],[66,67,76,84,106],[68,106],[69,70,77,85,106],[70,94,102,106],[71,73,76,84,106],[72,106],[73,74,106],[75,76,106],[76,106],[76,77,78,94,105,106],[76,77,78,94,97,106],[106,110],[79,84,94,105,106],[76,77,79,80,84,94,102,105,106],[79,81,94,102,105,106],[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],[76,82,106],[83,105,106],[73,76,84,94,106],[85,106],[86,106],[64,87,106],[88,104,106,110],[89,106],[90,106],[76,91,92,106],[91,93,106,108],[76,94,95,96,97,106],[94,96,106],[94,95,106],[97,106],[98,106],[76,100,101,106],[100,101,106],[70,84,94,102,106],[103,106],[84,104,106],[65,79,90,105,106],[70,106],[94,106,107],[106,108],[106,109],[65,70,76,78,87,94,105,106,108,110],[94,106,111],[79,94,106,113],[76,94,106,113],[59,106],[58,106],[59],[58]],"referencedMap":[[117,1],[115,2],[118,2],[119,2],[120,2],[121,3],[61,4],[62,4],[64,5],[65,6],[66,7],[67,8],[68,9],[69,10],[70,11],[71,12],[72,13],[73,14],[74,14],[75,15],[76,16],[77,17],[78,18],[63,19],[112,2],[79,20],[80,21],[81,22],[113,23],[82,24],[83,25],[84,26],[85,27],[86,28],[87,29],[88,30],[89,31],[90,32],[91,33],[92,33],[93,34],[94,35],[96,36],[95,37],[97,38],[98,39],[99,2],[100,40],[101,41],[102,42],[103,43],[104,44],[105,45],[106,46],[107,47],[108,48],[109,49],[110,50],[111,51],[116,52],[122,2],[123,53],[114,16],[11,2],[12,2],[16,2],[15,2],[2,2],[17,2],[18,2],[19,2],[20,2],[21,2],[22,2],[23,2],[24,2],[3,2],[4,2],[28,2],[25,2],[26,2],[27,2],[29,2],[30,2],[31,2],[5,2],[32,2],[33,2],[34,2],[35,2],[6,2],[36,2],[37,2],[38,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[51,2],[9,2],[52,2],[53,2],[54,2],[55,2],[1,2],[10,2],[57,2],[56,2],[14,2],[13,2],[60,54],[58,2],[59,55]],"exportedModulesMap":[[117,1],[115,2],[118,2],[119,2],[120,2],[121,3],[61,4],[62,4],[64,5],[65,6],[66,7],[67,8],[68,9],[69,10],[70,11],[71,12],[72,13],[73,14],[74,14],[75,15],[76,16],[77,17],[78,18],[63,19],[112,2],[79,20],[80,21],[81,22],[113,23],[82,24],[83,25],[84,26],[85,27],[86,28],[87,29],[88,30],[89,31],[90,32],[91,33],[92,33],[93,34],[94,35],[96,36],[95,37],[97,38],[98,39],[99,2],[100,40],[101,41],[102,42],[103,43],[104,44],[105,45],[106,46],[107,47],[108,48],[109,49],[110,50],[111,51],[116,52],[122,2],[123,53],[114,16],[11,2],[12,2],[16,2],[15,2],[2,2],[17,2],[18,2],[19,2],[20,2],[21,2],[22,2],[23,2],[24,2],[3,2],[4,2],[28,2],[25,2],[26,2],[27,2],[29,2],[30,2],[31,2],[5,2],[32,2],[33,2],[34,2],[35,2],[6,2],[36,2],[37,2],[38,2],[39,2],[7,2],[40,2],[45,2],[46,2],[41,2],[42,2],[43,2],[44,2],[8,2],[50,2],[47,2],[48,2],[49,2],[51,2],[9,2],[52,2],[53,2],[54,2],[55,2],[1,2],[10,2],[57,2],[56,2],[14,2],[13,2],[60,56],[59,57]],"semanticDiagnosticsPerFile":[117,115,118,119,120,121,61,62,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,63,112,79,80,81,113,82,83,84,85,86,87,88,89,90,91,92,93,94,96,95,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,116,122,123,114,11,12,16,15,2,17,18,19,20,21,22,23,24,3,4,28,25,26,27,29,30,31,5,32,33,34,35,6,36,37,38,39,7,40,45,46,41,42,43,44,8,50,47,48,49,51,9,52,53,54,55,1,10,57,56,14,13,60,58,59]},"version":"4.7.4"}
package/package.json CHANGED
@@ -1,15 +1,11 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "0.0.2",
3
+ "version": "0.0.5",
4
4
  "description": "Conductor API wrapper",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
- "repository": "git@github.com:conductor-io/conductor-node.git",
7
- "main": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "dist/Client.js",
7
+ "types": "dist/Client.d.ts",
9
8
  "scripts": {
10
- "prepublish": "tsc"
11
- },
12
- "devDependencies": {
13
- "typescript": "^4.7.4"
9
+ "prepublish": "yarn tsc"
14
10
  }
15
11
  }
package/src/Client.ts ADDED
@@ -0,0 +1,26 @@
1
+ import type { QBXMLRequest, QBXMLResponse } from "@conductor/client/qbXMLTypes";
2
+
3
+ export default class Client {
4
+ private readonly apiKey: string;
5
+
6
+ public constructor(apiKey: string) {
7
+ this.apiKey = apiKey;
8
+ }
9
+
10
+ public async sendRequest<T extends QBXMLRequest>(
11
+ qbwcUsername: string,
12
+ requestObj: T
13
+ ): Promise<QBXMLResponse<T>> {
14
+ const response = await fetch("https://conductor.ngrok.io", {
15
+ body: JSON.stringify({ qbwcUsername, requestObj }),
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ Authorization: `Bearer ${this.apiKey}`,
19
+ },
20
+ method: "POST",
21
+ });
22
+ const responseJSON = (await response.json()) as QBXMLResponse<T>;
23
+ console.log("Client received response:", responseJSON);
24
+ return responseJSON;
25
+ }
26
+ }
@@ -0,0 +1,169 @@
1
+ // https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/accountadd
2
+ export interface AccountAddRq {
3
+ AccountAdd: AccountAdd;
4
+ }
5
+
6
+ export interface AccountAddRs {
7
+ AccountRet?: AccountRet;
8
+ }
9
+
10
+ interface AccountAdd {
11
+ Name: string;
12
+ IsActive?: boolean;
13
+ ParentRef?: ParentRef;
14
+ AccountType: AccountType;
15
+ AccountNumber?: string;
16
+ BankNumber?: string;
17
+ Desc?: string;
18
+ OpenBalance?: string;
19
+ OpenBalanceDate?: Date;
20
+ SalesTaxCodeRef?: SalesTaxCodeRef;
21
+ TaxLineID?: number;
22
+ CurrencyRef?: CurrencyRef;
23
+ }
24
+
25
+ // https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/accountquery
26
+ // FIXME: This does not account for the use of "OR" and "may repeat" in the
27
+ // XMLOps, which might indicate using an array.
28
+ export interface AccountQueryRq {
29
+ ListID?: string;
30
+ FullName?: string;
31
+ MaxReturned?: number;
32
+ ActiveStatus?: ActiveStatus;
33
+ FromModifiedDate?: Date;
34
+ ToModifiedDate?: Date;
35
+ NameFilter?: NameFilter;
36
+ NameRangeFilter?: NameRangeFilter;
37
+ AccountType?: AccountType;
38
+ CurrencyFilter?: CurrencyFilter;
39
+ }
40
+
41
+ export interface AccountQueryRs {
42
+ AccountRet?: AccountRet;
43
+ }
44
+
45
+ interface AccountRet {
46
+ ListID: string;
47
+ TimeCreated: string;
48
+ TimeModified: string;
49
+ EditSequence: string;
50
+ Name: string;
51
+ FullName: string;
52
+ IsActive?: boolean;
53
+ ParentRef?: ParentRef;
54
+ Sublevel: number;
55
+ AccountType: AccountType;
56
+ SpecialAccountType?: SpecialAccountType;
57
+ IsTaxAccount?: boolean;
58
+ AccountNumber?: string;
59
+ BankNumber?: string;
60
+ Desc?: string;
61
+ Balance?: string;
62
+ TotalBalance?: string;
63
+ SalesTaxCodeRef?: SalesTaxCodeRef;
64
+ TaxLineInfoRet?: {
65
+ TaxLineID: number;
66
+ TaxLineName?: string;
67
+ };
68
+ CashFlowClassification?: CashFlowClassification;
69
+ CurrencyRef?: CurrencyRef;
70
+ DataExtRet?: {
71
+ OwnerID?: string;
72
+ DataExtName: string;
73
+ DataExtType: DataExtType;
74
+ DataExtValue: string;
75
+ };
76
+ }
77
+
78
+ interface NameFilter {
79
+ MatchCriterion: MatchCriterion;
80
+ Name: string;
81
+ }
82
+
83
+ interface NameRangeFilter {
84
+ FromName?: string;
85
+ ToName?: string;
86
+ }
87
+
88
+ interface CurrencyFilter {
89
+ ListID?: string;
90
+ FullName?: string;
91
+ }
92
+
93
+ type MatchCriterion = "Contains" | "EndsWith" | "StartsWith";
94
+
95
+ // Default is `ActiveOnly`
96
+ type ActiveStatus = "ActiveOnly" | "All" | "InactiveOnly";
97
+
98
+ interface ParentRef {
99
+ ListID?: string;
100
+ FullName?: string;
101
+ }
102
+
103
+ interface SalesTaxCodeRef {
104
+ ListID?: string;
105
+ FullName?: string;
106
+ }
107
+
108
+ interface CurrencyRef {
109
+ ListID?: string;
110
+ FullName?: string;
111
+ }
112
+
113
+ type AccountType =
114
+ | "AccountsPayable"
115
+ | "AccountsReceivable"
116
+ | "Bank"
117
+ | "CostOfGoodsSold"
118
+ | "CreditCard"
119
+ | "Equity"
120
+ | "Expense"
121
+ | "FixedAsset"
122
+ | "Income"
123
+ | "LongTermLiability"
124
+ | "NonPosting"
125
+ | "OtherAsset"
126
+ | "OtherCurrentAsset"
127
+ | "OtherCurrentLiability"
128
+ | "OtherExpense"
129
+ | "OtherIncome";
130
+
131
+ type SpecialAccountType =
132
+ | "AccountsPayable"
133
+ | "AccountsReceivable"
134
+ | "CondenseItemAdjustmentExpenses"
135
+ | "CostOfGoodsSold"
136
+ | "DirectDepositLiabilities"
137
+ | "Estimates"
138
+ | "ExchangeGainLoss"
139
+ | "InventoryAssets"
140
+ | "ItemReceiptAccount"
141
+ | "OpeningBalanceEquity"
142
+ | "PayrollExpenses"
143
+ | "PayrollLiabilities"
144
+ | "PettyCash"
145
+ | "PurchaseOrders"
146
+ | "ReconciliationDifferences"
147
+ | "RetainedEarnings"
148
+ | "SalesOrders"
149
+ | "SalesTaxPayable"
150
+ | "UncategorizedExpenses"
151
+ | "UncategorizedIncome"
152
+ | "UndepositedFunds";
153
+
154
+ type CashFlowClassification =
155
+ | "Financing"
156
+ | "Investing"
157
+ | "None"
158
+ | "NotApplicable"
159
+ | "Operating";
160
+
161
+ type DataExtType =
162
+ | "AMTTYPE"
163
+ | "Date"
164
+ | "number"
165
+ | "PERCENTTYPE"
166
+ | "PRICETYPE"
167
+ | "QUANTYPE"
168
+ | "STR255TYPE"
169
+ | "STR1024TYPE";
@@ -0,0 +1,18 @@
1
+ import type {
2
+ AccountAddRq,
3
+ AccountAddRs,
4
+ AccountQueryRq,
5
+ AccountQueryRs,
6
+ } from "@conductor/client/qbXMLTypes/Account";
7
+
8
+ export type QBXMLRequest =
9
+ | { AccountAddRq: AccountAddRq }
10
+ | { AccountQueryRq: AccountQueryRq };
11
+
12
+ type GetSubtype<T> = T extends { [key: string]: infer U } ? U : never;
13
+
14
+ // prettier-ignore
15
+ export type QBXMLResponse<T extends QBXMLRequest>
16
+ = GetSubtype<T> extends AccountAddRq ? { AccountAddRs: AccountAddRs }
17
+ : GetSubtype<T> extends AccountQueryRq ? { AccountQueryRs: AccountQueryRs }
18
+ : unknown;
package/tsconfig.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
+ "extends": "../../tsconfig.json",
3
+ // All settings below are required for publishing to npm.
2
4
  "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "NodeNext",
5
- // Required for npm.
5
+ // Overriding root config.
6
+ "noEmit": false,
7
+ // Output the `.d.ts` files for TypeScript to use with the transpiled
8
+ // JavaScript files.
6
9
  "declaration": true,
7
10
  "outDir": "./dist"
8
11
  }
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export default class Client {
2
- private readonly apiKey;
3
- constructor(apiKey: string);
4
- sendRequest(qbwcUsername: string, requestObj: object): Promise<object>;
5
- }
package/index.ts DELETED
@@ -1,21 +0,0 @@
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
- }