Skip to content

Commit b18069c

Browse files
fetch sessions
1 parent 4a89134 commit b18069c

File tree

2 files changed

+36
-40
lines changed

2 files changed

+36
-40
lines changed

index.js

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
var lambdaSessionClient = require("./lib/fetch_sessions_client");
2-
module.exports = {
3-
FetchSessionClient: lambdaSessionClient.FetchSession,
4-
};
1+
const ltClient = require("@lambdatest/node-rest-client");
2+
module.exports.fetchSession = async (options) => {
3+
// read credentials from env
4+
5+
if (!process.env.LT_ACCESS_KEY || !process.env.LT_USERNAME){
6+
console.log("Access and username is required")
7+
throw new Error("User name and Access is required parameter")
8+
}
9+
10+
// read build name from env
11+
if (!process.env.LT_BUILD){
12+
console.log(" Please set Build name to env")
13+
throw new Error ("Build name is required")
14+
}
15+
16+
const autoClient = ltClient.AutomationClient({
17+
username: process.env.LT_USERNAME,
18+
accessKey: process.env.LT_ACCESS_KEY,
19+
});
20+
21+
if (!options){
22+
// using default options
23+
console.log("Setting default configurations")
24+
options = {
25+
buildLimt: 20,
26+
buildName: process.env.LT_BUILD,
27+
sessionParams: {
28+
limit: 10000,
29+
},
30+
}
31+
}
32+
const data = await autoClient.getSessionsOfBuild(options);
33+
console.log(JSON.stringify(data));
34+
return
35+
36+
}

lib/fetch_sessions_client.js

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)