conductor-node 8.1.0 → 8.2.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",
@@ -1,10 +1,10 @@
1
- import type { GraphqlCreateIntegrationConnectionInput, GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery, GraphqlSendIntegrationRequestInput, GraphqlSendIntegrationRequestMutation } from "./graphql/__generated__/operationTypes";
1
+ import type { GraphqlCreateIntegrationConnectionInput, GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery } from "./graphql/__generated__/operationTypes";
2
2
  import QbdIntegration from "./integrations/qbd/QbdIntegration";
3
- import type { Environment } from "./utils/environment";
3
+ import { getServerUrlForEnvironment } from "./utils";
4
4
  export interface ClientOptions {
5
5
  /** Log each request and response. */
6
6
  readonly verbose?: boolean;
7
- readonly serverEnvironment?: Environment;
7
+ readonly serverEnvironment?: Parameters<typeof getServerUrlForEnvironment>[0];
8
8
  }
9
9
  export default class Client {
10
10
  /** QuickBooks Desktop integration. */
@@ -12,7 +12,18 @@ export default class Client {
12
12
  private readonly graphqlClient;
13
13
  private readonly graphqlOperations;
14
14
  constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
15
+ /**
16
+ * Fetch the specified integration-connection.
17
+ *
18
+ * @param integrationConnectionId The integration-connection ID.
19
+ * @returns The integration-connection.
20
+ */
15
21
  getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
22
+ /**
23
+ * Fetch all integration-connections associated with your Conductor account.
24
+ *
25
+ * @returns The integration-connections.
26
+ */
16
27
  getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
17
28
  /**
18
29
  * Check whether we can successfully connect to the end-user's QBD instance.
@@ -22,22 +33,21 @@ export default class Client {
22
33
  * QBD is not running, the wrong company file is open, or there is a modal
23
34
  * dialog open in QBD.
24
35
  *
25
- * @param integrationConnectionId The ID of the integration connection.
26
- * @returns result Object with the following properties:
27
- * @returns result.isConnected Whether we can connect to the end-user's QBD.
28
- * @returns result.error If `isConnected=false`, this will be an object with
29
- * the following properties:
30
- * @returns result.error.code The unique error code.
31
- * @returns result.error.developerMessage The technical error message for the
32
- * developer.
33
- * @returns result.error.endUserMessage The user-friendly error message to
34
- * display to the the end-user.
36
+ * @param integrationConnectionId The ID of the integration-connection.
37
+ * @returns The result object with the following properties:
38
+ * - isConnected - Whether we can connect to the end-user's QBD.
39
+ * - error - If `isConnected=false`, this will be an object with the following
40
+ * properties:
41
+ * - error.code - The unique error code.
42
+ * - error.developerMessage - The technical error message for the developer.
43
+ * - error.endUserMessage - The user-friendly error message to display to
44
+ * the the end-user.
35
45
  */
36
46
  getConnectionStatus(integrationConnectionId: GraphqlGetConnectionStatusQueryVariables["integrationConnectionId"]): Promise<GraphqlGetConnectionStatusQuery["integrationConnection"]["connectionStatus"]>;
37
47
  /**
38
- * Create a new integration connection.
48
+ * Create a new integration-connection.
39
49
  *
40
- * @param input - The input object to create the integration connection.
50
+ * @param input - The input object to create the integration-connection.
41
51
  * @param input.integrationKey The identifier of the third-party platform to
42
52
  * integrate.
43
53
  * @param input.endUserSourceId Your end-user's unique ID in your product's
@@ -47,11 +57,10 @@ export default class Client {
47
57
  * only. No emails will be sent.
48
58
  * @param input.endUserCompanyName Your end-user's company name that will be
49
59
  * shown elsewhere in Conductor.
50
- * @returns The newly created integration connection.
60
+ * @returns The newly created integration-connection.
51
61
  */
52
62
  createIntegrationConnection(input: GraphqlCreateIntegrationConnectionInput & {
53
63
  integrationKey: "quickbooks-desktop";
54
64
  }): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]["integrationConnection"]>;
55
- /** Not intended for public use. */
56
- sendIntegrationRequest(input: GraphqlSendIntegrationRequestInput): Promise<GraphqlSendIntegrationRequestMutation["sendIntegrationRequest"]["response"]>;
65
+ private createHeaders;
57
66
  }
@@ -7,8 +7,7 @@ const package_json_1 = __importDefault(require("./../package.json"));
7
7
  const graphqlOperationWrapper_1 = require("./graphql/graphqlOperationWrapper");
8
8
  const operationTypes_1 = require("./graphql/__generated__/operationTypes");
9
9
  const QbdIntegration_1 = __importDefault(require("./integrations/qbd/QbdIntegration"));
10
- const checkForUpdates_1 = __importDefault(require("./utils/checkForUpdates"));
11
- const environment_1 = require("./utils/environment");
10
+ const utils_1 = require("./utils");
12
11
  const graphql_request_1 = require("graphql-request");
13
12
  class Client {
14
13
  /** QuickBooks Desktop integration. */
@@ -16,21 +15,27 @@ class Client {
16
15
  graphqlClient;
17
16
  graphqlOperations;
18
17
  constructor(apiKey, { verbose = false, serverEnvironment = "production" } = {}) {
19
- (0, checkForUpdates_1.default)();
20
- this.graphqlClient = new graphql_request_1.GraphQLClient(`${(0, environment_1.getServerUrlForEnvironment)(serverEnvironment)}/graphql`, {
21
- headers: {
22
- Authorization: `Bearer ${apiKey}`,
23
- "User-Agent": `${package_json_1.default.name}/${package_json_1.default.version} (Node.js ${process.version}; ${process.platform} ${process.arch})`,
24
- },
25
- });
18
+ (0, utils_1.checkForUpdates)();
19
+ this.graphqlClient = new graphql_request_1.GraphQLClient(`${(0, utils_1.getServerUrlForEnvironment)(serverEnvironment)}/graphql`, { headers: this.createHeaders(apiKey) });
26
20
  this.graphqlOperations = (0, graphqlOperationWrapper_1.wrapGraphqlOperations)((0, operationTypes_1.getSdk)(this.graphqlClient), verbose);
27
- this.qbd = new QbdIntegration_1.default(this);
21
+ this.qbd = new QbdIntegration_1.default(this.graphqlOperations);
28
22
  }
23
+ /**
24
+ * Fetch the specified integration-connection.
25
+ *
26
+ * @param integrationConnectionId The integration-connection ID.
27
+ * @returns The integration-connection.
28
+ */
29
29
  async getIntegrationConnection(integrationConnectionId) {
30
30
  return this.graphqlOperations
31
31
  .getIntegrationConnection({ integrationConnectionId })
32
32
  .then((result) => result.integrationConnection);
33
33
  }
34
+ /**
35
+ * Fetch all integration-connections associated with your Conductor account.
36
+ *
37
+ * @returns The integration-connections.
38
+ */
34
39
  async getIntegrationConnections() {
35
40
  return this.graphqlOperations
36
41
  .getIntegrationConnections()
@@ -44,16 +49,15 @@ class Client {
44
49
  * QBD is not running, the wrong company file is open, or there is a modal
45
50
  * dialog open in QBD.
46
51
  *
47
- * @param integrationConnectionId The ID of the integration connection.
48
- * @returns result Object with the following properties:
49
- * @returns result.isConnected Whether we can connect to the end-user's QBD.
50
- * @returns result.error If `isConnected=false`, this will be an object with
51
- * the following properties:
52
- * @returns result.error.code The unique error code.
53
- * @returns result.error.developerMessage The technical error message for the
54
- * developer.
55
- * @returns result.error.endUserMessage The user-friendly error message to
56
- * display to the the end-user.
52
+ * @param integrationConnectionId The ID of the integration-connection.
53
+ * @returns The result object with the following properties:
54
+ * - isConnected - Whether we can connect to the end-user's QBD.
55
+ * - error - If `isConnected=false`, this will be an object with the following
56
+ * properties:
57
+ * - error.code - The unique error code.
58
+ * - error.developerMessage - The technical error message for the developer.
59
+ * - error.endUserMessage - The user-friendly error message to display to
60
+ * the the end-user.
57
61
  */
58
62
  async getConnectionStatus(integrationConnectionId) {
59
63
  return this.graphqlOperations
@@ -61,9 +65,9 @@ class Client {
61
65
  .then((result) => result.integrationConnection.connectionStatus);
62
66
  }
63
67
  /**
64
- * Create a new integration connection.
68
+ * Create a new integration-connection.
65
69
  *
66
- * @param input - The input object to create the integration connection.
70
+ * @param input - The input object to create the integration-connection.
67
71
  * @param input.integrationKey The identifier of the third-party platform to
68
72
  * integrate.
69
73
  * @param input.endUserSourceId Your end-user's unique ID in your product's
@@ -73,19 +77,18 @@ class Client {
73
77
  * only. No emails will be sent.
74
78
  * @param input.endUserCompanyName Your end-user's company name that will be
75
79
  * shown elsewhere in Conductor.
76
- * @returns The newly created integration connection.
80
+ * @returns The newly created integration-connection.
77
81
  */
78
82
  async createIntegrationConnection(input) {
79
83
  return this.graphqlOperations
80
84
  .createIntegrationConnection({ input })
81
85
  .then((result) => result.createIntegrationConnection.integrationConnection);
82
86
  }
83
- // TODO: Find a way to make this private.
84
- /** Not intended for public use. */
85
- async sendIntegrationRequest(input) {
86
- return this.graphqlOperations
87
- .sendIntegrationRequest({ input })
88
- .then((result) => result.sendIntegrationRequest.response);
87
+ createHeaders(apiKey) {
88
+ return {
89
+ Authorization: `Bearer ${apiKey}`,
90
+ "User-Agent": `${package_json_1.default.name}/${package_json_1.default.version} (Node.js ${process.version}; ${process.platform} ${process.arch})`,
91
+ };
89
92
  }
90
93
  }
91
94
  exports.default = Client;
@@ -3,4 +3,4 @@ export declare function wrapGraphqlOperations<T extends ReturnType<typeof getSdk
3
3
  export declare function graphqlOperationWrapper<V extends {
4
4
  [key: string]: unknown;
5
5
  }, R>(operationName: string, variables: V | undefined, operation: (variables: V | undefined) => Promise<R>, verbose: boolean): Promise<R>;
6
- export declare function formatGraphqlError(error: Error): Error;
6
+ export declare function formatError(error: Error): Error;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.formatGraphqlError = exports.graphqlOperationWrapper = exports.wrapGraphqlOperations = void 0;
6
+ exports.formatError = exports.graphqlOperationWrapper = exports.wrapGraphqlOperations = void 0;
7
7
  const package_json_1 = __importDefault(require("../../package.json"));
8
8
  const graphql_request_1 = require("graphql-request");
9
9
  const node_util_1 = __importDefault(require("node:util"));
@@ -44,7 +44,7 @@ async function graphqlOperationWrapper(operationName, variables, operation, verb
44
44
  return result;
45
45
  }
46
46
  catch (error) {
47
- const formattedError = formatGraphqlError(error);
47
+ const formattedError = formatError(error);
48
48
  if (verbose) {
49
49
  const errorInfo = {
50
50
  duration: getDurationString(startTime),
@@ -58,7 +58,7 @@ async function graphqlOperationWrapper(operationName, variables, operation, verb
58
58
  }
59
59
  }
60
60
  exports.graphqlOperationWrapper = graphqlOperationWrapper;
61
- function formatGraphqlError(error) {
61
+ function formatError(error) {
62
62
  if (error instanceof graphql_request_1.ClientError) {
63
63
  const { response } = error;
64
64
  if ([404, 502, 503].includes(response.status)) {
@@ -79,7 +79,7 @@ function formatGraphqlError(error) {
79
79
  }
80
80
  return error;
81
81
  }
82
- exports.formatGraphqlError = formatGraphqlError;
82
+ exports.formatError = formatError;
83
83
  function getDurationString(startTime) {
84
84
  const duration = Date.now() - startTime;
85
85
  return `${Math.round(duration / 10) / 100}s`;
@@ -1,5 +1,8 @@
1
1
  import type Client from "../Client";
2
+ import type { GraphqlSendIntegrationRequestInput, GraphqlSendIntegrationRequestMutation } from "../graphql/__generated__/operationTypes";
2
3
  export default class BaseIntegration {
3
- protected readonly client: Client;
4
- constructor(client: Client);
4
+ private readonly graphqlOperations;
5
+ constructor(graphqlOperations: Client["graphqlOperations"]);
6
+ /** Not intended for public use. */
7
+ protected sendIntegrationRequest(input: GraphqlSendIntegrationRequestInput): Promise<GraphqlSendIntegrationRequestMutation["sendIntegrationRequest"]["response"]>;
5
8
  }
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class BaseIntegration {
4
- client;
5
- constructor(client) {
6
- this.client = client;
4
+ graphqlOperations;
5
+ constructor(graphqlOperations) {
6
+ this.graphqlOperations = graphqlOperations;
7
+ }
8
+ /** Not intended for public use. */
9
+ async sendIntegrationRequest(input) {
10
+ return this.graphqlOperations
11
+ .sendIntegrationRequest({ input })
12
+ .then((result) => result.sendIntegrationRequest.response);
7
13
  }
8
14
  }
9
15
  exports.default = BaseIntegration;
@@ -283,6 +283,40 @@ export default class QbdIntegration extends BaseIntegration {
283
283
  */
284
284
  query: (integrationConnectionId: string, params: QbdTypes.BillPaymentCheckQueryRq) => Promise<NonNullable<QbdTypes.BillPaymentCheckQueryRs["BillPaymentCheckRet"]>>;
285
285
  };
286
+ charge: {
287
+ /**
288
+ * Adds a customer charge. A `Charge` contains information about a statement
289
+ * charge. (A `CreditCardCharge` object, on the other hand, refers to a
290
+ * credit card charge incurred by the QuickBooks user.)
291
+ *
292
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeAdd
293
+ */
294
+ add: (integrationConnectionId: string, params: QbdTypes.ChargeAddRq["ChargeAdd"]) => Promise<NonNullable<QbdTypes.ChargeAddRs["ChargeRet"]>>;
295
+ /**
296
+ * Modifies the specified charge.
297
+ *
298
+ * Some fields in a `ChargeMod` request cannot be cleared. If any of the
299
+ * following fields is included in a charge modify request, it must contain
300
+ * a value:
301
+ * - `CustomerRef`
302
+ * - `TxnDate`
303
+ * - `ItemRef`
304
+ * - `Quantity`
305
+ * - `Rate`
306
+ * - `Amount`
307
+ * - `ARAccountRef`
308
+ * - `OverrideItemAccountRef`
309
+ *
310
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeMod
311
+ */
312
+ mod: (integrationConnectionId: string, params: QbdTypes.ChargeModRq["ChargeMod"]) => Promise<NonNullable<QbdTypes.ChargeModRs["ChargeRet"]>>;
313
+ /**
314
+ * Returns information about statement charges.
315
+ *
316
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeQuery
317
+ */
318
+ query: (integrationConnectionId: string, params: QbdTypes.ChargeQueryRq) => Promise<NonNullable<QbdTypes.ChargeQueryRs["ChargeRet"]>>;
319
+ };
286
320
  check: {
287
321
  /**
288
322
  * The amount of a check is the total of the amounts assigned to expense
@@ -454,6 +488,52 @@ export default class QbdIntegration extends BaseIntegration {
454
488
  */
455
489
  query: (integrationConnectionId: string, params: QbdTypes.EmployeeQueryRq) => Promise<NonNullable<QbdTypes.EmployeeQueryRs["EmployeeRet"]>>;
456
490
  };
491
+ estimate: {
492
+ /**
493
+ * Adds an estimate. A QuickBooks estimate is a description of a sale that
494
+ * the QuickBooks user proposes to make to a current or prospective
495
+ * customer. An estimate might also be called a “bid” or a “proposal.” In
496
+ * QuickBooks, estimates and invoices use similar fields, and an estimate
497
+ * can be converted into an invoice after the customer accepts the estimate.
498
+ *
499
+ * An estimate is a non-posting transaction, so it does not affect a
500
+ * company’s balance sheet or income statement.
501
+ *
502
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateAdd
503
+ */
504
+ add: (integrationConnectionId: string, params: QbdTypes.EstimateAddRq["EstimateAdd"]) => Promise<NonNullable<QbdTypes.EstimateAddRs["EstimateRet"]>>;
505
+ /**
506
+ * Modifies the specified estimate.
507
+ *
508
+ * Some fields in an `EstimateMod` request cannot be cleared. If any of the
509
+ * following fields is included in an estimate modify request, it must
510
+ * contain a value:
511
+ * - `CustomerRef`
512
+ * - `TemplateRef`
513
+ * - `TxnDate`
514
+ * - `IsActive`
515
+ * - `CreateChangeOrder`
516
+ * - `DueDate`
517
+ * - `ItemSalesTaxRef`
518
+ *
519
+ * Within `EstimateLineMod` or `EstimateLineGroupMod`:
520
+ * - `ItemRef`
521
+ * - `Quantity`
522
+ * - `Rate`
523
+ * - `Amount`>
524
+ * - `SalesTaxCodeRef`
525
+ * - `Markup`
526
+ *
527
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateMod
528
+ */
529
+ mod: (integrationConnectionId: string, params: QbdTypes.EstimateModRq["EstimateMod"]) => Promise<NonNullable<QbdTypes.EstimateModRs["EstimateRet"]>>;
530
+ /**
531
+ * Queries for the specified estimate or set of estimates.
532
+ *
533
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateQuery
534
+ */
535
+ query: (integrationConnectionId: string, params: QbdTypes.EstimateQueryRq) => Promise<NonNullable<QbdTypes.EstimateQueryRs["EstimateRet"]>>;
536
+ };
457
537
  invoice: {
458
538
  /**
459
539
  * Adds an invoice.
@@ -788,6 +868,47 @@ export default class QbdIntegration extends BaseIntegration {
788
868
  */
789
869
  query: (integrationConnectionId: string, params: QbdTypes.TimeTrackingQueryRq) => Promise<NonNullable<QbdTypes.TimeTrackingQueryRs["TimeTrackingRet"]>>;
790
870
  };
871
+ purchaseOrder: {
872
+ /**
873
+ * Adds a purchase order, which is an order submitted to a vendor. You can
874
+ * use ItemReceiptAdd to receive items against a purchase order as items
875
+ * arrive from the vendor. A purchase order is a non-posting transaction, so
876
+ * it does not affect a company’s balance sheet or income statement.
877
+ *
878
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderQuery
879
+ */
880
+ add: (integrationConnectionId: string, params: QbdTypes.PurchaseOrderAddRq["PurchaseOrderAdd"]) => Promise<NonNullable<QbdTypes.PurchaseOrderAddRs["PurchaseOrderRet"]>>;
881
+ /**
882
+ * Modifies a purchase order.
883
+ *
884
+ * Some fields in a `PurchaseOrderMod` request cannot be cleared. If any of
885
+ * the following fields is included in a purchase order modify request, it
886
+ * must contain a value:
887
+ * - `TemplateRef`
888
+ * - `TxnDate`
889
+ * - `DueDate`
890
+ * - `ExpectedDate`
891
+ * - `IsManuallyClosed`
892
+ * - `IsToBePrinted`
893
+ *
894
+ * Within `PurchaseOrderLineMod` or `PurchaseOrderLineGroupMod`:
895
+ * - `ItemRef`
896
+ * - `Quantity`
897
+ * - `Rate`
898
+ * - `Amount`
899
+ * - `IsManuallyClosed`
900
+ * - `OverrideItemAccountRef`
901
+ *
902
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderMod
903
+ */
904
+ mod: (integrationConnectionId: string, params: QbdTypes.PurchaseOrderModRq["PurchaseOrderMod"]) => Promise<NonNullable<QbdTypes.PurchaseOrderModRs["PurchaseOrderRet"]>>;
905
+ /**
906
+ * Queries for the specified purchase order or set of orders.
907
+ *
908
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderQuery
909
+ */
910
+ query: (integrationConnectionId: string, params: QbdTypes.PurchaseOrderQueryRq) => Promise<NonNullable<QbdTypes.PurchaseOrderQueryRs["PurchaseOrderRet"]>>;
911
+ };
791
912
  vendor: {
792
913
  /**
793
914
  * Adds a vendor.
@@ -287,6 +287,40 @@ class QbdIntegration extends BaseIntegration_1.default {
287
287
  */
288
288
  query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { BillPaymentCheckQueryRq: params }, "BillPaymentCheckQueryRs", "BillPaymentCheckRet"),
289
289
  };
290
+ charge = {
291
+ /**
292
+ * Adds a customer charge. A `Charge` contains information about a statement
293
+ * charge. (A `CreditCardCharge` object, on the other hand, refers to a
294
+ * credit card charge incurred by the QuickBooks user.)
295
+ *
296
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeAdd
297
+ */
298
+ add: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { ChargeAddRq: { ChargeAdd: params } }, "ChargeAddRs", "ChargeRet"),
299
+ /**
300
+ * Modifies the specified charge.
301
+ *
302
+ * Some fields in a `ChargeMod` request cannot be cleared. If any of the
303
+ * following fields is included in a charge modify request, it must contain
304
+ * a value:
305
+ * - `CustomerRef`
306
+ * - `TxnDate`
307
+ * - `ItemRef`
308
+ * - `Quantity`
309
+ * - `Rate`
310
+ * - `Amount`
311
+ * - `ARAccountRef`
312
+ * - `OverrideItemAccountRef`
313
+ *
314
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeMod
315
+ */
316
+ mod: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { ChargeModRq: { ChargeMod: params } }, "ChargeModRs", "ChargeRet"),
317
+ /**
318
+ * Returns information about statement charges.
319
+ *
320
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ChargeQuery
321
+ */
322
+ query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { ChargeQueryRq: params }, "ChargeQueryRs", "ChargeRet"),
323
+ };
290
324
  check = {
291
325
  /**
292
326
  * The amount of a check is the total of the amounts assigned to expense
@@ -458,6 +492,52 @@ class QbdIntegration extends BaseIntegration_1.default {
458
492
  */
459
493
  query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { EmployeeQueryRq: params }, "EmployeeQueryRs", "EmployeeRet"),
460
494
  };
495
+ estimate = {
496
+ /**
497
+ * Adds an estimate. A QuickBooks estimate is a description of a sale that
498
+ * the QuickBooks user proposes to make to a current or prospective
499
+ * customer. An estimate might also be called a “bid” or a “proposal.” In
500
+ * QuickBooks, estimates and invoices use similar fields, and an estimate
501
+ * can be converted into an invoice after the customer accepts the estimate.
502
+ *
503
+ * An estimate is a non-posting transaction, so it does not affect a
504
+ * company’s balance sheet or income statement.
505
+ *
506
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateAdd
507
+ */
508
+ add: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { EstimateAddRq: { EstimateAdd: params } }, "EstimateAddRs", "EstimateRet"),
509
+ /**
510
+ * Modifies the specified estimate.
511
+ *
512
+ * Some fields in an `EstimateMod` request cannot be cleared. If any of the
513
+ * following fields is included in an estimate modify request, it must
514
+ * contain a value:
515
+ * - `CustomerRef`
516
+ * - `TemplateRef`
517
+ * - `TxnDate`
518
+ * - `IsActive`
519
+ * - `CreateChangeOrder`
520
+ * - `DueDate`
521
+ * - `ItemSalesTaxRef`
522
+ *
523
+ * Within `EstimateLineMod` or `EstimateLineGroupMod`:
524
+ * - `ItemRef`
525
+ * - `Quantity`
526
+ * - `Rate`
527
+ * - `Amount`>
528
+ * - `SalesTaxCodeRef`
529
+ * - `Markup`
530
+ *
531
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateMod
532
+ */
533
+ mod: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { EstimateModRq: { EstimateMod: params } }, "EstimateModRs", "EstimateRet"),
534
+ /**
535
+ * Queries for the specified estimate or set of estimates.
536
+ *
537
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/EstimateQuery
538
+ */
539
+ query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { EstimateQueryRq: params }, "EstimateQueryRs", "EstimateRet"),
540
+ };
461
541
  invoice = {
462
542
  /**
463
543
  * Adds an invoice.
@@ -792,6 +872,47 @@ class QbdIntegration extends BaseIntegration_1.default {
792
872
  */
793
873
  query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { TimeTrackingQueryRq: params }, "TimeTrackingQueryRs", "TimeTrackingRet"),
794
874
  };
875
+ purchaseOrder = {
876
+ /**
877
+ * Adds a purchase order, which is an order submitted to a vendor. You can
878
+ * use ItemReceiptAdd to receive items against a purchase order as items
879
+ * arrive from the vendor. A purchase order is a non-posting transaction, so
880
+ * it does not affect a company’s balance sheet or income statement.
881
+ *
882
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderQuery
883
+ */
884
+ add: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { PurchaseOrderAddRq: { PurchaseOrderAdd: params } }, "PurchaseOrderAddRs", "PurchaseOrderRet"),
885
+ /**
886
+ * Modifies a purchase order.
887
+ *
888
+ * Some fields in a `PurchaseOrderMod` request cannot be cleared. If any of
889
+ * the following fields is included in a purchase order modify request, it
890
+ * must contain a value:
891
+ * - `TemplateRef`
892
+ * - `TxnDate`
893
+ * - `DueDate`
894
+ * - `ExpectedDate`
895
+ * - `IsManuallyClosed`
896
+ * - `IsToBePrinted`
897
+ *
898
+ * Within `PurchaseOrderLineMod` or `PurchaseOrderLineGroupMod`:
899
+ * - `ItemRef`
900
+ * - `Quantity`
901
+ * - `Rate`
902
+ * - `Amount`
903
+ * - `IsManuallyClosed`
904
+ * - `OverrideItemAccountRef`
905
+ *
906
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderMod
907
+ */
908
+ mod: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { PurchaseOrderModRq: { PurchaseOrderMod: params } }, "PurchaseOrderModRs", "PurchaseOrderRet"),
909
+ /**
910
+ * Queries for the specified purchase order or set of orders.
911
+ *
912
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/PurchaseOrderQuery
913
+ */
914
+ query: async (integrationConnectionId, params) => this.sendRequestBase(integrationConnectionId, { PurchaseOrderQueryRq: params }, "PurchaseOrderQueryRs", "PurchaseOrderRet"),
915
+ };
795
916
  vendor = {
796
917
  /**
797
918
  * Adds a vendor.
@@ -827,7 +948,7 @@ class QbdIntegration extends BaseIntegration_1.default {
827
948
  * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop
828
949
  */
829
950
  async sendRequest(integrationConnectionId, requestObject) {
830
- return this.client.sendIntegrationRequest({
951
+ return this.sendIntegrationRequest({
831
952
  integrationConnectionId,
832
953
  requestObject,
833
954
  });