connectwise-rest 0.23.3 → 1.0.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/.eslintrc +19 -52
- package/.gitattributes +1 -0
- package/.github/workflows/codeql-analysis.yml +70 -0
- package/.github/workflows/node.js.yml +42 -0
- package/.mocharc.json +5 -0
- package/.prettierrc +7 -0
- package/.travis.yml +4 -2
- package/README.md +243 -230
- package/api-extractor.json +364 -0
- package/dist/Automate/AVTemplatePoliciesAPI.d.ts +27 -0
- package/dist/Automate/AVTemplatePoliciesAPI.d.ts.map +1 -0
- package/dist/Automate/AVTemplatePoliciesAPI.js +87 -0
- package/dist/Automate/AVTemplatePoliciesAPI.js.map +1 -0
- package/dist/Automate/ClientsAPI.d.ts +34 -0
- package/dist/Automate/ClientsAPI.d.ts.map +1 -0
- package/dist/Automate/ClientsAPI.js +114 -0
- package/dist/Automate/ClientsAPI.js.map +1 -0
- package/dist/Automate/CommandsAPI.d.ts +15 -0
- package/dist/Automate/CommandsAPI.d.ts.map +1 -0
- package/dist/Automate/CommandsAPI.js +31 -0
- package/dist/Automate/CommandsAPI.js.map +1 -0
- package/dist/Automate/ComputersAPI.d.ts +94 -0
- package/dist/Automate/ComputersAPI.d.ts.map +1 -0
- package/dist/Automate/ComputersAPI.js +353 -0
- package/dist/Automate/ComputersAPI.js.map +1 -0
- package/dist/Automate/ContactsAPI.d.ts +18 -0
- package/dist/Automate/ContactsAPI.d.ts.map +1 -0
- package/dist/Automate/ContactsAPI.js +45 -0
- package/dist/Automate/ContactsAPI.js.map +1 -0
- package/dist/Automate/DataViewsAPI.d.ts +16 -0
- package/dist/Automate/DataViewsAPI.d.ts.map +1 -0
- package/dist/Automate/DataViewsAPI.js +31 -0
- package/dist/Automate/DataViewsAPI.js.map +1 -0
- package/dist/Automate/DrivesAPI.d.ts +19 -0
- package/dist/Automate/DrivesAPI.d.ts.map +1 -0
- package/dist/Automate/DrivesAPI.js +52 -0
- package/dist/Automate/DrivesAPI.js.map +1 -0
- package/dist/Automate/EventLogsAPI.d.ts +14 -0
- package/dist/Automate/EventLogsAPI.d.ts.map +1 -0
- package/dist/Automate/EventLogsAPI.js +24 -0
- package/dist/Automate/EventLogsAPI.js.map +1 -0
- package/dist/Automate/LocationsAPI.d.ts +42 -0
- package/dist/Automate/LocationsAPI.d.ts.map +1 -0
- package/dist/Automate/LocationsAPI.js +133 -0
- package/dist/Automate/LocationsAPI.js.map +1 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts +14 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts.map +1 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.js +24 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.js.map +1 -0
- package/dist/Automate/MonitorsAPI.d.ts +23 -0
- package/dist/Automate/MonitorsAPI.d.ts.map +1 -0
- package/dist/Automate/MonitorsAPI.js +80 -0
- package/dist/Automate/MonitorsAPI.js.map +1 -0
- package/dist/Automate/NetworkDevicesAPI.d.ts +17 -0
- package/dist/Automate/NetworkDevicesAPI.d.ts.map +1 -0
- package/dist/Automate/NetworkDevicesAPI.js +38 -0
- package/dist/Automate/NetworkDevicesAPI.js.map +1 -0
- package/dist/Automate/PatchingAPI.d.ts +27 -0
- package/dist/Automate/PatchingAPI.d.ts.map +1 -0
- package/dist/Automate/PatchingAPI.js +94 -0
- package/dist/Automate/PatchingAPI.js.map +1 -0
- package/dist/Automate/RemoteAgentAPI.d.ts +18 -0
- package/dist/Automate/RemoteAgentAPI.d.ts.map +1 -0
- package/dist/Automate/RemoteAgentAPI.js +45 -0
- package/dist/Automate/RemoteAgentAPI.js.map +1 -0
- package/dist/Automate/ScriptingAPI.d.ts +32 -0
- package/dist/Automate/ScriptingAPI.d.ts.map +1 -0
- package/dist/Automate/ScriptingAPI.js +104 -0
- package/dist/Automate/ScriptingAPI.js.map +1 -0
- package/dist/Automate/SearchesAPI.d.ts +17 -0
- package/dist/Automate/SearchesAPI.d.ts.map +1 -0
- package/dist/Automate/SearchesAPI.js +38 -0
- package/dist/Automate/SearchesAPI.js.map +1 -0
- package/dist/Automate/SystemAPI.d.ts +72 -0
- package/dist/Automate/SystemAPI.d.ts.map +1 -0
- package/dist/Automate/SystemAPI.js +268 -0
- package/dist/Automate/SystemAPI.js.map +1 -0
- package/dist/Automate/TicketsAPI.d.ts +10 -0
- package/dist/Automate/TicketsAPI.d.ts.map +1 -0
- package/dist/Automate/TicketsAPI.js +24 -0
- package/dist/Automate/TicketsAPI.js.map +1 -0
- package/dist/Automate/UserProfilesAPI.d.ts +14 -0
- package/dist/Automate/UserProfilesAPI.d.ts.map +1 -0
- package/dist/Automate/UserProfilesAPI.js +23 -0
- package/dist/Automate/UserProfilesAPI.js.map +1 -0
- package/dist/Automate.d.ts +48 -0
- package/dist/Automate.d.ts.map +1 -0
- package/dist/Automate.js +167 -0
- package/dist/Automate.js.map +1 -0
- package/dist/AutomateAPI.d.ts +96 -0
- package/dist/AutomateAPI.d.ts.map +1 -0
- package/dist/AutomateAPI.js +168 -0
- package/dist/AutomateAPI.js.map +1 -0
- package/dist/AutomateTypes.d.ts +10437 -0
- package/dist/AutomateTypes.d.ts.map +1 -0
- package/dist/AutomateTypes.js +3 -0
- package/dist/AutomateTypes.js.map +1 -0
- package/dist/BaseAPI.d.ts +13 -0
- package/dist/BaseAPI.d.ts.map +1 -0
- package/dist/BaseAPI.js +53 -0
- package/dist/BaseAPI.js.map +1 -0
- package/dist/Manage/CompanyAPI.d.ts +573 -0
- package/dist/Manage/CompanyAPI.d.ts.map +1 -0
- package/dist/Manage/CompanyAPI.js +3294 -0
- package/dist/Manage/CompanyAPI.js.map +1 -0
- package/dist/Manage/ConfigurationsAPI.d.ts +24 -0
- package/dist/Manage/ConfigurationsAPI.d.ts.map +1 -0
- package/dist/Manage/ConfigurationsAPI.js +73 -0
- package/dist/Manage/ConfigurationsAPI.js.map +1 -0
- package/dist/Manage/ExpenseAPI.d.ts +68 -0
- package/dist/Manage/ExpenseAPI.d.ts.map +1 -0
- package/dist/Manage/ExpenseAPI.js +306 -0
- package/dist/Manage/ExpenseAPI.js.map +1 -0
- package/dist/Manage/FinanceAPI.d.ts +460 -0
- package/dist/Manage/FinanceAPI.d.ts.map +1 -0
- package/dist/Manage/FinanceAPI.js +2587 -0
- package/dist/Manage/FinanceAPI.js.map +1 -0
- package/dist/Manage/MarketingAPI.d.ts +120 -0
- package/dist/Manage/MarketingAPI.d.ts.map +1 -0
- package/dist/Manage/MarketingAPI.js +629 -0
- package/dist/Manage/MarketingAPI.js.map +1 -0
- package/dist/Manage/ProcurementAPI.d.ts +373 -0
- package/dist/Manage/ProcurementAPI.d.ts.map +1 -0
- package/dist/Manage/ProcurementAPI.js +2098 -0
- package/dist/Manage/ProcurementAPI.js.map +1 -0
- package/dist/Manage/ProjectAPI.d.ts +179 -0
- package/dist/Manage/ProjectAPI.d.ts.map +1 -0
- package/dist/Manage/ProjectAPI.js +940 -0
- package/dist/Manage/ProjectAPI.js.map +1 -0
- package/dist/Manage/SalesAPI.d.ts +254 -0
- package/dist/Manage/SalesAPI.d.ts.map +1 -0
- package/dist/Manage/SalesAPI.js +1392 -0
- package/dist/Manage/SalesAPI.js.map +1 -0
- package/dist/Manage/ScheduleAPI.d.ts +111 -0
- package/dist/Manage/ScheduleAPI.d.ts.map +1 -0
- package/dist/Manage/ScheduleAPI.js +575 -0
- package/dist/Manage/ScheduleAPI.js.map +1 -0
- package/dist/Manage/ServiceAPI.d.ts +419 -0
- package/dist/Manage/ServiceAPI.d.ts.map +1 -0
- package/dist/Manage/ServiceAPI.js +2334 -0
- package/dist/Manage/ServiceAPI.js.map +1 -0
- package/dist/Manage/SystemAPI.d.ts +809 -0
- package/dist/Manage/SystemAPI.d.ts.map +1 -0
- package/dist/Manage/SystemAPI.js +4531 -0
- package/dist/Manage/SystemAPI.js.map +1 -0
- package/dist/Manage/TimeAPI.d.ts +157 -0
- package/dist/Manage/TimeAPI.d.ts.map +1 -0
- package/dist/Manage/TimeAPI.js +835 -0
- package/dist/Manage/TimeAPI.js.map +1 -0
- package/dist/Manage.d.ts +34 -0
- package/dist/Manage.d.ts.map +1 -0
- package/dist/Manage.js +127 -0
- package/dist/Manage.js.map +1 -0
- package/dist/ManageAPI.d.ts +99 -0
- package/dist/ManageAPI.d.ts.map +1 -0
- package/dist/ManageAPI.js +112 -0
- package/dist/ManageAPI.js.map +1 -0
- package/dist/ManageTypes.d.ts +91320 -0
- package/dist/ManageTypes.d.ts.map +1 -0
- package/dist/ManageTypes.js +7 -0
- package/dist/ManageTypes.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/Callback.d.ts +67 -0
- package/dist/utils/Callback.d.ts.map +1 -0
- package/dist/utils/Callback.js +109 -0
- package/dist/utils/Callback.js.map +1 -0
- package/dist/utils/Series.d.ts +36 -0
- package/dist/utils/Series.d.ts.map +1 -0
- package/dist/utils/Series.js +64 -0
- package/dist/utils/Series.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/generator/automate-generator.js +75 -0
- package/generator/automate-json.js +61 -0
- package/generator/automate-types.js +15 -0
- package/generator/generator.d.ts +67 -0
- package/generator/generator.js +255 -0
- package/generator/manage-generator.js +71 -0
- package/generator/manage-types.js +14 -0
- package/package.json +48 -21
- package/src/Automate/AVTemplatePoliciesAPI.ts +114 -0
- package/src/Automate/ClientsAPI.ts +161 -0
- package/src/Automate/CommandsAPI.ts +33 -0
- package/src/Automate/ComputersAPI.ts +550 -0
- package/src/Automate/ContactsAPI.ts +56 -0
- package/src/Automate/DataViewsAPI.ts +36 -0
- package/src/Automate/DrivesAPI.ts +74 -0
- package/src/Automate/EventLogsAPI.ts +25 -0
- package/src/Automate/LocationsAPI.ts +206 -0
- package/src/Automate/MaintenanceWindowDefinitionsAPI.ts +28 -0
- package/src/Automate/MonitorsAPI.ts +94 -0
- package/src/Automate/NetworkDevicesAPI.ts +44 -0
- package/src/Automate/PatchingAPI.ts +109 -0
- package/src/Automate/RemoteAgentAPI.ts +58 -0
- package/src/Automate/ScriptingAPI.ts +137 -0
- package/src/Automate/SearchesAPI.ts +42 -0
- package/src/Automate/SystemAPI.ts +386 -0
- package/src/Automate/TicketsAPI.ts +24 -0
- package/src/Automate/UserProfilesAPI.ts +25 -0
- package/src/Automate.ts +216 -0
- package/src/AutomateAPI.ts +144 -0
- package/src/AutomateTypes.ts +10492 -0
- package/src/BaseAPI.ts +83 -0
- package/src/Manage/CompanyAPI.ts +4851 -0
- package/src/Manage/ConfigurationsAPI.ts +107 -0
- package/src/Manage/ExpenseAPI.ts +395 -0
- package/src/Manage/FinanceAPI.ts +3851 -0
- package/src/Manage/MarketingAPI.ts +935 -0
- package/src/Manage/ProcurementAPI.ts +3044 -0
- package/src/Manage/ProjectAPI.ts +1400 -0
- package/src/Manage/SalesAPI.ts +1922 -0
- package/src/Manage/ScheduleAPI.ts +751 -0
- package/src/Manage/ServiceAPI.ts +3401 -0
- package/src/Manage/SystemAPI.ts +6269 -0
- package/src/Manage/TimeAPI.ts +1121 -0
- package/src/Manage.ts +152 -0
- package/src/ManageAPI.ts +133 -0
- package/src/ManageTypes.ts +91318 -0
- package/src/index.ts +18 -0
- package/src/types.ts +66 -0
- package/src/utils/Callback.ts +145 -0
- package/src/utils/Series.ts +83 -0
- package/src/utils/index.ts +7 -0
- package/swagger-errors.md +30 -0
- package/test/.env.example +12 -4
- package/test/test-utils.ts +27 -0
- package/test/test.ts +320 -0
- package/tsconfig.json +29 -0
- package/doc.md +0 -5984
- package/docs/jsdoc.json +0 -15
- package/index.js +0 -10
- package/src/CompanyAPI/Companies.js +0 -149
- package/src/CompanyAPI/CompanyCompanyTypeAssociations.js +0 -111
- package/src/CompanyAPI/CompanySites.js +0 -70
- package/src/CompanyAPI/CompanyTeams.js +0 -108
- package/src/CompanyAPI/CompanyTypeInfos.js +0 -58
- package/src/CompanyAPI/CompanyTypes.js +0 -52
- package/src/CompanyAPI/Configurations.js +0 -152
- package/src/CompanyAPI/ContactContactTypeAssociations.js +0 -55
- package/src/CompanyAPI/ContactRelationships.js +0 -36
- package/src/CompanyAPI/Contacts.js +0 -199
- package/src/CompanyAPI/index.js +0 -53
- package/src/ConnectWise.js +0 -339
- package/src/ConnectWiseRest.js +0 -512
- package/src/FinanceAPI/Additions.js +0 -127
- package/src/FinanceAPI/Adjustments.js +0 -109
- package/src/FinanceAPI/AgreementSites.js +0 -108
- package/src/FinanceAPI/Agreements.js +0 -220
- package/src/FinanceAPI/BoardDefaults.js +0 -109
- package/src/FinanceAPI/WorkRoles.js +0 -113
- package/src/FinanceAPI/WorkTypeExclusions.js +0 -78
- package/src/FinanceAPI/WorkTypes.js +0 -124
- package/src/FinanceAPI/index.js +0 -50
- package/src/ProjectAPI/Projects.js +0 -142
- package/src/ProjectAPI/index.js +0 -28
- package/src/SalesAPI/Activities.js +0 -149
- package/src/SalesAPI/index.js +0 -14
- package/src/ScheduleAPI/ScheduleEntries.js +0 -109
- package/src/ScheduleAPI/ScheduleTypes.js +0 -101
- package/src/ScheduleAPI/index.js +0 -30
- package/src/ServiceDeskAPI/BoardItems.js +0 -134
- package/src/ServiceDeskAPI/BoardSubTypes.js +0 -112
- package/src/ServiceDeskAPI/BoardTeams.js +0 -108
- package/src/ServiceDeskAPI/BoardTypes.js +0 -139
- package/src/ServiceDeskAPI/Boards.js +0 -100
- package/src/ServiceDeskAPI/Priorities.js +0 -47
- package/src/ServiceDeskAPI/ServiceNotes.js +0 -172
- package/src/ServiceDeskAPI/Statuses.js +0 -116
- package/src/ServiceDeskAPI/Tickets.js +0 -588
- package/src/ServiceDeskAPI/index.js +0 -53
- package/src/SystemAPI/Members.js +0 -139
- package/src/SystemAPI/Reports.js +0 -116
- package/src/SystemAPI/index.js +0 -32
- package/src/TimeAPI/TimeEntries.js +0 -121
- package/src/TimeAPI/index.js +0 -27
- package/src/utils/Callback.js +0 -125
- package/src/utils/Series.js +0 -64
- package/src/utils/index.js +0 -21
- package/test/test.js +0 -114
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
type Method = 'get' | 'post' | 'patch' | 'delete' | 'put'
|
|
2
|
+
type ResponseTypes =
|
|
3
|
+
| 'application/json'
|
|
4
|
+
| 'text/json'
|
|
5
|
+
| 'application/xml'
|
|
6
|
+
| 'text/xml'
|
|
7
|
+
| 'application/x-www-form-urlencoded'
|
|
8
|
+
|
|
9
|
+
type Content = {
|
|
10
|
+
[T in ResponseTypes]: {
|
|
11
|
+
schema: Schema
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type RequestBody = {
|
|
16
|
+
required?: boolean
|
|
17
|
+
content: Content
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type Responses = {
|
|
21
|
+
200?: {
|
|
22
|
+
description: string
|
|
23
|
+
content: Content
|
|
24
|
+
}
|
|
25
|
+
204?: {
|
|
26
|
+
description: string
|
|
27
|
+
content: Content
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Schema = {
|
|
32
|
+
type: string
|
|
33
|
+
enum?: Array<string>
|
|
34
|
+
format?: string
|
|
35
|
+
items?: {
|
|
36
|
+
type?: string
|
|
37
|
+
$ref?: string
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type Parameter = {
|
|
42
|
+
name: string
|
|
43
|
+
in: string
|
|
44
|
+
required?: boolean
|
|
45
|
+
explode?: boolean
|
|
46
|
+
schema?: Schema
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
type Methods = {
|
|
50
|
+
[T in Method]: Operation
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
type Operation = {
|
|
54
|
+
tags?: Array<string>
|
|
55
|
+
method: string
|
|
56
|
+
operationId: string
|
|
57
|
+
parameters: Array<Parameter>
|
|
58
|
+
requestBody: {
|
|
59
|
+
$ref: string
|
|
60
|
+
}
|
|
61
|
+
responses: Responses
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type Components = {
|
|
65
|
+
schemas: Record<string, Schema>
|
|
66
|
+
requestBodies: Record<string, RequestBody>
|
|
67
|
+
}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const { getAutomateJson } = require('./automate-json')
|
|
3
|
+
|
|
4
|
+
const automateSchema = getAutomateJson()
|
|
5
|
+
|
|
6
|
+
const typeMapSanitize = (input = '') => {
|
|
7
|
+
switch (input) {
|
|
8
|
+
case 'integer':
|
|
9
|
+
return 'number'
|
|
10
|
+
case 'application/octet-stream':
|
|
11
|
+
return 'OctetStreamResponse'
|
|
12
|
+
case 'application/pdf':
|
|
13
|
+
return 'PDFResponse'
|
|
14
|
+
case 'text/html':
|
|
15
|
+
return 'HTMLResponse'
|
|
16
|
+
default:
|
|
17
|
+
return sanitizeType(input)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// remove invalid var name from the name of the type
|
|
22
|
+
const sanitizeType = (input = '') => input.replace(/\./g, '').replace(/\//g, '')
|
|
23
|
+
const generateTypeDef = ({ typeName, schemaType }) => {
|
|
24
|
+
let name = sanitizeType(typeName)
|
|
25
|
+
|
|
26
|
+
return schemaType === 'schemas'
|
|
27
|
+
? `export type ${name} = schemas['${typeName}']`
|
|
28
|
+
: `export type ${name} = requestBodies['${typeName}']`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {object} Operations
|
|
33
|
+
* @property {string} url
|
|
34
|
+
* @property {{}} methods
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* decipher supplied definition files
|
|
39
|
+
* @param {{}} options
|
|
40
|
+
* @param {string} options.apiName
|
|
41
|
+
* @param {} options.operations
|
|
42
|
+
* @param {'Manage' | 'Automate'} options.generatorType
|
|
43
|
+
*/
|
|
44
|
+
function generateAPIClass({ apiName, operations = [], generatorType }) {
|
|
45
|
+
// types holder for generating type aliases
|
|
46
|
+
// type Types = Record<string, string>
|
|
47
|
+
// system name, sanitized name
|
|
48
|
+
const types = {}
|
|
49
|
+
const requestBodies = {}
|
|
50
|
+
|
|
51
|
+
// loop over each defined operation for this module
|
|
52
|
+
const functions = operations.map(({ url, methods }) =>
|
|
53
|
+
Object.keys(methods)
|
|
54
|
+
.map((method) => {
|
|
55
|
+
const { responses, operationId, parameters = [], requestBody } = methods[method]
|
|
56
|
+
const queryParams = parameters.filter(({ in: in_ }) => in_ === 'query')
|
|
57
|
+
const pathParams = parameters.filter(({ in: in_ }) => in_ === 'path')
|
|
58
|
+
|
|
59
|
+
// store generated names/types
|
|
60
|
+
const functionParams = [] // args to the class function
|
|
61
|
+
const requestParams = [] // args to this.request
|
|
62
|
+
let bodyParam = {}
|
|
63
|
+
|
|
64
|
+
// generally if a post command is defined
|
|
65
|
+
if (requestBody) {
|
|
66
|
+
if (requestBody.content && requestBody.content['application/json']) {
|
|
67
|
+
const schema = requestBody.content['application/json'].schema
|
|
68
|
+
if (schema.type === 'array') {
|
|
69
|
+
if (schema.items) {
|
|
70
|
+
const ref = schema.items.$ref
|
|
71
|
+
const tempName = ref.split('/').pop()
|
|
72
|
+
bodyParam.type = `Array<${tempName}>`
|
|
73
|
+
bodyParam.name = tempName.charAt(0).toLowerCase() + tempName.slice(1) + 's'
|
|
74
|
+
|
|
75
|
+
types[tempName] = {
|
|
76
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
} else if (schema.$ref) {
|
|
80
|
+
const ref = schema.$ref
|
|
81
|
+
bodyParam.type = ref.split('/').pop()
|
|
82
|
+
if (requestBody.description) {
|
|
83
|
+
bodyParam.name = requestBody.description
|
|
84
|
+
} else {
|
|
85
|
+
bodyParam.name = ref.split('.').pop()
|
|
86
|
+
}
|
|
87
|
+
types[bodyParam.type] = {
|
|
88
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
89
|
+
}
|
|
90
|
+
// if clause for MonitorAlertSuspensions_PostSuspension
|
|
91
|
+
} else if (!schema.description) {
|
|
92
|
+
bodyParam.type = schema.type
|
|
93
|
+
bodyParam.name = schema.type
|
|
94
|
+
}
|
|
95
|
+
} else if (requestBody.content && requestBody.content['multipart/form-data']) {
|
|
96
|
+
const schema = requestBody.content['multipart/form-data'].schema
|
|
97
|
+
if (schema.$ref) {
|
|
98
|
+
const ref = schema.$ref
|
|
99
|
+
bodyParam.type = ref.split('/').pop()
|
|
100
|
+
bodyParam.name = bodyParam.type.charAt(0).toLowerCase() + bodyParam.type.slice(1)
|
|
101
|
+
types[bodyParam.type] = {
|
|
102
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else if (requestBody.$ref) {
|
|
106
|
+
const ref = requestBody.$ref
|
|
107
|
+
// make sensible names by splitting the generated refs
|
|
108
|
+
bodyParam.name = requestBody.$ref.split('/').pop().split('.').pop().split('_').pop()
|
|
109
|
+
bodyParam.type = requestBody.$ref.split('/').pop()
|
|
110
|
+
types[bodyParam.type] = {
|
|
111
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
bodyParam.name = requestBody.description
|
|
115
|
+
bodyParam.type = 'object'
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
bodyParam.name = sanitizeType(bodyParam.name)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (pathParams.length > 0) {
|
|
122
|
+
pathParams.forEach((parameter) => {
|
|
123
|
+
functionParams.push(`${parameter.name}: ${typeMapSanitize(parameter.schema.type)}`)
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
requestParams.push(`path: \`${url.replaceAll(/({.+?})/g, (_, p1) => `$${p1}`)}\``)
|
|
127
|
+
requestParams.push(`method: '${method}'`)
|
|
128
|
+
|
|
129
|
+
if (requestBody) {
|
|
130
|
+
functionParams.push(`${bodyParam.name}: ${typeMapSanitize(bodyParam.type)}`)
|
|
131
|
+
requestParams.push(`data: ${bodyParam.name}`)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (queryParams.length > 0) {
|
|
135
|
+
functionParams.push('params: CommonParameters = {}')
|
|
136
|
+
requestParams.push(`params`)
|
|
137
|
+
}
|
|
138
|
+
let returnType
|
|
139
|
+
if (responses[204]) {
|
|
140
|
+
returnType = 'NoContentResponse'
|
|
141
|
+
} else {
|
|
142
|
+
const { description, content } = responses[Object.keys(responses).pop()]
|
|
143
|
+
|
|
144
|
+
if (responses['default']) {
|
|
145
|
+
returnType = 'any'
|
|
146
|
+
if (responses['default'].description) {
|
|
147
|
+
returnType = `${returnType}`
|
|
148
|
+
}
|
|
149
|
+
} else if (content) {
|
|
150
|
+
const { schema } = content[Object.keys(content).pop()]
|
|
151
|
+
|
|
152
|
+
if (schema.items) {
|
|
153
|
+
if (schema.items.$ref) {
|
|
154
|
+
const ref = schema.items.$ref
|
|
155
|
+
const tempName = ref.split('/').pop()
|
|
156
|
+
returnType = `Array<${tempName}>`
|
|
157
|
+
types[tempName] = {
|
|
158
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
159
|
+
}
|
|
160
|
+
} else if (schema.items.additionalProperties?.$ref) {
|
|
161
|
+
const ref = schema.items.additionalProperties.$ref
|
|
162
|
+
const tempName = ref.split('/').pop()
|
|
163
|
+
returnType = `Array<${tempName}>`
|
|
164
|
+
types[tempName] = {
|
|
165
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
166
|
+
}
|
|
167
|
+
} else if (schema.type) {
|
|
168
|
+
if (schema.items.type) {
|
|
169
|
+
returnType = `Array<${schema.items.type}>`
|
|
170
|
+
} else {
|
|
171
|
+
returnType = schema.type
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
} else if (schema.$ref) {
|
|
175
|
+
const ref = schema.$ref
|
|
176
|
+
// fix for incorrect types from ResultSetWithCount
|
|
177
|
+
if (ref.includes('LabTech.Database.ResultSetWithCount')) {
|
|
178
|
+
const schemaName = ref.split('/').pop()
|
|
179
|
+
const resultSchema = automateSchema.components.schemas[schemaName]
|
|
180
|
+
const ResultSetRef = resultSchema.properties.ResultSet.items.$ref
|
|
181
|
+
const tempName = ResultSetRef.split('/').pop()
|
|
182
|
+
returnType = `Array<${tempName}>`
|
|
183
|
+
types[tempName] = {
|
|
184
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
returnType = schema.$ref.split('/').pop()
|
|
188
|
+
types[returnType] = {
|
|
189
|
+
schemaType: ref.includes('requestBodies') ? 'requestBody' : 'schemas',
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
returnType = schema.type
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
returnType = description.split(' ').pop()
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
returnType = typeMapSanitize(returnType)
|
|
201
|
+
|
|
202
|
+
if (!returnType) {
|
|
203
|
+
returnType = 'any'
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return `
|
|
207
|
+
${operationId}(${functionParams.map((param) => param).join(', ')}): Promise<${returnType}> {
|
|
208
|
+
return this.request({
|
|
209
|
+
${requestParams.map((param) => param).join(', ')}
|
|
210
|
+
})
|
|
211
|
+
}`
|
|
212
|
+
})
|
|
213
|
+
.join('\n'),
|
|
214
|
+
)
|
|
215
|
+
|
|
216
|
+
// use true/false map to generate required types for this module
|
|
217
|
+
const typeDefs = Object.keys(
|
|
218
|
+
// sort keys to order imports
|
|
219
|
+
Object.keys(types)
|
|
220
|
+
.sort()
|
|
221
|
+
.reduce((obj, key) => {
|
|
222
|
+
obj[key] = types[key]
|
|
223
|
+
return obj
|
|
224
|
+
}, {}),
|
|
225
|
+
).map((type) => generateTypeDef({ typeName: type, schemaType: types[type].schemaType }))
|
|
226
|
+
|
|
227
|
+
return `/* This file was auto-generated, do not manually edit. */
|
|
228
|
+
import ${generatorType} from '../${generatorType}'
|
|
229
|
+
import { components } from '../${generatorType}Types'
|
|
230
|
+
${
|
|
231
|
+
generatorType === 'Manage'
|
|
232
|
+
? "import { CommonParameters, CWMOptions } from '../ManageAPI'"
|
|
233
|
+
: "import { CommonParameters, CWAOptions } from '../AutomateAPI'"
|
|
234
|
+
}
|
|
235
|
+
import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
|
|
236
|
+
type schemas = components['schemas']
|
|
237
|
+
${generatorType === 'Automate' ? `type requestBodies = components['requestBodies']` : ''}
|
|
238
|
+
${typeDefs.join('\n')}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @public
|
|
242
|
+
*/
|
|
243
|
+
export default class ${apiName}API extends ${generatorType} {
|
|
244
|
+
constructor(props: ${generatorType === 'Manage' ? 'CWMOptions' : 'CWAOptions'}) {
|
|
245
|
+
super(props)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
${functions.join('\n')}
|
|
249
|
+
}
|
|
250
|
+
`
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
module.exports = {
|
|
254
|
+
generateAPIClass,
|
|
255
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
const { ESLint } = require('eslint')
|
|
5
|
+
const { generateAPIClass } = require('./generator.js')
|
|
6
|
+
const spec = require('./manage-json/manage.json')
|
|
7
|
+
|
|
8
|
+
const eslint = new ESLint({ fix: true })
|
|
9
|
+
|
|
10
|
+
async function generate() {
|
|
11
|
+
const {
|
|
12
|
+
paths,
|
|
13
|
+
components: { schemas },
|
|
14
|
+
} = spec
|
|
15
|
+
|
|
16
|
+
const tempFolder = path.join(__dirname, 'Manage')
|
|
17
|
+
const sections = {}
|
|
18
|
+
|
|
19
|
+
// generate temp directory
|
|
20
|
+
if (!fs.existsSync(tempFolder)) {
|
|
21
|
+
fs.mkdirSync(tempFolder)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Object.keys(paths).forEach((url) => {
|
|
25
|
+
const methods = paths[url]
|
|
26
|
+
const [_, section, ...rest] = url.split('/')
|
|
27
|
+
|
|
28
|
+
if (!sections[section]) {
|
|
29
|
+
sections[section] = []
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
sections[section].push({ url, methods })
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
for (const section of Object.keys(sections)) {
|
|
36
|
+
const apiName = section.charAt(0).toUpperCase() + section.slice(1)
|
|
37
|
+
const operations = sections[section]
|
|
38
|
+
const file = generateAPIClass({ apiName, operations, generatorType: 'Manage' })
|
|
39
|
+
const fileName = path.join(tempFolder, `${apiName}API.ts`)
|
|
40
|
+
if (fs.existsSync(fileName)) {
|
|
41
|
+
fs.rmSync(fileName)
|
|
42
|
+
}
|
|
43
|
+
console.log('Creating file', fileName)
|
|
44
|
+
fs.writeFileSync(fileName, file)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
console.log('running eslint')
|
|
48
|
+
const results = await eslint.lintFiles(['generator/Manage/**/*.ts'])
|
|
49
|
+
await ESLint.outputFixes(results)
|
|
50
|
+
const formatter = await eslint.loadFormatter('stylish')
|
|
51
|
+
const resultText = formatter.format(results)
|
|
52
|
+
console.log(resultText)
|
|
53
|
+
|
|
54
|
+
console.log('copying files to src/')
|
|
55
|
+
const files = fs.readdirSync(tempFolder)
|
|
56
|
+
files.forEach((file) => {
|
|
57
|
+
const manageFolder = path.join(__dirname, '../src', 'Manage')
|
|
58
|
+
if (!fs.existsSync(manageFolder)) {
|
|
59
|
+
fs.mkdirSync(manageFolder)
|
|
60
|
+
}
|
|
61
|
+
const src = path.join(tempFolder, file)
|
|
62
|
+
const dest = path.join(manageFolder, file)
|
|
63
|
+
console.log(`${src} ==> ${dest}`)
|
|
64
|
+
fs.copyFileSync(src, dest)
|
|
65
|
+
})
|
|
66
|
+
fs.rmSync(tempFolder, { recursive: true })
|
|
67
|
+
console.log('temp folder removed')
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log('generating static Manage client files')
|
|
71
|
+
generate().then(() => console.log('done'))
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const openapiTS = require('openapi-typescript')
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
const spec = require('./manage-json/manage.json')
|
|
6
|
+
|
|
7
|
+
const types = await openapiTS(spec)
|
|
8
|
+
fs.writeFileSync(path.join(__dirname, 'manage-types.ts'), types)
|
|
9
|
+
fs.copyFileSync(
|
|
10
|
+
path.join(__dirname, 'manage-types.ts'),
|
|
11
|
+
path.join(__dirname, '../src/ManageTypes.ts'),
|
|
12
|
+
)
|
|
13
|
+
fs.rmSync(path.join(__dirname, 'manage-types.ts'))
|
|
14
|
+
console.log('done')
|
package/package.json
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "connectwise-rest",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A nodejs module for interacting with the ConnectWise REST
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A nodejs module for interacting with the ConnectWise Manage and Automate REST APIs.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
8
|
+
"clean:docs": "npx rimraf docs/",
|
|
9
|
+
"clean:generator": "npx rimraf generator/Manage/*.ts generator/Automate/*.ts",
|
|
10
|
+
"clean:dist": "npx rimraf dist/",
|
|
11
|
+
"clean:src": "npx rimraf src/Manage/ & npx rimraf src/Automate/",
|
|
12
|
+
"clean": "npm run clean:dist & npm run clean:generator & npm run clean:src",
|
|
13
|
+
"test": "npx nyc mocha -r ts-node/register",
|
|
14
|
+
"pregenerate": "npm run clean",
|
|
15
|
+
"generate:automate": "node generator/automate-generator.js",
|
|
16
|
+
"generate:manage": "node generator/manage-generator.js",
|
|
17
|
+
"generate": "npm run generate:automate & npm run generate:manage",
|
|
18
|
+
"build": "npx tsc",
|
|
19
|
+
"postbuild": "npm run lint",
|
|
20
|
+
"lint": "npx eslint -c .eslintrc --fix",
|
|
21
|
+
"coveralls": "npx nyc report --reporter=text-lcov > ./.nyc_output/lcov.info",
|
|
22
|
+
"docs": "npx typedoc src/index.ts",
|
|
23
|
+
"gh-pages": "npx gh-pages -d docs"
|
|
12
24
|
},
|
|
13
25
|
"repository": {
|
|
14
26
|
"type": "git",
|
|
@@ -16,6 +28,8 @@
|
|
|
16
28
|
},
|
|
17
29
|
"keywords": [
|
|
18
30
|
"connectwise",
|
|
31
|
+
"connectwise manage",
|
|
32
|
+
"connectwise automate",
|
|
19
33
|
"rest",
|
|
20
34
|
"api",
|
|
21
35
|
"nodejs"
|
|
@@ -30,23 +44,36 @@
|
|
|
30
44
|
},
|
|
31
45
|
"homepage": "https://github.com/covenanttechnologysolutions/connectwise-rest",
|
|
32
46
|
"dependencies": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
47
|
+
"axios": "^0.26.1",
|
|
48
|
+
"promise-retry": "^2.0.1"
|
|
35
49
|
},
|
|
36
50
|
"devDependencies": {
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"eslint": "^
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
51
|
+
"@microsoft/api-documenter": "^7.16.0",
|
|
52
|
+
"@microsoft/api-extractor": "^7.19.5",
|
|
53
|
+
"@types/eslint": "^8.4.1",
|
|
54
|
+
"@types/mocha": "^9.1.0",
|
|
55
|
+
"@types/node": "^17.0.21",
|
|
56
|
+
"@types/promise-retry": "^1.1.3",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.15.0",
|
|
59
|
+
"coveralls": "^3.1.1",
|
|
60
|
+
"dotenv": "^16.0.0",
|
|
61
|
+
"eslint": "^8.11.0",
|
|
62
|
+
"eslint-config-prettier": "^8.5.0",
|
|
63
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
64
|
+
"gh-pages": "^3.2.3",
|
|
65
|
+
"lodash": "^4.17.21",
|
|
66
|
+
"mocha": "^9.2.2",
|
|
45
67
|
"mocha-lcov-reporter": "^1.3.0",
|
|
46
|
-
"nyc": "^
|
|
47
|
-
"
|
|
68
|
+
"nyc": "^15.1.0",
|
|
69
|
+
"openapi-typescript": "^5.2.0",
|
|
70
|
+
"prettier": "^2.6.0",
|
|
71
|
+
"rimraf": "^3.0.2",
|
|
72
|
+
"ts-node": "^10.7.0",
|
|
73
|
+
"typedoc": "^0.22.13",
|
|
74
|
+
"typescript": "^4.6.2"
|
|
48
75
|
},
|
|
49
76
|
"engines": {
|
|
50
|
-
"node": ">=
|
|
77
|
+
"node": ">=16"
|
|
51
78
|
}
|
|
52
79
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/* This file was auto-generated, do not manually edit. */
|
|
2
|
+
import Automate from '../Automate'
|
|
3
|
+
import { components } from '../AutomateTypes'
|
|
4
|
+
import { CommonParameters, CWAOptions } from '../AutomateAPI'
|
|
5
|
+
import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
|
|
6
|
+
type schemas = components['schemas']
|
|
7
|
+
type requestBodies = components['requestBodies']
|
|
8
|
+
export type LabTechModelsAVTemplatePolicy = schemas['LabTech.Models.AVTemplatePolicy']
|
|
9
|
+
export type LabTechModelsAVTemplatePolicyData = schemas['LabTech.Models.AVTemplatePolicyData']
|
|
10
|
+
export type LabTechModelsGroup = schemas['LabTech.Models.Group']
|
|
11
|
+
export type LabTechModelsTemplateAvailableProperty =
|
|
12
|
+
schemas['LabTech.Models.TemplateAvailableProperty']
|
|
13
|
+
export type LabTechModelsTemplateProperty = schemas['LabTech.Models.TemplateProperty']
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export default class AVTemplatePoliciesAPI extends Automate {
|
|
19
|
+
constructor(props: CWAOptions) {
|
|
20
|
+
super(props)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getAntivirusTemplatePolicyList(params: CommonParameters = {}): Promise<object> {
|
|
24
|
+
return this.request({
|
|
25
|
+
path: `/api/v1/AVTemplatePolicies`,
|
|
26
|
+
method: 'get',
|
|
27
|
+
params,
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
postAntivirusTemplatePolicy(
|
|
32
|
+
AVTemplatePolicy: LabTechModelsAVTemplatePolicy,
|
|
33
|
+
): Promise<LabTechModelsAVTemplatePolicy> {
|
|
34
|
+
return this.request({
|
|
35
|
+
path: `/api/v1/AVTemplatePolicies`,
|
|
36
|
+
method: 'post',
|
|
37
|
+
data: AVTemplatePolicy,
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getAntivirusTemplatePolicyDataList(params: CommonParameters = {}): Promise<object> {
|
|
42
|
+
return this.request({
|
|
43
|
+
path: `/api/v1/AVTemplatePolicyData`,
|
|
44
|
+
method: 'get',
|
|
45
|
+
params,
|
|
46
|
+
})
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
postAntivirusTemplatePolicyData(
|
|
50
|
+
AVTemplatePolicyData: LabTechModelsAVTemplatePolicyData,
|
|
51
|
+
): Promise<LabTechModelsAVTemplatePolicyData> {
|
|
52
|
+
return this.request({
|
|
53
|
+
path: `/api/v1/AVTemplatePolicyData`,
|
|
54
|
+
method: 'post',
|
|
55
|
+
data: AVTemplatePolicyData,
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getGroupList(params: CommonParameters = {}): Promise<Array<LabTechModelsGroup>> {
|
|
60
|
+
return this.request({
|
|
61
|
+
path: `/api/v1/Groups`,
|
|
62
|
+
method: 'get',
|
|
63
|
+
params,
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
postGroup(Group: LabTechModelsGroup): Promise<LabTechModelsGroup> {
|
|
68
|
+
return this.request({
|
|
69
|
+
path: `/api/v1/Groups`,
|
|
70
|
+
method: 'post',
|
|
71
|
+
data: Group,
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
getTemplateAvailablePropertyList(
|
|
76
|
+
params: CommonParameters = {},
|
|
77
|
+
): Promise<Array<LabTechModelsTemplateAvailableProperty>> {
|
|
78
|
+
return this.request({
|
|
79
|
+
path: `/api/v1/TemplateAvailableProperties`,
|
|
80
|
+
method: 'get',
|
|
81
|
+
params,
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
postTemplateAvailableProperty(
|
|
86
|
+
TemplateAvailableProperty: LabTechModelsTemplateAvailableProperty,
|
|
87
|
+
): Promise<LabTechModelsTemplateAvailableProperty> {
|
|
88
|
+
return this.request({
|
|
89
|
+
path: `/api/v1/TemplateAvailableProperties`,
|
|
90
|
+
method: 'post',
|
|
91
|
+
data: TemplateAvailableProperty,
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getTemplatePropertyList(
|
|
96
|
+
params: CommonParameters = {},
|
|
97
|
+
): Promise<Array<LabTechModelsTemplateProperty>> {
|
|
98
|
+
return this.request({
|
|
99
|
+
path: `/api/v1/TemplateProperties`,
|
|
100
|
+
method: 'get',
|
|
101
|
+
params,
|
|
102
|
+
})
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
postTemplateProperty(
|
|
106
|
+
TemplateProperty: LabTechModelsTemplateProperty,
|
|
107
|
+
): Promise<LabTechModelsTemplateProperty> {
|
|
108
|
+
return this.request({
|
|
109
|
+
path: `/api/v1/TemplateProperties`,
|
|
110
|
+
method: 'post',
|
|
111
|
+
data: TemplateProperty,
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
}
|