0.1.0 • Published 2 months ago

@tf2pickup-org/serveme-tf-client v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Installation

npm i @tf2pickup-org/serveme-tf-client

Usage

Create a new reservation

import { Client, KnownEndpoint } from '@tf2pickup-org/serveme-tf-client';

const client = new Client({ apiKey: process.env.SERVEME_TF_API_KEY, endpoint: KnownEndpoint.europe });

// fetch all servers, configs and whitelists that serveme.tf provides
const { servers, serverConfigs, whitelists } = await client.findOptions();

// select a server
const selectedServer = servers[0];

// create a new reservation
const reservation = await client.create({ serverId: selectedServer.id });
console.log(`connect string: connect ${reservation.server.ip_and_port}; password ${reservation.password}`);
console.log(`rcon password: ${reservation.rcon}`);

Fetch and manage an existing reservation

import { Client, KnownEndpoint, ReservationId } from '@tf2pickup-org/serveme-tf-client';

const client = new Client({ apiKey: process.env.SERVEME_TF_API_KEY, endpoint: KnownEndpoint.europe });

const reservation = await client.fetch(1383514 as ReservationId);
console.log(`connect string: connect ${reservation.server.ip_and_port}; password ${reservation.password}`);
console.log(`rcon password: ${reservation.rcon}`);

// end the reservation
await reservation.end();
0.1.0

2 months ago

0.0.4

2 months ago

0.0.3

5 months ago

0.0.2

5 months ago