Generate api with NSwag

This commit is contained in:
2024-07-23 20:29:30 -03:00
parent 485d19b9f2
commit 0d24ecca3f
20 changed files with 1275 additions and 1243 deletions

View File

@ -1,15 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import dotenv from 'dotenv';
import { TribufuApi } from '../build/index.mjs';
dotenv.config();
async function main() {
const api = TribufuApi.fromEnv("TRIBUFU");
const games = await api.getGames();
console.log(games[0]);
}
main();

View File

@ -1,10 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import dotenv from 'dotenv';
import { TribufuBot } from '../build/index.mjs';
dotenv.config();
const bot = TribufuBot.fromEnv("TRIBUFU");
const botId = bot.getBotId();

View File

@ -1,18 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import dotenv from 'dotenv';
import { TribufuClient } from '../build/index.mjs';
dotenv.config();
async function main() {
const client = TribufuClient.fromEnv("TRIBUFU");
if (await client.passwordLogin("", "")) {
const userInfo = await client.getUserInfo();
console.log(userInfo);
}
}
main();

13
examples/openid.js Normal file
View File

@ -0,0 +1,13 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import dotenv from 'dotenv';
import { TribufuClient } from '../build/index.mjs';
async function main() {
const client = new TribufuClient();
const config = await client.openidConfiguration();
console.log(config);
}
main();

View File

@ -1,11 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import dotenv from 'dotenv';
import { TribufuServer } from '../build/index.mjs';
dotenv.config();
const server = TribufuServer.fromEnv("TRIBUFU");
const serverId = server.getServerId();
const clientId = server.getClientId();