-
Notifications
You must be signed in to change notification settings - Fork 1
/
pack.ts
74 lines (71 loc) · 2.27 KB
/
pack.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as coda from "@codahq/packs-sdk";
import * as constants from "./constants";
import * as helpers from "./helpers";
import * as formulas from "./formulas";
import * as schemas from "./schemas";
export const pack = coda.newPack();
pack.addNetworkDomain("intuit.com");
pack.setUserAuthentication({
type: coda.AuthenticationType.OAuth2,
authorizationUrl:
"https://appcenter.intuit.com/connect/oauth2?state='just-a-random-string-to-satisfy-CLI'",
tokenUrl: "https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer",
scopes: ["com.intuit.quickbooks.accounting"],
});
pack.addSyncTable({
name: "Customers",
identityName: "Customer",
description: "All of your QBO Customers (including Jobs)",
schema: schemas.CustomerSchema,
formula: {
name: "SyncCustomers",
description: "Sync all Customers (including Jobs)",
parameters: [
coda.makeParameter({
name: "CompanyId",
description: "Your company ID on QuickBooks",
type: coda.ParameterType.String,
}),
coda.makeParameter({
name: "ActiveOnly",
description: "Only sync active Customers",
type: coda.ParameterType.Boolean,
optional: true,
}),
],
execute: async function ([CompanyId, ActiveOnly], context) {
return formulas.syncCustomers(context, CompanyId, ActiveOnly);
},
},
});
pack.addSyncTable({
name: "Invoices",
identityName: "Invoice",
description: "All of your QBO Invoices",
schema: schemas.InvoiceSchema,
formula: {
name: "SyncInvoices",
description: "Sync all Invoices",
parameters: [
coda.makeParameter({
name: "CompanyId",
description: "Your company ID on QuickBooks",
type: coda.ParameterType.String,
}),
coda.makeParameter({
name: "DateRange",
description: "Only sync Invoices dated within this range",
type: coda.ParameterType.DateArray,
}),
coda.makeParameter({
name: "IncludePdfs",
description: "Include PDFs of each invoices (makes sync slower)",
type: coda.ParameterType.Boolean,
optional: true,
}),
],
execute: async function ([CompanyId, DateRange, IncludePdfs], context) {
return formulas.syncInvoices(context, CompanyId, DateRange, IncludePdfs);
},
},
});