Skip to content

Commit 4ed0c9f

Browse files
Merge branch 'main' into main
2 parents 98e0afa + dfdda99 commit 4ed0c9f

File tree

7 files changed

+1329
-0
lines changed

7 files changed

+1329
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
name: Publish Node Fetch Session Package
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
build:
10+
if: startsWith(github.ref, 'refs/tags/prod-')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 14
17+
- run: npm install
18+
19+
publish-npm:
20+
needs: build
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: actions/setup-node@v2
25+
with:
26+
node-version: 14
27+
registry-url: https://registry.npmjs.org/
28+
- run: npm install
29+
- run: npm publish --access public
30+
env:
31+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Dependency directories
2+
./node_modules

.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/node_modules/
2+
*.DS_Store
3+
*.log
4+
/.vscode/
5+
/.github/

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
![LambdaTest Logo](https://www.lambdatest.com/resources/images/logos/logo.svg)
23

34
# Node fetch sessions

index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
}

0 commit comments

Comments
 (0)