@masonlandcattle/servicetitan-sdk 0.2.0 → 0.4.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 +156 -0
- package/dist/index.cjs +252 -175
- package/dist/index.d.cts +442 -130
- package/dist/index.d.ts +442 -130
- package/dist/index.js +252 -175
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,6 +54,162 @@ await st.jpm.createJobNote(123456, { text: "Hello from SDK", pinToTop: true });
|
|
|
54
54
|
const materials = await st.pricebook.listMaterials({}, { all: true, pageSize: 500 });
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### Resources and quick examples
|
|
58
|
+
|
|
59
|
+
Below is a brief tour of the main resource namespaces. Each list function supports `{ all?: boolean; pageSize?: number }` to fetch all pages server‑side.
|
|
60
|
+
|
|
61
|
+
Initialize once and reuse:
|
|
62
|
+
```ts
|
|
63
|
+
import { createClient } from "@masonlandcattle/servicetitan-sdk";
|
|
64
|
+
const st = createClient({
|
|
65
|
+
tenantId: process.env.TENANT_ID!,
|
|
66
|
+
appKey: process.env.APP_KEY!,
|
|
67
|
+
clientId: process.env.CLIENT_ID!,
|
|
68
|
+
clientSecret: process.env.SECRET_KEY!,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Accounting (`st.accounting`)
|
|
73
|
+
- Invoices, Payments, GL Accounts, Inventory Bills, AP Credits/Payments, Tax Zones, etc.
|
|
74
|
+
```ts
|
|
75
|
+
const invoices = await st.accounting.listInvoices({ customerId: 1234 }, { all: true });
|
|
76
|
+
await st.accounting.markInvoicesAsExported([111, 222]);
|
|
77
|
+
const gl = await st.accounting.listGlAccounts({ type: "Asset" }, { all: true });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
#### CRM (`st.crm`)
|
|
81
|
+
- Customers, Contacts, Locations, Leads, Bookings.
|
|
82
|
+
```ts
|
|
83
|
+
const customers = await st.crm.listCustomers({ search: "Acme" }, { all: true });
|
|
84
|
+
const contacts = await st.crm.listContacts({ updatedAfter: "2024-01-01" }, { all: true });
|
|
85
|
+
const locations = await st.crm.listLocations({ customerId: 1234 }, { all: true });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### Dispatch (`st.dispatch`)
|
|
89
|
+
- Teams, Zones, Arrival Windows, Technician Shifts, Appointment Assignments.
|
|
90
|
+
```ts
|
|
91
|
+
const teams = await st.dispatch.listTeams({}, { all: true });
|
|
92
|
+
const windows = await st.dispatch.listArrivalWindows({ date: "2025-01-01" }, { all: true });
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### Equipment Systems (`st.equipmentSystems`)
|
|
96
|
+
- Installed Equipment and metadata.
|
|
97
|
+
```ts
|
|
98
|
+
const eq = await st.equipmentSystems.listInstalledEquipment({ search: "Carrier" }, { all: true });
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Forms (`st.forms`)
|
|
102
|
+
- Forms, Jobs + Forms, Submissions.
|
|
103
|
+
```ts
|
|
104
|
+
const forms = await st.forms.listForms({}, { all: true });
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### Inventory (`st.inventory`)
|
|
108
|
+
- Purchase Orders (+ types/markups/requests), Receipts, Transfers, Returns, Trucks, Vendors, Warehouses.
|
|
109
|
+
```ts
|
|
110
|
+
const pos = await st.inventory.listPurchaseOrders({ status: "Open" }, { all: true });
|
|
111
|
+
const receipts = await st.inventory.listReceipts({ dateFrom: "2025-01-01" }, { all: true });
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### JPM (Jobs/Projects) (`st.jpm`)
|
|
115
|
+
- Jobs, Appointments, Projects, WBS, types/statuses.
|
|
116
|
+
```ts
|
|
117
|
+
const jobs = await st.jpm.listJobs({ status: "Open" }, { all: true });
|
|
118
|
+
const appts = await st.jpm.listAppointments({ scheduledOnOrAfter: "2025-01-01" }, { all: true });
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Marketing (`st.marketing`) and Marketing Ads (`st.marketingAds`)
|
|
122
|
+
- Campaigns/Categories/Costs/Suppressions; Ads Attributions and Performance.
|
|
123
|
+
```ts
|
|
124
|
+
const campaigns = await st.marketing.listCampaigns({}, { all: true });
|
|
125
|
+
const webLead = await st.marketingAds.createWebLeadFormAttribution({ webSessionData: {}, leadId: 42 });
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Marketing Reputation (`st.marketingReputation`)
|
|
129
|
+
- Reviews.
|
|
130
|
+
```ts
|
|
131
|
+
const reviews = await st.marketingReputation.listReviews({ createdOnOrAfter: "2025-01-01" }, { all: true });
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
#### Memberships (`st.memberships`)
|
|
135
|
+
- Memberships, Types, Recurring Service Types/Events/Services, Invoice Templates.
|
|
136
|
+
```ts
|
|
137
|
+
const memberships = await st.memberships.listMemberships({ customerId: 1234 }, { all: true });
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Payroll (`st.payroll`)
|
|
141
|
+
- Timesheets (+ non-job, per-job), Timesheet Codes, Payrolls, Adjustments, Job Splits, Location Labor Rates.
|
|
142
|
+
```ts
|
|
143
|
+
const codes = await st.payroll.listTimesheetCodes({}, { all: true });
|
|
144
|
+
const payrolls = await st.payroll.listPayrolls({ createdOnOrAfter: "2025-01-01" }, { all: true });
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Pricebook (`st.pricebook`)
|
|
148
|
+
- Materials, Services, Equipment, Images, Discounts & Fees, Categories, Client-Specific Pricing.
|
|
149
|
+
```ts
|
|
150
|
+
const materials = await st.pricebook.listMaterials({ updatedAfter: "2025-01-01" }, { all: true });
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Reporting (`st.reporting`)
|
|
154
|
+
- Report Categories and mappings, Dynamic Value Sets.
|
|
155
|
+
```ts
|
|
156
|
+
const cats = await st.reporting.listReportCategories({}, { all: true });
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Sales Estimates (`st.salesEstimates`)
|
|
160
|
+
- Estimates and Estimate Items.
|
|
161
|
+
```ts
|
|
162
|
+
const ests = await st.salesEstimates.listEstimates({ jobNumber: "131179" }, { all: true });
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### Scheduling Pro (`st.schedulingPro`)
|
|
166
|
+
- Routers, Schedulers.
|
|
167
|
+
```ts
|
|
168
|
+
const schedulers = await st.schedulingPro.listSchedulers({}, { all: true });
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### Service Agreements (`st.serviceAgreements`)
|
|
172
|
+
- Agreements and export endpoints.
|
|
173
|
+
```ts
|
|
174
|
+
const agreements = await st.serviceAgreements.listServiceAgreements({}, { all: true });
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### Settings (`st.settings`)
|
|
178
|
+
- Employees, Technicians, Business Units, Tag Types, User Roles.
|
|
179
|
+
```ts
|
|
180
|
+
const techs = await st.settings.listTechnicians({}, { all: true });
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### Task Management (`st.taskManagement`)
|
|
184
|
+
- Tasks and Client-Side Data.
|
|
185
|
+
```ts
|
|
186
|
+
const tasks = await st.taskManagement.listTasks({ status: "Open" }, { all: true });
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Telecom (`st.telecom`)
|
|
190
|
+
- Calls + media.
|
|
191
|
+
```ts
|
|
192
|
+
const calls = await st.telecom.listCalls({ createdOnOrAfter: "2025-01-01" }, { all: true });
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
#### Timesheets V2 (`st.timesheetsV2`)
|
|
196
|
+
- Activities, Types, Categories.
|
|
197
|
+
```ts
|
|
198
|
+
const activities = await st.timesheetsV2.listActivities({}, { all: true });
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
#### Job Bookings (`st.jbce`)
|
|
202
|
+
- Call Reasons.
|
|
203
|
+
```ts
|
|
204
|
+
const reasons = await st.jbce.listCallReasons({}, { all: true });
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
#### Customer Interactions (`st.customerInteractions`)
|
|
208
|
+
- Technician Ratings.
|
|
209
|
+
```ts
|
|
210
|
+
const ratings = await st.customerInteractions.listTechnicianRatings({ createdOnOrAfter: "2025-01-01" }, { all: true });
|
|
211
|
+
```
|
|
212
|
+
|
|
57
213
|
### Alternate import style (functional)
|
|
58
214
|
|
|
59
215
|
```ts
|