1.0.0 • Published 2 years ago

testhub v1.0.0

Weekly downloads
-
License
testhub
Repository
-
Last release
2 years ago

testhub-sdk-javascript

Javascript client side SDK repo for testhub

openapi-generator-cli creates it own README.md which is not useful in our case, hence edit ORIGINAL_README.md, and the openapi.sh will copy it to README.md

Auto-generating code

  1. Install openapi-generator-cli if not installed using command
brew install openapi-generator-cli
  1. Copy the openapi spec to the root directory of this project
  2. Run below command to generate new code if your OAS is changed
bash codegen.sh

Usage

Local testing

TESTHUB_SDK_JAVASCRIPT_PATH=$(pwd)
npm install
npm run build
npm link
cd ../node_sample
npm link $TESTHUB_SDK_JAVASCRIPT_PATH
npm run build
cd $TESTHUB_SDK_JAVASCRIPT_PATH

Publishing

Getting started

Install the testhub package.

Sample code to test out testhub:

const { TestHubApi } = require("testhub");

config = {
  basePath: "https://testhub.bsstag.com/v1",
  source: "NA",
  username: "TH_CLIENT_ID",
  password: "TH_CLIENT_SECRET",
};

thApi = new TestHubApi(config);

projectApi = thApi.projectApi;
opts = {
  thGroupId: 64718,
  thUserId: 169,
  thTransactionId: "sample_transaction_id",
  thProduct: "TCM",
};

sampleProject = {
  name: "sample project created via API",
  source: "TCM"
};

projectApi
  .createMinified(sampleProject, opts)
  .then((p) => {
    console.log(p);
    // do other things
  })
  .catch((err) => console.log(err));
1.0.0

2 years ago