connectwise-rest 1.0.0 → 1.0.1

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.
Files changed (217) hide show
  1. package/.eslintrc +23 -26
  2. package/README.md +62 -12
  3. package/api-extractor.json +364 -364
  4. package/dist/Automate/AVTemplatePoliciesAPI.d.ts +10 -1
  5. package/dist/Automate/AVTemplatePoliciesAPI.d.ts.map +1 -1
  6. package/dist/Automate/AVTemplatePoliciesAPI.js +6 -1
  7. package/dist/Automate/AVTemplatePoliciesAPI.js.map +1 -1
  8. package/dist/Automate/ClientsAPI.d.ts +11 -1
  9. package/dist/Automate/ClientsAPI.d.ts.map +1 -1
  10. package/dist/Automate/ClientsAPI.js +6 -1
  11. package/dist/Automate/ClientsAPI.js.map +1 -1
  12. package/dist/Automate/CommandsAPI.d.ts +6 -1
  13. package/dist/Automate/CommandsAPI.d.ts.map +1 -1
  14. package/dist/Automate/CommandsAPI.js +6 -1
  15. package/dist/Automate/CommandsAPI.js.map +1 -1
  16. package/dist/Automate/ComputersAPI.d.ts +38 -1
  17. package/dist/Automate/ComputersAPI.d.ts.map +1 -1
  18. package/dist/Automate/ComputersAPI.js +6 -1
  19. package/dist/Automate/ComputersAPI.js.map +1 -1
  20. package/dist/Automate/ContactsAPI.d.ts +7 -1
  21. package/dist/Automate/ContactsAPI.d.ts.map +1 -1
  22. package/dist/Automate/ContactsAPI.js +6 -1
  23. package/dist/Automate/ContactsAPI.js.map +1 -1
  24. package/dist/Automate/DataViewsAPI.d.ts +7 -1
  25. package/dist/Automate/DataViewsAPI.d.ts.map +1 -1
  26. package/dist/Automate/DataViewsAPI.js +6 -1
  27. package/dist/Automate/DataViewsAPI.js.map +1 -1
  28. package/dist/Automate/DrivesAPI.d.ts +7 -1
  29. package/dist/Automate/DrivesAPI.d.ts.map +1 -1
  30. package/dist/Automate/DrivesAPI.js +6 -1
  31. package/dist/Automate/DrivesAPI.js.map +1 -1
  32. package/dist/Automate/EventLogsAPI.d.ts +6 -1
  33. package/dist/Automate/EventLogsAPI.d.ts.map +1 -1
  34. package/dist/Automate/EventLogsAPI.js +6 -1
  35. package/dist/Automate/EventLogsAPI.js.map +1 -1
  36. package/dist/Automate/LocationsAPI.d.ts +16 -1
  37. package/dist/Automate/LocationsAPI.d.ts.map +1 -1
  38. package/dist/Automate/LocationsAPI.js +6 -1
  39. package/dist/Automate/LocationsAPI.js.map +1 -1
  40. package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts +6 -1
  41. package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts.map +1 -1
  42. package/dist/Automate/MaintenanceWindowDefinitionsAPI.js +6 -1
  43. package/dist/Automate/MaintenanceWindowDefinitionsAPI.js.map +1 -1
  44. package/dist/Automate/MonitorsAPI.d.ts +7 -1
  45. package/dist/Automate/MonitorsAPI.d.ts.map +1 -1
  46. package/dist/Automate/MonitorsAPI.js +6 -1
  47. package/dist/Automate/MonitorsAPI.js.map +1 -1
  48. package/dist/Automate/NetworkDevicesAPI.d.ts +7 -1
  49. package/dist/Automate/NetworkDevicesAPI.d.ts.map +1 -1
  50. package/dist/Automate/NetworkDevicesAPI.js +6 -1
  51. package/dist/Automate/NetworkDevicesAPI.js.map +1 -1
  52. package/dist/Automate/PatchingAPI.d.ts +7 -1
  53. package/dist/Automate/PatchingAPI.d.ts.map +1 -1
  54. package/dist/Automate/PatchingAPI.js +6 -1
  55. package/dist/Automate/PatchingAPI.js.map +1 -1
  56. package/dist/Automate/RemoteAgentAPI.d.ts +7 -1
  57. package/dist/Automate/RemoteAgentAPI.d.ts.map +1 -1
  58. package/dist/Automate/RemoteAgentAPI.js +6 -1
  59. package/dist/Automate/RemoteAgentAPI.js.map +1 -1
  60. package/dist/Automate/ScriptingAPI.d.ts +10 -1
  61. package/dist/Automate/ScriptingAPI.d.ts.map +1 -1
  62. package/dist/Automate/ScriptingAPI.js +6 -1
  63. package/dist/Automate/ScriptingAPI.js.map +1 -1
  64. package/dist/Automate/SearchesAPI.d.ts +7 -1
  65. package/dist/Automate/SearchesAPI.d.ts.map +1 -1
  66. package/dist/Automate/SearchesAPI.js +6 -1
  67. package/dist/Automate/SearchesAPI.js.map +1 -1
  68. package/dist/Automate/SystemAPI.d.ts +28 -3
  69. package/dist/Automate/SystemAPI.d.ts.map +1 -1
  70. package/dist/Automate/SystemAPI.js +8 -3
  71. package/dist/Automate/SystemAPI.js.map +1 -1
  72. package/dist/Automate/TicketsAPI.d.ts +5 -1
  73. package/dist/Automate/TicketsAPI.d.ts.map +1 -1
  74. package/dist/Automate/TicketsAPI.js +6 -1
  75. package/dist/Automate/TicketsAPI.js.map +1 -1
  76. package/dist/Automate/UserProfilesAPI.d.ts +6 -1
  77. package/dist/Automate/UserProfilesAPI.d.ts.map +1 -1
  78. package/dist/Automate/UserProfilesAPI.js +6 -1
  79. package/dist/Automate/UserProfilesAPI.js.map +1 -1
  80. package/dist/Automate.d.ts +0 -5
  81. package/dist/Automate.d.ts.map +1 -1
  82. package/dist/Automate.js +0 -3
  83. package/dist/Automate.js.map +1 -1
  84. package/dist/AutomateAPI.d.ts +55 -22
  85. package/dist/AutomateAPI.d.ts.map +1 -1
  86. package/dist/AutomateAPI.js +46 -39
  87. package/dist/AutomateAPI.js.map +1 -1
  88. package/dist/BaseAPI.d.ts +13 -0
  89. package/dist/BaseAPI.d.ts.map +1 -1
  90. package/dist/BaseAPI.js +64 -1
  91. package/dist/BaseAPI.js.map +1 -1
  92. package/dist/Manage/CompanyAPI.d.ts +90 -1
  93. package/dist/Manage/CompanyAPI.d.ts.map +1 -1
  94. package/dist/Manage/CompanyAPI.js +6 -1
  95. package/dist/Manage/CompanyAPI.js.map +1 -1
  96. package/dist/Manage/ConfigurationsAPI.d.ts +9 -1
  97. package/dist/Manage/ConfigurationsAPI.d.ts.map +1 -1
  98. package/dist/Manage/ConfigurationsAPI.js +6 -1
  99. package/dist/Manage/ConfigurationsAPI.js.map +1 -1
  100. package/dist/Manage/ExpenseAPI.d.ts +18 -1
  101. package/dist/Manage/ExpenseAPI.d.ts.map +1 -1
  102. package/dist/Manage/ExpenseAPI.js +6 -1
  103. package/dist/Manage/ExpenseAPI.js.map +1 -1
  104. package/dist/Manage/FinanceAPI.d.ts +79 -1
  105. package/dist/Manage/FinanceAPI.d.ts.map +1 -1
  106. package/dist/Manage/FinanceAPI.js +6 -1
  107. package/dist/Manage/FinanceAPI.js.map +1 -1
  108. package/dist/Manage/MarketingAPI.d.ts +23 -1
  109. package/dist/Manage/MarketingAPI.d.ts.map +1 -1
  110. package/dist/Manage/MarketingAPI.js +6 -1
  111. package/dist/Manage/MarketingAPI.js.map +1 -1
  112. package/dist/Manage/ProcurementAPI.d.ts +63 -1
  113. package/dist/Manage/ProcurementAPI.d.ts.map +1 -1
  114. package/dist/Manage/ProcurementAPI.js +6 -1
  115. package/dist/Manage/ProcurementAPI.js.map +1 -1
  116. package/dist/Manage/ProjectAPI.d.ts +37 -1
  117. package/dist/Manage/ProjectAPI.d.ts.map +1 -1
  118. package/dist/Manage/ProjectAPI.js +6 -1
  119. package/dist/Manage/ProjectAPI.js.map +1 -1
  120. package/dist/Manage/SalesAPI.d.ts +46 -1
  121. package/dist/Manage/SalesAPI.d.ts.map +1 -1
  122. package/dist/Manage/SalesAPI.js +6 -1
  123. package/dist/Manage/SalesAPI.js.map +1 -1
  124. package/dist/Manage/ScheduleAPI.d.ts +22 -1
  125. package/dist/Manage/ScheduleAPI.d.ts.map +1 -1
  126. package/dist/Manage/ScheduleAPI.js +6 -1
  127. package/dist/Manage/ScheduleAPI.js.map +1 -1
  128. package/dist/Manage/ServiceAPI.d.ts +75 -1
  129. package/dist/Manage/ServiceAPI.d.ts.map +1 -1
  130. package/dist/Manage/ServiceAPI.js +6 -1
  131. package/dist/Manage/ServiceAPI.js.map +1 -1
  132. package/dist/Manage/SystemAPI.d.ts +146 -1
  133. package/dist/Manage/SystemAPI.d.ts.map +1 -1
  134. package/dist/Manage/SystemAPI.js +6 -1
  135. package/dist/Manage/SystemAPI.js.map +1 -1
  136. package/dist/Manage/TimeAPI.d.ts +30 -1
  137. package/dist/Manage/TimeAPI.d.ts.map +1 -1
  138. package/dist/Manage/TimeAPI.js +6 -1
  139. package/dist/Manage/TimeAPI.js.map +1 -1
  140. package/dist/Manage.d.ts +5 -0
  141. package/dist/Manage.d.ts.map +1 -1
  142. package/dist/Manage.js +10 -0
  143. package/dist/Manage.js.map +1 -1
  144. package/dist/ManageAPI.d.ts +51 -15
  145. package/dist/ManageAPI.d.ts.map +1 -1
  146. package/dist/ManageAPI.js +27 -24
  147. package/dist/ManageAPI.js.map +1 -1
  148. package/dist/connectwise-rest.d.ts +108638 -0
  149. package/dist/index.d.ts +6 -3
  150. package/dist/index.d.ts.map +1 -1
  151. package/dist/index.js +0 -2
  152. package/dist/index.js.map +1 -1
  153. package/dist/tsdoc-metadata.json +11 -0
  154. package/dist/types.d.ts +4 -2
  155. package/dist/types.d.ts.map +1 -1
  156. package/dist/types.js.map +1 -1
  157. package/dist/utils/Callback.d.ts +3 -0
  158. package/dist/utils/Callback.d.ts.map +1 -1
  159. package/dist/utils/Callback.js.map +1 -1
  160. package/dist/utils/Series.d.ts +6 -0
  161. package/dist/utils/Series.d.ts.map +1 -1
  162. package/dist/utils/Series.js +6 -2
  163. package/dist/utils/Series.js.map +1 -1
  164. package/package.json +5 -2
  165. package/src/Automate/AVTemplatePoliciesAPI.ts +11 -1
  166. package/src/Automate/ClientsAPI.ts +12 -1
  167. package/src/Automate/CommandsAPI.ts +7 -1
  168. package/src/Automate/ComputersAPI.ts +39 -1
  169. package/src/Automate/ContactsAPI.ts +8 -1
  170. package/src/Automate/DataViewsAPI.ts +8 -1
  171. package/src/Automate/DrivesAPI.ts +8 -1
  172. package/src/Automate/EventLogsAPI.ts +7 -1
  173. package/src/Automate/LocationsAPI.ts +17 -1
  174. package/src/Automate/MaintenanceWindowDefinitionsAPI.ts +7 -1
  175. package/src/Automate/MonitorsAPI.ts +8 -1
  176. package/src/Automate/NetworkDevicesAPI.ts +8 -1
  177. package/src/Automate/PatchingAPI.ts +8 -1
  178. package/src/Automate/RemoteAgentAPI.ts +8 -1
  179. package/src/Automate/ScriptingAPI.ts +11 -1
  180. package/src/Automate/SearchesAPI.ts +8 -1
  181. package/src/Automate/SystemAPI.ts +29 -3
  182. package/src/Automate/TicketsAPI.ts +6 -1
  183. package/src/Automate/UserProfilesAPI.ts +7 -1
  184. package/src/Automate.ts +0 -12
  185. package/src/AutomateAPI.ts +77 -43
  186. package/src/AutomateTypes.ts +1 -1
  187. package/src/BaseAPI.ts +97 -0
  188. package/src/Manage/CompanyAPI.ts +91 -1
  189. package/src/Manage/ConfigurationsAPI.ts +10 -1
  190. package/src/Manage/ExpenseAPI.ts +19 -1
  191. package/src/Manage/FinanceAPI.ts +80 -1
  192. package/src/Manage/MarketingAPI.ts +24 -1
  193. package/src/Manage/ProcurementAPI.ts +64 -1
  194. package/src/Manage/ProjectAPI.ts +38 -1
  195. package/src/Manage/SalesAPI.ts +47 -1
  196. package/src/Manage/ScheduleAPI.ts +23 -1
  197. package/src/Manage/ServiceAPI.ts +76 -1
  198. package/src/Manage/SystemAPI.ts +147 -1
  199. package/src/Manage/TimeAPI.ts +31 -1
  200. package/src/Manage.ts +10 -1
  201. package/src/ManageAPI.ts +66 -29
  202. package/src/index.ts +6 -11
  203. package/src/types.ts +4 -2
  204. package/src/utils/Callback.ts +3 -0
  205. package/src/utils/Series.ts +6 -0
  206. package/swagger-errors.md +25 -30
  207. package/test/test.ts +34 -5
  208. package/.github/workflows/codeql-analysis.yml +0 -70
  209. package/.github/workflows/node.js.yml +0 -42
  210. package/.travis.yml +0 -11
  211. package/generator/automate-generator.js +0 -75
  212. package/generator/automate-json.js +0 -61
  213. package/generator/automate-types.js +0 -15
  214. package/generator/generator.d.ts +0 -67
  215. package/generator/generator.js +0 -255
  216. package/generator/manage-generator.js +0 -71
  217. package/generator/manage-types.js +0 -14
@@ -5,13 +5,20 @@ import { CommonParameters, CWAOptions } from '../AutomateAPI'
5
5
  import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
6
6
  type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
+ /** {@link LabTechModelsRemoteAgentSchedule} */
8
9
  export type LabTechModelsRemoteAgentSchedule = schemas['LabTech.Models.RemoteAgentSchedule']
10
+ /** {@link LabTechModelsRemoteAgentTemplate} */
9
11
  export type LabTechModelsRemoteAgentTemplate = schemas['LabTech.Models.RemoteAgentTemplate']
10
12
 
11
13
  /**
14
+ * @module RemoteAgentAPI
15
+ */
16
+
17
+ /**
18
+ * RemoteAgent module
12
19
  * @public
13
20
  */
14
- export default class RemoteAgentAPI extends Automate {
21
+ export class RemoteAgentAPI extends Automate {
15
22
  constructor(props: CWAOptions) {
16
23
  super(props)
17
24
  }
@@ -5,19 +5,29 @@ import { CommonParameters, CWAOptions } from '../AutomateAPI'
5
5
  import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
6
6
  type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
+ /** {@link AutomateApiDomainContractsScriptsRunningScriptsRunningScript} */
8
9
  export type AutomateApiDomainContractsScriptsRunningScriptsRunningScript =
9
10
  schemas['Automate.Api.Domain.Contracts.Scripts.RunningScripts.RunningScript']
11
+ /** {@link AutomateApiDomainContractsScriptsScheduledScript} */
10
12
  export type AutomateApiDomainContractsScriptsScheduledScript =
11
13
  schemas['Automate.Api.Domain.Contracts.Scripts.ScheduledScript']
14
+ /** {@link LabTechModelsScript} */
12
15
  export type LabTechModelsScript = schemas['LabTech.Models.Script']
16
+ /** {@link LabTechModelsScriptFolder} */
13
17
  export type LabTechModelsScriptFolder = schemas['LabTech.Models.ScriptFolder']
18
+ /** {@link LabTechRESTApiModelsPatchOperationArray} */
14
19
  export type LabTechRESTApiModelsPatchOperationArray =
15
20
  requestBodies['LabTech.RESTApi.Models.PatchOperationArray']
16
21
 
17
22
  /**
23
+ * @module ScriptingAPI
24
+ */
25
+
26
+ /**
27
+ * Scripting module
18
28
  * @public
19
29
  */
20
- export default class ScriptingAPI extends Automate {
30
+ export class ScriptingAPI extends Automate {
21
31
  constructor(props: CWAOptions) {
22
32
  super(props)
23
33
  }
@@ -5,13 +5,20 @@ import { CommonParameters, CWAOptions } from '../AutomateAPI'
5
5
  import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
6
6
  type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
+ /** {@link LabTechModelsSearch} */
8
9
  export type LabTechModelsSearch = schemas['LabTech.Models.Search']
10
+ /** {@link LabTechModelsSearchFolder} */
9
11
  export type LabTechModelsSearchFolder = schemas['LabTech.Models.SearchFolder']
10
12
 
11
13
  /**
14
+ * @module SearchesAPI
15
+ */
16
+
17
+ /**
18
+ * Searches module
12
19
  * @public
13
20
  */
14
- export default class SearchesAPI extends Automate {
21
+ export class SearchesAPI extends Automate {
15
22
  constructor(props: CWAOptions) {
16
23
  super(props)
17
24
  }
@@ -5,58 +5,84 @@ import { CommonParameters, CWAOptions } from '../AutomateAPI'
5
5
  import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
6
6
  type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
+ /** {@link AutomateApiDomainContractsPresentationLayerWebExtensionsUserClassWebExtensionRequest} */
8
9
  export type AutomateApiDomainContractsPresentationLayerWebExtensionsUserClassWebExtensionRequest =
9
10
  schemas['Automate.Api.Domain.Contracts.PresentationLayer.WebExtensions.UserClassWebExtensionRequest']
11
+ /** {@link AutomateApiDomainContractsPresentationLayerWebExtensionsUserClassWebExtensionViewModel} */
10
12
  export type AutomateApiDomainContractsPresentationLayerWebExtensionsUserClassWebExtensionViewModel =
11
13
  schemas['Automate.Api.Domain.Contracts.PresentationLayer.WebExtensions.UserClassWebExtensionViewModel']
14
+ /** {@link AutomateApiDomainContractsSecurityAuthInformation} */
12
15
  export type AutomateApiDomainContractsSecurityAuthInformation =
13
16
  schemas['Automate.Api.Domain.Contracts.Security.AuthInformation']
17
+ /** {@link AutomateApiDomainContractsSecurityTokenCredentials} */
14
18
  export type AutomateApiDomainContractsSecurityTokenCredentials =
15
19
  schemas['Automate.Api.Domain.Contracts.Security.TokenCredentials']
20
+ /** {@link AutomateApiDomainContractsSecurityTokenResult} */
16
21
  export type AutomateApiDomainContractsSecurityTokenResult =
17
22
  schemas['Automate.Api.Domain.Contracts.Security.TokenResult']
23
+ /** {@link AutomateApiDomainContractsSystemServerInformation} */
18
24
  export type AutomateApiDomainContractsSystemServerInformation =
19
25
  schemas['Automate.Api.Domain.Contracts.System.ServerInformation']
26
+ /** {@link AutomateApiDomainContractsUsersChangePasswordRequest} */
20
27
  export type AutomateApiDomainContractsUsersChangePasswordRequest =
21
28
  schemas['Automate.Api.Domain.Contracts.Users.ChangePasswordRequest']
29
+ /** {@link AutomateApiDomainContractsUsersUser} */
22
30
  export type AutomateApiDomainContractsUsersUser =
23
31
  schemas['Automate.Api.Domain.Contracts.Users.User']
32
+ /** {@link AutomateApiDomainContractsUsersUserAccess} */
24
33
  export type AutomateApiDomainContractsUsersUserAccess =
25
34
  schemas['Automate.Api.Domain.Contracts.Users.UserAccess']
35
+ /** {@link AutomateApiDomainContractsUsersUserClass} */
26
36
  export type AutomateApiDomainContractsUsersUserClass =
27
37
  schemas['Automate.Api.Domain.Contracts.Users.UserClass']
38
+ /** {@link AutomateApiDomainContractsUsersUserFolder} */
28
39
  export type AutomateApiDomainContractsUsersUserFolder =
29
40
  schemas['Automate.Api.Domain.Contracts.Users.UserFolder']
41
+ /** {@link LabTechModelsExternalSystemCredentials} */
30
42
  export type LabTechModelsExternalSystemCredentials =
31
43
  schemas['LabTech.Models.ExternalSystemCredentials']
44
+ /** {@link LabTechModelsFeatureFlag} */
32
45
  export type LabTechModelsFeatureFlag = schemas['LabTech.Models.FeatureFlag']
46
+ /** {@link LabTechModelsLicensedProduct} */
33
47
  export type LabTechModelsLicensedProduct = schemas['LabTech.Models.LicensedProduct']
48
+ /** {@link LabTechModelsLink} */
34
49
  export type LabTechModelsLink = schemas['LabTech.Models.Link']
50
+ /** {@link LabTechModelsPatchInformation} */
35
51
  export type LabTechModelsPatchInformation = schemas['LabTech.Models.PatchInformation']
52
+ /** {@link LabTechModelsUserAudit} */
36
53
  export type LabTechModelsUserAudit = schemas['LabTech.Models.UserAudit']
54
+ /** {@link LabTechModelsUserFavorite} */
37
55
  export type LabTechModelsUserFavorite = schemas['LabTech.Models.UserFavorite']
56
+ /** {@link LabTechModelsUserSetting} */
38
57
  export type LabTechModelsUserSetting = schemas['LabTech.Models.UserSetting']
58
+ /** {@link LabTechRESTApiModelsPatchOperationArray} */
39
59
  export type LabTechRESTApiModelsPatchOperationArray =
40
60
  requestBodies['LabTech.RESTApi.Models.PatchOperationArray']
61
+ /** {@link LabTechRESTApiSecurityAuthServiceCredentials} */
41
62
  export type LabTechRESTApiSecurityAuthServiceCredentials =
42
63
  schemas['LabTech.RESTApi.Security.AuthServiceCredentials']
43
64
 
44
65
  /**
66
+ * @module SystemAPI
67
+ */
68
+
69
+ /**
70
+ * System module
45
71
  * @public
46
72
  */
47
- export default class SystemAPI extends Automate {
73
+ export class SystemAPI extends Automate {
48
74
  constructor(props: CWAOptions) {
49
75
  super(props)
50
76
  }
51
77
 
52
- get(): Promise<AutomateApiDomainContractsSecurityAuthInformation> {
78
+ getAuthInformation(): Promise<AutomateApiDomainContractsSecurityAuthInformation> {
53
79
  return this.request({
54
80
  path: `/api/v1/APIToken`,
55
81
  method: 'get',
56
82
  })
57
83
  }
58
84
 
59
- post(
85
+ postToken(
60
86
  TokenCredentials: AutomateApiDomainContractsSecurityTokenCredentials,
61
87
  ): Promise<AutomateApiDomainContractsSecurityTokenResult> {
62
88
  return this.request({
@@ -7,9 +7,14 @@ type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
8
 
9
9
  /**
10
+ * @module TicketsAPI
11
+ */
12
+
13
+ /**
14
+ * Tickets module
10
15
  * @public
11
16
  */
12
- export default class TicketsAPI extends Automate {
17
+ export class TicketsAPI extends Automate {
13
18
  constructor(props: CWAOptions) {
14
19
  super(props)
15
20
  }
@@ -5,13 +5,19 @@ import { CommonParameters, CWAOptions } from '../AutomateAPI'
5
5
  import { NoContentResponse, OctetStreamResponse, PDFResponse, HTMLResponse } from '../types'
6
6
  type schemas = components['schemas']
7
7
  type requestBodies = components['requestBodies']
8
+ /** {@link LabTechRepositoriesMySQLDomainModelsPresentationLayerUserProfile} */
8
9
  export type LabTechRepositoriesMySQLDomainModelsPresentationLayerUserProfile =
9
10
  schemas['LabTech.Repositories.MySQL.Domain.Models.PresentationLayer.UserProfile']
10
11
 
11
12
  /**
13
+ * @module UserProfilesAPI
14
+ */
15
+
16
+ /**
17
+ * UserProfiles module
12
18
  * @public
13
19
  */
14
- export default class UserProfilesAPI extends Automate {
20
+ export class UserProfilesAPI extends Automate {
15
21
  constructor(props: CWAOptions) {
16
22
  super(props)
17
23
  }
package/src/Automate.ts CHANGED
@@ -140,18 +140,6 @@ export default class Automate {
140
140
  return result.data
141
141
  }
142
142
 
143
- static async refreshToken({
144
- username,
145
- password,
146
- serverUrl,
147
- }: {
148
- username: string
149
- password: string
150
- serverUrl: string
151
- }) {
152
- // @todo how
153
- }
154
-
155
143
  async verifyToken() {
156
144
  try {
157
145
  const result = await this.api({ path: '/api/v1/FeatureFlags', method: 'get' })
@@ -1,46 +1,44 @@
1
1
  import Automate from './Automate'
2
2
  import { CWLogger, RetryOptions } from './types'
3
- import AVTemplatePoliciesAPI from './Automate/AVTemplatePoliciesAPI'
4
- import ClientsAPI from './Automate/ClientsAPI'
5
- import CommandsAPI from './Automate/CommandsAPI'
6
- import ComputersAPI from './Automate/ComputersAPI'
7
- import ContactsAPI from './Automate/ContactsAPI'
8
- import DataViewsAPI from './Automate/DataViewsAPI'
9
- import DrivesAPI from './Automate/DrivesAPI'
10
- import EventLogsAPI from './Automate/EventLogsAPI'
11
- import LocationsAPI from './Automate/LocationsAPI'
12
- import MaintenanceWindowDefinitionsAPI from './Automate/MaintenanceWindowDefinitionsAPI'
13
- import MonitorsAPI from './Automate/MonitorsAPI'
14
- import NetworkDevicesAPI from './Automate/NetworkDevicesAPI'
15
- import PatchingAPI from './Automate/PatchingAPI'
16
- import RemoteAgentAPI from './Automate/RemoteAgentAPI'
17
- import ScriptingAPI from './Automate/ScriptingAPI'
18
- import SearchesAPI from './Automate/SearchesAPI'
19
- import SystemAPI from './Automate/SystemAPI'
20
- import TicketAPI from './Automate/TicketsAPI'
21
- import UserProfilesAPI from './Automate/UserProfilesAPI'
3
+ import { AVTemplatePoliciesAPI } from './Automate/AVTemplatePoliciesAPI'
4
+ import { ClientsAPI } from './Automate/ClientsAPI'
5
+ import { CommandsAPI } from './Automate/CommandsAPI'
6
+ import { ComputersAPI } from './Automate/ComputersAPI'
7
+ import { ContactsAPI } from './Automate/ContactsAPI'
8
+ import { DataViewsAPI } from './Automate/DataViewsAPI'
9
+ import { DrivesAPI } from './Automate/DrivesAPI'
10
+ import { EventLogsAPI } from './Automate/EventLogsAPI'
11
+ import { LocationsAPI } from './Automate/LocationsAPI'
12
+ import { MaintenanceWindowDefinitionsAPI } from './Automate/MaintenanceWindowDefinitionsAPI'
13
+ import { MonitorsAPI } from './Automate/MonitorsAPI'
14
+ import { NetworkDevicesAPI } from './Automate/NetworkDevicesAPI'
15
+ import { PatchingAPI } from './Automate/PatchingAPI'
16
+ import { RemoteAgentAPI } from './Automate/RemoteAgentAPI'
17
+ import { ScriptingAPI } from './Automate/ScriptingAPI'
18
+ import { SearchesAPI } from './Automate/SearchesAPI'
19
+ import { SystemAPI } from './Automate/SystemAPI'
20
+ import { TicketsAPI } from './Automate/TicketsAPI'
21
+ import { UserProfilesAPI } from './Automate/UserProfilesAPI'
22
22
 
23
- export type {
24
- AVTemplatePoliciesAPI,
25
- ClientsAPI,
26
- CommandsAPI,
27
- ComputersAPI,
28
- ContactsAPI,
29
- DataViewsAPI,
30
- DrivesAPI,
31
- EventLogsAPI,
32
- LocationsAPI,
33
- MaintenanceWindowDefinitionsAPI,
34
- MonitorsAPI,
35
- NetworkDevicesAPI,
36
- PatchingAPI,
37
- RemoteAgentAPI,
38
- ScriptingAPI,
39
- SearchesAPI,
40
- SystemAPI,
41
- TicketAPI,
42
- UserProfilesAPI,
43
- }
23
+ import type * as AVTemplatePoliciesAPITypes from './Automate/AVTemplatePoliciesAPI'
24
+ import type * as ClientsAPITypes from './Automate/ClientsAPI'
25
+ import type * as CommandsAPITypes from './Automate/CommandsAPI'
26
+ import type * as ComputersAPITypes from './Automate/ComputersAPI'
27
+ import type * as ContactsAPITypes from './Automate/ContactsAPI'
28
+ import type * as DataViewsAPITypes from './Automate/DataViewsAPI'
29
+ import type * as DrivesAPITypes from './Automate/DrivesAPI'
30
+ import type * as EventLogsAPITypes from './Automate/EventLogsAPI'
31
+ import type * as LocationsAPITypes from './Automate/LocationsAPI'
32
+ import type * as MaintenanceWindowDefinitionsAPITypes from './Automate/MaintenanceWindowDefinitionsAPI'
33
+ import type * as MonitorsAPITypes from './Automate/MonitorsAPI'
34
+ import type * as NetworkDevicesAPITypes from './Automate/NetworkDevicesAPI'
35
+ import type * as PatchingAPITypes from './Automate/PatchingAPI'
36
+ import type * as RemoteAgentAPITypes from './Automate/RemoteAgentAPI'
37
+ import type * as ScriptingAPITypes from './Automate/ScriptingAPI'
38
+ import type * as SearchesAPITypes from './Automate/SearchesAPI'
39
+ import type * as SystemAPITypes from './Automate/SystemAPI'
40
+ import type * as TicketsAPITypes from './Automate/TicketsAPI'
41
+ import type * as UserProfilesAPITypes from './Automate/UserProfilesAPI'
44
42
 
45
43
  /**
46
44
  * @public
@@ -59,6 +57,9 @@ export type CWAOptions = {
59
57
  debug?: boolean
60
58
  }
61
59
 
60
+ /**
61
+ * @public
62
+ */
62
63
  export type OrderBy = {
63
64
  name?: string
64
65
  type?: 'Undefined' | 'Ascending' | 'Descending'
@@ -81,6 +82,9 @@ export type CommonParameters = {
81
82
  timeout?: number
82
83
  }
83
84
 
85
+ /**
86
+ * @public
87
+ */
84
88
  export type QueryOptionExpand = {
85
89
  fieldName?: string
86
90
  page?: number
@@ -95,9 +99,13 @@ export type QueryOptionExpand = {
95
99
  }
96
100
 
97
101
  /**
102
+ * @module AutomateAPI
98
103
  * @public
99
104
  */
100
- export default class AutomateAPI extends Automate {
105
+ class AutomateAPI extends Automate {
106
+ /**
107
+ * @public
108
+ */
101
109
  AVTemplatePoliciesAPI: AVTemplatePoliciesAPI
102
110
  ClientsAPI: ClientsAPI
103
111
  CommandsAPI: CommandsAPI
@@ -115,7 +123,7 @@ export default class AutomateAPI extends Automate {
115
123
  ScriptingAPI: ScriptingAPI
116
124
  SearchesAPI: SearchesAPI
117
125
  SystemAPI: SystemAPI
118
- TicketAPI: TicketAPI
126
+ TicketsAPI: TicketsAPI
119
127
  UserProfilesAPI: UserProfilesAPI
120
128
 
121
129
  constructor(options: CWAOptions) {
@@ -138,7 +146,33 @@ export default class AutomateAPI extends Automate {
138
146
  this.ScriptingAPI = new ScriptingAPI(options)
139
147
  this.SearchesAPI = new SearchesAPI(options)
140
148
  this.SystemAPI = new SystemAPI(options)
141
- this.TicketAPI = new TicketAPI(options)
149
+ this.TicketsAPI = new TicketsAPI(options)
142
150
  this.UserProfilesAPI = new UserProfilesAPI(options)
143
151
  }
144
152
  }
153
+
154
+ /**
155
+ * @public
156
+ */
157
+ export default AutomateAPI
158
+ export type {
159
+ AVTemplatePoliciesAPITypes,
160
+ ClientsAPITypes,
161
+ CommandsAPITypes,
162
+ ComputersAPITypes,
163
+ ContactsAPITypes,
164
+ DataViewsAPITypes,
165
+ DrivesAPITypes,
166
+ EventLogsAPITypes,
167
+ LocationsAPITypes,
168
+ MaintenanceWindowDefinitionsAPITypes,
169
+ MonitorsAPITypes,
170
+ NetworkDevicesAPITypes,
171
+ PatchingAPITypes,
172
+ RemoteAgentAPITypes,
173
+ ScriptingAPITypes,
174
+ SearchesAPITypes,
175
+ SystemAPITypes,
176
+ TicketsAPITypes,
177
+ UserProfilesAPITypes,
178
+ }
@@ -10,7 +10,7 @@ export interface paths {
10
10
  get: operations['Tickets_GetTicketList']
11
11
  }
12
12
  '/api/v1/APIToken': {
13
- get: operations['ApiToken_GetToken']
13
+ get: operations['ApiToken_Get']
14
14
  post: operations['ApiToken_Post']
15
15
  }
16
16
  '/api/v1/System/ServerInformation': {
package/src/BaseAPI.ts CHANGED
@@ -2,6 +2,7 @@ import { RequestOptions } from './types'
2
2
  import promiseRetry from 'promise-retry'
3
3
  import Manage, { ManageConfig } from './Manage'
4
4
  import Automate, { AutomateConfig } from './Automate'
5
+ import { CommonParameters } from './AutomateAPI'
5
6
 
6
7
  /**
7
8
  * curried request function
@@ -81,3 +82,99 @@ export const makeRequest =
81
82
  })
82
83
  }
83
84
  }
85
+
86
+ export interface PaginationConfig {
87
+ thisObj: InstanceType<typeof Automate | typeof Manage>
88
+ }
89
+
90
+ // eslint-disable-next-line @typescript-eslint/ban-types
91
+ export type PaginationApiMethod = Function
92
+
93
+ export type PaginationOptions = {
94
+ pageSize?: number
95
+ startPage?: number
96
+ }
97
+
98
+ /**
99
+ * curried paginate function
100
+ * @internal
101
+ */
102
+ export const makePaginate =
103
+ ({ thisObj }: PaginationConfig) =>
104
+ (
105
+ apiMethod: PaginationApiMethod,
106
+ paginateArgs: PaginationOptions = {},
107
+ ...methodArgs: Record<string, unknown>[]
108
+ ): Promise<unknown[]> => {
109
+ const { startPage = 0, pageSize = 1000 } = paginateArgs
110
+
111
+ return new Promise(async (resolve, reject) => {
112
+ let results: unknown[] = []
113
+
114
+ let page = startPage
115
+
116
+ if (startPage === undefined || startPage < 1) {
117
+ page = 0
118
+ }
119
+
120
+ while (true) {
121
+ try {
122
+ const result = await getPage(apiMethod, methodArgs, thisObj, page++, pageSize)
123
+ // complete page returned, loop again
124
+ if (Array.isArray(result) && result.length > 0) {
125
+ results = results.concat(result)
126
+ } else {
127
+ // incomplete page, this is the last page of results, exit loop and return
128
+ break
129
+ }
130
+ } catch (error: unknown) {
131
+ return reject(error)
132
+ }
133
+ }
134
+
135
+ return resolve(results)
136
+ })
137
+ }
138
+
139
+ /**
140
+ * @internal
141
+ */
142
+ function getPage(
143
+ apiMethod: PaginationApiMethod,
144
+ methodArgs: Record<string, unknown>[],
145
+ thisObj: InstanceType<typeof Automate | typeof Manage>,
146
+ page = 1,
147
+ pageSize = 1000,
148
+ ): Promise<unknown[]> {
149
+ // Javascript Function.length returns number of non-default values
150
+ // the method args will always be greater than the api method args
151
+ // due to this, if params is not passed in, even as an empty object,
152
+ // we need to throw an error
153
+ if (methodArgs.length < apiMethod.length) {
154
+ throw new Error(
155
+ `CommonParams must be passed in for pagination to work properly for function ${apiMethod.name}`,
156
+ )
157
+ }
158
+
159
+ // look for CommonParams and inject page and pageSize
160
+ // check for apiMethod function args length
161
+ // get last arg
162
+ const commonParams = <CommonParameters>methodArgs.pop()
163
+ commonParams.page = page
164
+ commonParams.pageSize = pageSize
165
+
166
+ methodArgs.push(commonParams)
167
+
168
+ return apiMethod.apply(thisObj, methodArgs)
169
+ }
170
+
171
+ /**
172
+ * @internal
173
+ */
174
+ function isCommonParametersLike(input: unknown): input is CommonParameters {
175
+ if (typeof input === 'object' && input !== null) {
176
+ return true
177
+ } else {
178
+ return false
179
+ }
180
+ }