Skip to content

Commit d2200c5

Browse files
committed
Add GetKeys and GetProducts method
1 parent 9a53277 commit d2200c5

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
const key = require('./methods/Key.js');
22
const data = require('./methods/Data');
33
const helpers = require('./methods/Helpers.js');
4+
const product = require('./methods/Product.js');
45

56
module.exports = {
67
Key : key,
78
Helpers : helpers,
8-
Data: data
9+
Data: data,
10+
Product: product
911
}

methods/Product.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const got = require('got');
2+
const helpers = require('../internal/HelperMethods.js');
3+
4+
module.exports = class Product {
5+
6+
static GetKeys(token, ProductId, Page = 1,OrderBy="",SearchQuery="", GlobalId = 0, LicenseServerUrl = "https://api.cryptolens.io") {
7+
8+
return new Promise(async (resolve, reject) => {
9+
try {
10+
const formBody = {
11+
token: token,
12+
productId: ProductId,
13+
page:Page,
14+
orderBy: OrderBy,
15+
searchQuery: SearchQuery,
16+
globalId:GlobalId
17+
}
18+
19+
const res = await helpers.CallAPI(`${LicenseServerUrl}/api/product/GetKeys`, formBody)
20+
resolve(res)
21+
} catch (error) {
22+
reject(error);
23+
}
24+
});
25+
}
26+
27+
static GetProducts(token, LicenseServerUrl = "https://api.cryptolens.io") {
28+
29+
return new Promise(async (resolve, reject) => {
30+
try {
31+
const formBody = {
32+
token: token
33+
}
34+
35+
const res = await helpers.CallAPI(`${LicenseServerUrl}/api/product/GetProducts`, formBody)
36+
resolve(res)
37+
} catch (error) {
38+
reject(error);
39+
}
40+
});
41+
}
42+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cryptolens",
3-
"version": "1.0.15.1",
3+
"version": "1.0.16.1",
44
"description": "Client API for NodeJS to access Cryptolens Software Licensing API.",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)