gizmovsky 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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/GizmoClient.js +0 -2
- package/src/index.js +9 -4
- package/src/v1/Apps.js +53 -1
- package/src/v1/Attributes.js +26 -0
- package/src/v1/Export.js +12 -0
- package/src/v1/HostComputers.js +67 -0
- package/src/v1/HostGroups.js +21 -0
- package/src/v1/Hosts.js +78 -0
- package/src/v1/Invoices.js +27 -0
- package/src/v1/Licenses.js +11 -0
- package/src/v1/MonetaryUnit.js +26 -0
- package/src/v1/Points.js +31 -0
- package/src/v1/Products.js +30 -0
- package/src/v1/Registration.js +22 -0
- package/src/v1/Reports.js +330 -0
- package/src/v1/Reservations.js +57 -0
- package/src/v1/Service.js +43 -0
- package/src/v1/Stats.js +40 -0
- package/src/v1/Stock.js +36 -0
- package/src/v1/UserGroups.js +44 -0
- package/src/v2/HostGroups.js +32 -0
- package/src/v2/Hosts.js +32 -0
- package/src/v2/Invoices.js +17 -0
- package/src/v2/MonetaryUnits.js +32 -0
- package/src/v2/Operators.js +32 -0
- package/src/v2/Orders.js +55 -8
- package/src/v2/PaymentMethods.js +32 -0
- package/src/v2/ProductGroups.js +50 -2
- package/src/v2/Products.js +195 -12
- package/src/v3/{Applicationcategories.js → ApplicationCategories.js} +1 -1
- package/src/v3/{Applicationdeployments.js → ApplicationDeployments.js} +1 -1
- package/src/v3/{Applicationenterprises.js → ApplicationEnterprises.js} +1 -1
- package/src/v3/{Applicationexecutables.js → ApplicationExecutables.js} +1 -1
- package/src/v3/{Applicationgroups.js → ApplicationGroups.js} +1 -1
- package/src/v3/Applicationlicenses.js +1 -1
- /package/src/v3/{Applicationpersonalfiles.js → ApplicationPersonalFiles.js} +0 -0
- /package/src/v3/{Applicationtasks.js → ApplicationTasks.js} +0 -0
- /package/src/v3/{Assettypes.js → AssetTypes.js} +0 -0
- /package/src/v3/{Billingprofiles.js → BillingProfiles.js} +0 -0
- /package/src/v3/{Paymentmethods.js → PaymentMethods.js} +0 -0
- /package/src/v3/{Productgroups.js → ProductGroups.js} +0 -0
package/README.md
CHANGED
package/package.json
CHANGED
package/src/GizmoClient.js
CHANGED
|
@@ -14,7 +14,6 @@ export class GizmoClient {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
async request(method, url, data = {}, params = {}) {
|
|
17
|
-
// URL формируется только из относительного пути, версия не подставляется
|
|
18
17
|
const finalUrl = url.startsWith('/') ? url : `/${url}`;
|
|
19
18
|
try {
|
|
20
19
|
const res = await this.axios({
|
|
@@ -25,7 +24,6 @@ export class GizmoClient {
|
|
|
25
24
|
});
|
|
26
25
|
return res.data;
|
|
27
26
|
} catch (error) {
|
|
28
|
-
// Пробрасываем ошибку наружу для обработки пользователем
|
|
29
27
|
throw error;
|
|
30
28
|
}
|
|
31
29
|
}
|
package/src/index.js
CHANGED
|
@@ -47,6 +47,8 @@ import { UserGroups as UserGroupsV2 } from './v2/UserGroups.js';
|
|
|
47
47
|
import { Users as UsersV2 } from './v2/Users.js';
|
|
48
48
|
import { Variables as VariablesV2 } from './v2/Variables.js';
|
|
49
49
|
import { Verifications as VerificationsV2 } from './v2/Verifications.js';
|
|
50
|
+
// v3
|
|
51
|
+
// Unusable, waiting for API updates
|
|
50
52
|
|
|
51
53
|
function createV1Categories(client) {
|
|
52
54
|
return {
|
|
@@ -105,14 +107,17 @@ function createV2Categories(client) {
|
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
109
|
|
|
110
|
+
function createV3Categories(client) {
|
|
111
|
+
return {
|
|
112
|
+
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
108
116
|
export class GizmoSDK {
|
|
109
117
|
constructor(config) {
|
|
110
118
|
this.client = new GizmoClient(config);
|
|
111
119
|
this.v1 = createV1Categories(this.client);
|
|
112
120
|
this.v2 = createV2Categories(this.client);
|
|
113
|
-
|
|
114
|
-
this.v3 = {};
|
|
115
|
-
|
|
116
|
-
// Доступ к категориям только через sdk.v1, sdk.v2, sdk.v3
|
|
121
|
+
this.v3 = createV3Categories(this.client);
|
|
117
122
|
}
|
|
118
123
|
}
|
package/src/v1/Apps.js
CHANGED
|
@@ -1,37 +1,89 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for application operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Apps {
|
|
7
|
+
/**
|
|
8
|
+
* Create an Apps instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
7
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Get all applications.
|
|
16
|
+
* @param {Object} params - Query parameters
|
|
17
|
+
* @returns {Promise<any>} List of applications
|
|
18
|
+
*/
|
|
8
19
|
getApps(params = {}) {
|
|
9
20
|
return this.client.request('get', '/apps', {}, params);
|
|
10
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Get application by ID.
|
|
24
|
+
* @param {number|string} appId - Application ID
|
|
25
|
+
* @returns {Promise<any>} Application details
|
|
26
|
+
*/
|
|
11
27
|
getAppById(appId) {
|
|
12
28
|
return this.client.request('get', `/apps/${appId}`);
|
|
13
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Get all application titles.
|
|
32
|
+
* @returns {Promise<any>} List of titles
|
|
33
|
+
*/
|
|
14
34
|
getAppTitles() {
|
|
15
35
|
return this.client.request('get', '/apps/titles');
|
|
16
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Get application image by ID.
|
|
39
|
+
* @param {number|string} appId - Application ID
|
|
40
|
+
* @returns {Promise<any>} Image data
|
|
41
|
+
*/
|
|
17
42
|
getAppImage(appId) {
|
|
18
43
|
return this.client.request('get', `/apps/${appId}/image`);
|
|
19
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Get application rating by ID.
|
|
47
|
+
* @param {number|string} appId - Application ID
|
|
48
|
+
* @returns {Promise<any>} Rating data
|
|
49
|
+
*/
|
|
20
50
|
getAppRating(appId) {
|
|
21
51
|
return this.client.request('get', `/apps/${appId}/rating`);
|
|
22
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Get average rating for application.
|
|
55
|
+
* @param {number|string} appId - Application ID
|
|
56
|
+
* @returns {Promise<any>} Average rating
|
|
57
|
+
*/
|
|
23
58
|
getAppAverageRating(appId) {
|
|
24
59
|
return this.client.request('get', `/apps/${appId}/rating/average`);
|
|
25
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Get rating count for application.
|
|
63
|
+
* @param {number|string} appId - Application ID
|
|
64
|
+
* @returns {Promise<any>} Rating count
|
|
65
|
+
*/
|
|
26
66
|
getAppRatingCount(appId) {
|
|
27
67
|
return this.client.request('get', `/apps/${appId}/rating/count`);
|
|
28
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Get info for all applications.
|
|
71
|
+
* @returns {Promise<any>} Applications info
|
|
72
|
+
*/
|
|
29
73
|
getAppsInfo() {
|
|
30
74
|
return this.client.request('get', '/apps/infos');
|
|
31
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Get top rated applications info.
|
|
78
|
+
* @returns {Promise<any>} Top rated applications
|
|
79
|
+
*/
|
|
32
80
|
getAppsInfoTopRating() {
|
|
33
81
|
return this.client.request('get', '/apps/infos/top/rating');
|
|
34
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Get top used applications info.
|
|
85
|
+
* @returns {Promise<any>} Top used applications
|
|
86
|
+
*/
|
|
35
87
|
getAppsInfoTopUse() {
|
|
36
88
|
return this.client.request('get', '/apps/infos/top/use');
|
|
37
89
|
}
|
package/src/v1/Attributes.js
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for attribute operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Attributes {
|
|
7
|
+
/**
|
|
8
|
+
* Create an Attributes instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all attributes.
|
|
16
|
+
* @returns {Promise<any>} List of attributes
|
|
17
|
+
*/
|
|
7
18
|
getAttributes() {
|
|
8
19
|
return this.client.request('get', '/attributes');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Add a new attribute.
|
|
23
|
+
* @param {Object} data - Attribute data
|
|
24
|
+
* @returns {Promise<any>} Added attribute
|
|
25
|
+
*/
|
|
10
26
|
addAttribute(data) {
|
|
11
27
|
return this.client.request('put', '/attributes', data);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Update an attribute.
|
|
31
|
+
* @param {Object} data - Attribute data
|
|
32
|
+
* @returns {Promise<any>} Updated attribute
|
|
33
|
+
*/
|
|
13
34
|
updateAttribute(data) {
|
|
14
35
|
return this.client.request('post', '/attributes', data);
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Delete an attribute by ID.
|
|
39
|
+
* @param {number|string} attributeId - Attribute ID
|
|
40
|
+
* @returns {Promise<any>} Delete result
|
|
41
|
+
*/
|
|
16
42
|
deleteAttribute(attributeId) {
|
|
17
43
|
return this.client.request('delete', `/attributes/${attributeId}`);
|
|
18
44
|
}
|
package/src/v1/Export.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for export operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Export {
|
|
7
|
+
/**
|
|
8
|
+
* Create an Export instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Export application image.
|
|
16
|
+
* @param {Object} params - Query parameters
|
|
17
|
+
* @returns {Promise<any>} Exported image
|
|
18
|
+
*/
|
|
7
19
|
exportAppImage(params = {}) {
|
|
8
20
|
return this.client.request('get', '/export/app/image', {}, params);
|
|
9
21
|
}
|
package/src/v1/HostComputers.js
CHANGED
|
@@ -1,39 +1,106 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for host computer operations.
|
|
5
|
+
*/
|
|
3
6
|
export class HostComputers {
|
|
7
|
+
/**
|
|
8
|
+
* Create a HostComputers instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all host computers.
|
|
16
|
+
* @returns {Promise<any>} List of host computers
|
|
17
|
+
*/
|
|
7
18
|
getHostComputers() {
|
|
8
19
|
return this.client.request('get', '/hostcomputers');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get host computer by hostname.
|
|
23
|
+
* @param {string} hostname - Hostname
|
|
24
|
+
* @returns {Promise<any>} Host computer details
|
|
25
|
+
*/
|
|
10
26
|
getHostComputerByHostname(hostname) {
|
|
11
27
|
return this.client.request('get', `/hostcomputers/${hostname}`);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get processes for a host.
|
|
31
|
+
* @param {number|string} hostId - Host ID
|
|
32
|
+
* @returns {Promise<any>} List of processes
|
|
33
|
+
*/
|
|
13
34
|
getHostProcesses(hostId) {
|
|
14
35
|
return this.client.request('get', `/hostcomputers/${hostId}/process`);
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a process for a host.
|
|
39
|
+
* @param {number|string} hostId - Host ID
|
|
40
|
+
* @param {Object} data - Process data
|
|
41
|
+
* @returns {Promise<any>} Created process
|
|
42
|
+
*/
|
|
16
43
|
createHostProcess(hostId, data) {
|
|
17
44
|
return this.client.request('put', `/hostcomputers/${hostId}/process`, data);
|
|
18
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Terminate all processes for a host.
|
|
48
|
+
* @param {number|string} hostId - Host ID
|
|
49
|
+
* @returns {Promise<any>} Termination result
|
|
50
|
+
*/
|
|
19
51
|
terminateHostProcess(hostId) {
|
|
20
52
|
return this.client.request('delete', `/hostcomputers/${hostId}/process`);
|
|
21
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Get process by ID for a host.
|
|
56
|
+
* @param {number|string} hostId - Host ID
|
|
57
|
+
* @param {number|string} processId - Process ID
|
|
58
|
+
* @returns {Promise<any>} Process details
|
|
59
|
+
*/
|
|
22
60
|
getHostProcessById(hostId, processId) {
|
|
23
61
|
return this.client.request('get', `/hostcomputers/${hostId}/process/${processId}`);
|
|
24
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Terminate process by ID for a host.
|
|
65
|
+
* @param {number|string} hostId - Host ID
|
|
66
|
+
* @param {number|string} processId - Process ID
|
|
67
|
+
* @returns {Promise<any>} Termination result
|
|
68
|
+
*/
|
|
25
69
|
terminateHostProcessById(hostId, processId) {
|
|
26
70
|
return this.client.request('delete', `/hostcomputers/${hostId}/process/${processId}`);
|
|
27
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Get process by name for a host.
|
|
74
|
+
* @param {number|string} hostId - Host ID
|
|
75
|
+
* @param {string} processName - Process name
|
|
76
|
+
* @returns {Promise<any>} Process details
|
|
77
|
+
*/
|
|
28
78
|
getHostProcessByName(hostId, processName) {
|
|
29
79
|
return this.client.request('get', `/hostcomputers/${hostId}/process/${processName}`);
|
|
30
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Set host security state.
|
|
83
|
+
* @param {number|string} hostId - Host ID
|
|
84
|
+
* @param {boolean} enabled - Security enabled
|
|
85
|
+
* @returns {Promise<any>} Security state result
|
|
86
|
+
*/
|
|
31
87
|
setHostSecurityState(hostId, enabled) {
|
|
32
88
|
return this.client.request('post', `/hostcomputers/${hostId}/security/${enabled}`);
|
|
33
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Get host maintenance state.
|
|
92
|
+
* @param {number|string} hostId - Host ID
|
|
93
|
+
* @returns {Promise<any>} Maintenance state
|
|
94
|
+
*/
|
|
34
95
|
getHostMaintenanceState(hostId) {
|
|
35
96
|
return this.client.request('get', `/hostcomputers/${hostId}/maintenance`);
|
|
36
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Set host maintenance state.
|
|
100
|
+
* @param {number|string} hostId - Host ID
|
|
101
|
+
* @param {boolean} enabled - Maintenance enabled
|
|
102
|
+
* @returns {Promise<any>} Maintenance state result
|
|
103
|
+
*/
|
|
37
104
|
setHostMaintenanceState(hostId, enabled) {
|
|
38
105
|
return this.client.request('post', `/hostcomputers/${hostId}/maintenance/${enabled}`);
|
|
39
106
|
}
|
package/src/v1/HostGroups.js
CHANGED
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for host group operations.
|
|
5
|
+
*/
|
|
3
6
|
export class HostGroups {
|
|
7
|
+
/**
|
|
8
|
+
* Create a HostGroups instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all host groups.
|
|
16
|
+
* @returns {Promise<any>} List of host groups
|
|
17
|
+
*/
|
|
7
18
|
getHostGroups() {
|
|
8
19
|
return this.client.request('get', '/hostgroups');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get host group by ID.
|
|
23
|
+
* @param {number|string} hostGroupId - Host group ID
|
|
24
|
+
* @returns {Promise<any>} Host group details
|
|
25
|
+
*/
|
|
10
26
|
getHostGroupById(hostGroupId) {
|
|
11
27
|
return this.client.request('get', `/hostgroups/${hostGroupId}`);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Get disallowed user groups for host group.
|
|
31
|
+
* @param {number|string} hostGroupId - Host group ID
|
|
32
|
+
* @returns {Promise<any>} Disallowed user groups
|
|
33
|
+
*/
|
|
13
34
|
getDisallowedUserGroups(hostGroupId) {
|
|
14
35
|
return this.client.request('get', `/hostgroups/${hostGroupId}/disallowedusergroups`);
|
|
15
36
|
}
|
package/src/v1/Hosts.js
CHANGED
|
@@ -1,48 +1,126 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for host operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Hosts {
|
|
7
|
+
/**
|
|
8
|
+
* Create a Hosts instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all hosts.
|
|
16
|
+
* @returns {Promise<any>} List of hosts
|
|
17
|
+
*/
|
|
7
18
|
getHosts() {
|
|
8
19
|
return this.client.request('get', '/hosts');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get host by ID.
|
|
23
|
+
* @param {number|string} hostId - Host ID
|
|
24
|
+
* @returns {Promise<any>} Host details
|
|
25
|
+
*/
|
|
10
26
|
getHostById(hostId) {
|
|
11
27
|
return this.client.request('get', `/hosts/${hostId}`);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Delete host by ID.
|
|
31
|
+
* @param {number|string} hostId - Host ID
|
|
32
|
+
* @returns {Promise<any>} Delete result
|
|
33
|
+
*/
|
|
13
34
|
deleteHost(hostId) {
|
|
14
35
|
return this.client.request('delete', `/hosts/${hostId}`);
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Get hosts by number.
|
|
39
|
+
* @param {number|string} hostNumber - Host number
|
|
40
|
+
* @returns {Promise<any>} Hosts list
|
|
41
|
+
*/
|
|
16
42
|
getHostsByNumber(hostNumber) {
|
|
17
43
|
return this.client.request('get', `/hosts/number/${hostNumber}`);
|
|
18
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Add a new host.
|
|
47
|
+
* @param {Object} data - Host data
|
|
48
|
+
* @returns {Promise<any>} Added host
|
|
49
|
+
*/
|
|
19
50
|
addHost(data) {
|
|
20
51
|
return this.client.request('put', '/hosts/host', data);
|
|
21
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Update a host.
|
|
55
|
+
* @param {Object} data - Host data
|
|
56
|
+
* @returns {Promise<any>} Updated host
|
|
57
|
+
*/
|
|
22
58
|
updateHost(data) {
|
|
23
59
|
return this.client.request('post', '/hosts/host', data);
|
|
24
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Add a host computer.
|
|
63
|
+
* @param {Object} data - Host computer data
|
|
64
|
+
* @returns {Promise<any>} Added host computer
|
|
65
|
+
*/
|
|
25
66
|
addHostComputer(data) {
|
|
26
67
|
return this.client.request('put', '/hosts/hostcomputer', data);
|
|
27
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Update a host computer.
|
|
71
|
+
* @param {Object} data - Host computer data
|
|
72
|
+
* @returns {Promise<any>} Updated host computer
|
|
73
|
+
*/
|
|
28
74
|
updateHostComputer(data) {
|
|
29
75
|
return this.client.request('post', '/hosts/hostcomputer', data);
|
|
30
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Add a host endpoint.
|
|
79
|
+
* @param {Object} data - Host endpoint data
|
|
80
|
+
* @returns {Promise<any>} Added host endpoint
|
|
81
|
+
*/
|
|
31
82
|
addHostEndpoint(data) {
|
|
32
83
|
return this.client.request('put', '/hosts/hostendpoint', data);
|
|
33
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Update a host endpoint.
|
|
87
|
+
* @param {Object} data - Host endpoint data
|
|
88
|
+
* @returns {Promise<any>} Updated host endpoint
|
|
89
|
+
*/
|
|
34
90
|
updateHostEndpoint(data) {
|
|
35
91
|
return this.client.request('post', '/hosts/hostendpoint', data);
|
|
36
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Get last user login for host.
|
|
95
|
+
* @param {number|string} hostId - Host ID
|
|
96
|
+
* @returns {Promise<any>} Last user login
|
|
97
|
+
*/
|
|
37
98
|
getLastUserLogin(hostId) {
|
|
38
99
|
return this.client.request('get', `/hosts/${hostId}/lastuserlogin`);
|
|
39
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Get last user logout for host.
|
|
103
|
+
* @param {number|string} hostId - Host ID
|
|
104
|
+
* @returns {Promise<any>} Last user logout
|
|
105
|
+
*/
|
|
40
106
|
getLastUserLogout(hostId) {
|
|
41
107
|
return this.client.request('get', `/hosts/${hostId}/lastuserlogout`);
|
|
42
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Set host lock state.
|
|
111
|
+
* @param {number|string} hostId - Host ID
|
|
112
|
+
* @param {boolean} locked - Lock state
|
|
113
|
+
* @returns {Promise<any>} Lock state result
|
|
114
|
+
*/
|
|
43
115
|
setHostLockState(hostId, locked) {
|
|
44
116
|
return this.client.request('post', `/hosts/${hostId}/lock/${locked}`);
|
|
45
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Set host order state.
|
|
120
|
+
* @param {number|string} hostId - Host ID
|
|
121
|
+
* @param {boolean} inOrder - Order state
|
|
122
|
+
* @returns {Promise<any>} Order state result
|
|
123
|
+
*/
|
|
46
124
|
setHostOrderState(hostId, inOrder) {
|
|
47
125
|
return this.client.request('post', `/hosts/${hostId}/orderstate/${inOrder}`);
|
|
48
126
|
}
|
package/src/v1/Invoices.js
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for invoice operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Invoices {
|
|
7
|
+
/**
|
|
8
|
+
* Create an Invoices instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all invoices.
|
|
16
|
+
* @returns {Promise<any>} List of invoices
|
|
17
|
+
*/
|
|
7
18
|
getInvoices() {
|
|
8
19
|
return this.client.request('get', '/invoices');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Get invoice by ID.
|
|
23
|
+
* @param {number|string} invoiceId - Invoice ID
|
|
24
|
+
* @returns {Promise<any>} Invoice details
|
|
25
|
+
*/
|
|
10
26
|
getInvoiceById(invoiceId) {
|
|
11
27
|
return this.client.request('get', `/invoices/${invoiceId}`);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Void invoice by ID.
|
|
31
|
+
* @param {number|string} invoiceId - Invoice ID
|
|
32
|
+
* @returns {Promise<any>} Void result
|
|
33
|
+
*/
|
|
13
34
|
voidInvoice(invoiceId) {
|
|
14
35
|
return this.client.request('delete', `/invoices/void/${invoiceId}`);
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Void invoice with refund method.
|
|
39
|
+
* @param {number|string} invoiceId - Invoice ID
|
|
40
|
+
* @param {string} refundMethod - Refund method
|
|
41
|
+
* @returns {Promise<any>} Void result
|
|
42
|
+
*/
|
|
16
43
|
voidInvoiceWithRefund(invoiceId, refundMethod) {
|
|
17
44
|
return this.client.request('delete', `/invoices/void/${invoiceId}/${refundMethod}`);
|
|
18
45
|
}
|
package/src/v1/Licenses.js
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for license operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Licenses {
|
|
7
|
+
/**
|
|
8
|
+
* Create a Licenses instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get reserved keys info.
|
|
16
|
+
* @returns {Promise<any>} Reserved keys info
|
|
17
|
+
*/
|
|
7
18
|
getReservedKeysInfo() {
|
|
8
19
|
return this.client.request('get', '/licenses/keys/reserved/info');
|
|
9
20
|
}
|
package/src/v1/MonetaryUnit.js
CHANGED
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for monetary unit operations.
|
|
5
|
+
*/
|
|
3
6
|
export class MonetaryUnit {
|
|
7
|
+
/**
|
|
8
|
+
* Create a MonetaryUnit instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all monetary units.
|
|
16
|
+
* @returns {Promise<any>} List of monetary units
|
|
17
|
+
*/
|
|
7
18
|
getMonetaryUnits() {
|
|
8
19
|
return this.client.request('get', '/monetaryunit');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Add a new monetary unit.
|
|
23
|
+
* @param {Object} data - Monetary unit data
|
|
24
|
+
* @returns {Promise<any>} Added monetary unit
|
|
25
|
+
*/
|
|
10
26
|
addMonetaryUnit(data) {
|
|
11
27
|
return this.client.request('put', '/monetaryunit', data);
|
|
12
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Update a monetary unit.
|
|
31
|
+
* @param {Object} data - Monetary unit data
|
|
32
|
+
* @returns {Promise<any>} Updated monetary unit
|
|
33
|
+
*/
|
|
13
34
|
updateMonetaryUnit(data) {
|
|
14
35
|
return this.client.request('post', '/monetaryunit', data);
|
|
15
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Delete a monetary unit by ID.
|
|
39
|
+
* @param {number|string} monetaryUnitId - Monetary unit ID
|
|
40
|
+
* @returns {Promise<any>} Delete result
|
|
41
|
+
*/
|
|
16
42
|
deleteMonetaryUnit(monetaryUnitId) {
|
|
17
43
|
return this.client.request('delete', `/monetaryunit/${monetaryUnitId}`);
|
|
18
44
|
}
|
package/src/v1/Points.js
CHANGED
|
@@ -1,21 +1,52 @@
|
|
|
1
1
|
import { GizmoClient } from '../GizmoClient.js';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Class for points operations.
|
|
5
|
+
*/
|
|
3
6
|
export class Points {
|
|
7
|
+
/**
|
|
8
|
+
* Create a Points instance.
|
|
9
|
+
* @param {GizmoClient} client - The GizmoClient instance.
|
|
10
|
+
*/
|
|
4
11
|
constructor(client) {
|
|
5
12
|
this.client = client;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Get all points transactions.
|
|
16
|
+
* @returns {Promise<any>} List of points transactions
|
|
17
|
+
*/
|
|
7
18
|
getPointsTransactions() {
|
|
8
19
|
return this.client.request('get', '/points');
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Reset all points.
|
|
23
|
+
* @returns {Promise<any>} Reset result
|
|
24
|
+
*/
|
|
10
25
|
resetAllPoints() {
|
|
11
26
|
return this.client.request('post', '/points/reset');
|
|
12
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Reset points for a user.
|
|
30
|
+
* @param {number|string} userId - User ID
|
|
31
|
+
* @returns {Promise<any>} Reset result
|
|
32
|
+
*/
|
|
13
33
|
resetUserPoints(userId) {
|
|
14
34
|
return this.client.request('post', `/points/${userId}/reset`);
|
|
15
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Set points for all users.
|
|
38
|
+
* @param {number} amount - Points amount
|
|
39
|
+
* @returns {Promise<any>} Set result
|
|
40
|
+
*/
|
|
16
41
|
setAllUsersPoints(amount) {
|
|
17
42
|
return this.client.request('post', `/points/${amount}`);
|
|
18
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* Set points for a user.
|
|
46
|
+
* @param {number|string} userId - User ID
|
|
47
|
+
* @param {number} amount - Points amount
|
|
48
|
+
* @returns {Promise<any>} Set result
|
|
49
|
+
*/
|
|
19
50
|
setUserPoints(userId, amount) {
|
|
20
51
|
return this.client.request('post', `/points/${userId}/${amount}`);
|
|
21
52
|
}
|