conductor-node 8.0.3 → 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/README.md CHANGED
@@ -59,7 +59,7 @@ The response looks like the following:
59
59
  {
60
60
  // ❗ Save this `id` to your database for executing requests to this
61
61
  // end-user's integration in the future.
62
- id: '{UUID}',
62
+ id: 'int_conn_1234abcd',
63
63
  integrationKey: 'quickbooks-desktop',
64
64
  endUserSourceId: "1234-abcd",
65
65
  endUserEmail: 'danny@constructionco.com',
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "8.0.3",
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,211 @@ 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
+ };
537
+ invoice: {
538
+ /**
539
+ * Adds an invoice.
540
+ *
541
+ * An invoice records the amount owed by a customer who purchased goods or
542
+ * services but did not pay in full at the time of the sale. If full payment
543
+ * is received at the time of the sale, it is recorded as a sales receipt,
544
+ * not an invoice.
545
+ *
546
+ * In QuickBooks, invoices and estimates use similar fields, and an estimate
547
+ * can be converted into an invoice after the customer accepts the estimate.
548
+ * However, in the SDK, there is currently no ability to create an invoice
549
+ * directly from an estimate (you cannot link an invoice to an estimate).
550
+ *
551
+ * If you Add an invoice that has an inventory item on it, QB will
552
+ * automatically calculate COGS and post it to the COGS account. (The
553
+ * inventory item will need to be setup to post to the COGS account and must
554
+ * have a unit cost in it.) However, notice that such an InvoiceAdd has
555
+ * sales prices, not cost, so the Add is not impacting the cost of the item.
556
+ * The cost of the item is only affected by purchases (bills and item
557
+ * receipts) sales and inventory adjustments.
558
+ *
559
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/InvoiceAdd
560
+ */
561
+ add: (integrationConnectionId: string, params: QbdTypes.InvoiceAddRq["InvoiceAdd"]) => Promise<NonNullable<QbdTypes.InvoiceAddRs["InvoiceRet"]>>;
562
+ /**
563
+ * Modifies an existing invoice. If you are modifying existing line items,
564
+ * supply an `InvoiceLineMod` and `TxnLineID` for each line you want to
565
+ * modify. If you want to add a new line, supply an `InvoiceLineMod` with
566
+ * its `TxnLineID` value set to -1.
567
+ *
568
+ * Some fields in an `InvoiceMod` request cannot be cleared. If any of the
569
+ * following fields is included in an invoice modify request, it must
570
+ * contain a value:
571
+ * - `CustomerRef`
572
+ * - `ARAccountRef`
573
+ * - `TemplateRef`
574
+ * - `TxnDate`
575
+ * - `IsPending`
576
+ * - `DueDate`
577
+ * - `ItemSalesTaxRef`
578
+ * - `ShipDate`
579
+ * - `IsToBePrinted`
580
+ *
581
+ * Within `InvoiceLineMod` or `InvoiceLineGroupMod`:
582
+ * - `ItemRef`
583
+ * - `Quantity`
584
+ * - `Rate`
585
+ * - `Amount`
586
+ * - `SalesTaxCodeRef`
587
+ * - `OverrideItemAccountRef`
588
+ *
589
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/InvoiceMod
590
+ */
591
+ mod: (integrationConnectionId: string, params: QbdTypes.InvoiceModRq["InvoiceMod"]) => Promise<NonNullable<QbdTypes.InvoiceModRs["InvoiceRet"]>>;
592
+ /**
593
+ * Returns invoice data.
594
+ *
595
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/InvoiceQuery
596
+ */
597
+ query: (integrationConnectionId: string, params: QbdTypes.InvoiceQueryRq) => Promise<NonNullable<QbdTypes.InvoiceQueryRs["InvoiceRet"]>>;
598
+ };
599
+ itemInventory: {
600
+ /**
601
+ * Adds an inventory item. An inventory item is any merchandise or part that
602
+ * a business purchases, tracks as inventory, and then resells. In
603
+ * QuickBooks, information about an inventory item is grouped into three
604
+ * categories:
605
+ * 1. Purchase Information includes `PurchaseDesc`, `PurchaseCost`,
606
+ * `COGSAccountRef`, and `PrefVendorRef`.
607
+ * 2. Sales Information includes `SalesDesc`, `SalesPrice`, and
608
+ * `SalesTaxCodeRef`.
609
+ * 3. Inventory Information includes `AssetAccountRef`, `ReorderPoint`,
610
+ * `QuantityOnHand`, `TotalValue`, and `InventoryDate`.
611
+ *
612
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemInventoryAdd
613
+ */
614
+ add: (integrationConnectionId: string, params: QbdTypes.ItemInventoryAddRq["ItemInventoryAdd"]) => Promise<NonNullable<QbdTypes.ItemInventoryAddRs["ItemInventoryRet"]>>;
615
+ /**
616
+ * Modifies an inventory item.
617
+ *
618
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemInventoryMod
619
+ */
620
+ mod: (integrationConnectionId: string, params: QbdTypes.ItemInventoryModRq["ItemInventoryMod"]) => Promise<NonNullable<QbdTypes.ItemInventoryModRs["ItemInventoryRet"]>>;
621
+ /**
622
+ * Queries for the specified inventory item or set of items.
623
+ *
624
+ * Notice that certain modifications to the item can be caused by other
625
+ * transactions, such as `ItemReceipts` where the item’s on hand quantity is
626
+ * increased. Modifications through these transactions do not result in
627
+ * changing the `TimeModified` stamp (only the `Mod` operation will do
628
+ * that), but those changes will be detected when you use the
629
+ * `FromModifiedDate`/`ToModifiedDate` filters in your query. Notice that
630
+ * you cannot get an inventory asset value from QuickBooks using this query.
631
+ * Instead, you need to use the General Summary Report query (which
632
+ * currently doesn’t include Assembly Items). Suppose you needed a way to
633
+ * search for the amount on hand of items that have had their amount changed
634
+ * since a certain date. Again, you would not use this query, but a
635
+ * `GeneralDetailReportQuery` that has its `GeneralDetailReportType` set to
636
+ * “InventoryValuationDetail”. This will tell you which items changed by how
637
+ * much. Also, suppose you wanted the on-hand quantity from QB as of a
638
+ * specific date. You would use a General Summary Report of the type
639
+ * Inventory Valuation Summary. (Again, this report doesn’t include
640
+ * Inventory Assemblies.)
641
+ *
642
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemInventoryQuery
643
+ */
644
+ query: (integrationConnectionId: string, params: QbdTypes.ItemInventoryQueryRq) => Promise<NonNullable<QbdTypes.ItemInventoryQueryRs["ItemInventoryRet"]>>;
645
+ };
646
+ itemNonInventory: {
647
+ /**
648
+ * Adds a non-inventory item, which is any material or part that a business
649
+ * buys but does not keep on hand as inventory. There are two types of
650
+ * non-inventory items:
651
+ * 1. Materials or parts that are part of the business’s overhead (for
652
+ * example, office supplies
653
+ * 2. Materials or parts that the business buys to finish a specific job and
654
+ * then charges back to the customer.
655
+ *
656
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemNonInventoryAdd
657
+ */
658
+ add: (integrationConnectionId: string, params: QbdTypes.ItemNonInventoryAddRq["ItemNonInventoryAdd"]) => Promise<NonNullable<QbdTypes.ItemNonInventoryAddRs["ItemNonInventoryRet"]>>;
659
+ /**
660
+ * Modifies a non inventory item.
661
+ *
662
+ * About `SalesOrPurchaseMod` versus `SalesAndPurchaseMod` in an
663
+ * `ItemNonInventoryMod` request: You cannot change the reimbursable status
664
+ * of a non-inventory item through the SDK. For example, if a non-inventory
665
+ * item is marked as non-reimbursable in QuickBooks, you cannot send a
666
+ * modify request that includes a `SalesAndPurchaseMod` aggregate.
667
+ * Similarly, if you send an `ItemNonInventoryAdd` request that includes a
668
+ * `SalesOrPurchase` aggregate, you cannot later modify that item using a
669
+ * `SalesAndPurchaseMod` aggregate.
670
+ *
671
+ * You can modify the various account references using the appropriate
672
+ * account reference aggregate and the matching Apply Account
673
+ * `RefToExistingTxns` boolean. You need to use the boolean when you change
674
+ * an account ref because the QuickBooks UI displays a prompt asking whether
675
+ * the change should apply to existing transactions or not. Specifying True
676
+ * for the boolean basically dismisses this with a “Yes” answer, allowing
677
+ * your changes to be made and changes any existing transactions that use
678
+ * the item with that `AccountRef`. Specifying “False” means that the mod will
679
+ * not take affect if there are existing transactions. Setting this to
680
+ * “True” should be used with caution and normally only after some user has
681
+ * indicated that they want those changes made to all those existing
682
+ * transactions! If any affected transactions are protected by a closing
683
+ * date and password, the `AccountRef` changes will not be made and so the Mod
684
+ * request will return an error without making the requested Mod.
685
+ *
686
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemNonInventoryMod
687
+ */
688
+ mod: (integrationConnectionId: string, params: QbdTypes.ItemNonInventoryModRq["ItemNonInventoryMod"]) => Promise<NonNullable<QbdTypes.ItemNonInventoryModRs["ItemNonInventoryRet"]>>;
689
+ /**
690
+ * Queries for the specified non-inventory item or set of items.
691
+ *
692
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemNonInventoryQuery
693
+ */
694
+ query: (integrationConnectionId: string, params: QbdTypes.ItemNonInventoryQueryRq) => Promise<NonNullable<QbdTypes.ItemNonInventoryQueryRs["ItemNonInventoryRet"]>>;
695
+ };
457
696
  itemService: {
458
697
  /**
459
698
  * Adds a service item, which is an item that refers to services that a
@@ -629,6 +868,47 @@ export default class QbdIntegration extends BaseIntegration {
629
868
  */
630
869
  query: (integrationConnectionId: string, params: QbdTypes.TimeTrackingQueryRq) => Promise<NonNullable<QbdTypes.TimeTrackingQueryRs["TimeTrackingRet"]>>;
631
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
+ };
632
912
  vendor: {
633
913
  /**
634
914
  * Adds a vendor.