Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vex-tm-client

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vex-tm-client

Programmatic Control of VEX Tournament Manager

  • 1.4.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

Tournament Manager API

This package is a client library for the Tournament Manager API

  • Automatically manages authorization process, and ensures a valid bearer token is present for every request

  • Supports the full API surface

  • Strongly typed

  • Does not throw exceptions, which is very useful for preventing crashes in applications.

  • Easy to use

Developing An Integration

Developers need to obtain credentials from DWAB to create integrations.

Example Usage

See examples/basic.ts for an example of basic functionality.

import { Client, FieldsetQueueSkillsType, MatchRound } from "vex-tm-client";
import authorization from "./credentials.json";

const client = new Client({
  address: "http://localhost",
  authorization: {
    client_id: authorization.client_id,
    client_secret: authorization.client_secret,
    grant_type: "client_credentials",
    expiration_date: authorization.expiration_date,
  },
});

const result = await client.connect();
if (!result.success) {
  console.error("Could not connect to TM instance", result);
  return;
}

const divisions = await client.getDivisions();
if (!divisions.success) {
  console.error("divisions", divisions);
  return;
}

console.log(divisions);

const division = divisions.data[0];

const teams = await division.getTeams();
if (!teams.success) {
  console.error("teams", teams);
  return;
}

console.log(teams);

const matches = await division.getMatches();
if (!matches.success) {
  console.error("matches", matches);
  return;
}

for (const match of matches.data) {
  console.log(match);
}

const rankings = await division.getRankings(MatchRound.Qualification);
if (!rankings.success) {
  console.error("rankings", rankings);
  return;
}

console.log(rankings);

const fieldsets = await client.getFieldsets();
if (!fieldsets.success) {
  console.error("fieldsets", fieldsets);
  return;
}

console.log(fieldsets);

const fieldset = fieldsets.data[0];
const fields = await fieldset.getFields();
if (!fields.success) {
  console.error("fields", fields);
  return;
}

console.log(fields.data);

const connection = await fieldset.connect();
if (!connection.success) {
  console.error("connection", connection);
  return;
}

fieldset.addEventListener("matchStarted", (event) => console.log(event.detail));
fieldset.addEventListener("matchStopped", (event) => console.log(event.detail));
fieldset.addEventListener("fieldActivated", (event) =>
  console.log(event.detail)
);
fieldset.addEventListener("fieldMatchAssigned", (event) =>
  console.log(event.detail)
);
fieldset.addEventListener("audienceDisplayChanged", (event) =>
  console.log(event.detail)
);

await fieldset.queueSkills(FieldsetQueueSkillsType.Driver);
await fieldset.startMatch(1);

fieldset.on("matchStopped", async (event) => {
  await fieldset.setAudienceDisplay(FieldsetAudienceDisplay.SkillsRankings);
});

process.on("exit", () => {
  fieldset.disconnect();
});

Use In the Browser

This library is primarily designed for use in Node.js, however, it is possible to run in the browser if you polyfill the following Node libraries using their bundler of choice:

events
crypto

Polyfill Tools:

Disclaimer

This library is not developed or supported by DWAB, the REC Foundation, or VEX Robotics. Developers are responsible for adhering to the Tournament Manager API Usage Agreement when developing integrations using this library.

FAQs

Package last updated on 13 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc