File tree Expand file tree Collapse file tree 2 files changed +36
-40
lines changed Expand file tree Collapse file tree 2 files changed +36
-40
lines changed Original file line number Diff line number Diff line change 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
+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments