Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/onlyf0ur/spiget-deno
Simple Spiget API wrapper for Deno
https://github.com/onlyf0ur/spiget-deno
deno deno-module denoland spiget spiget-api spigotmc wrapper
Last synced: about 1 month ago
JSON representation
Simple Spiget API wrapper for Deno
- Host: GitHub
- URL: https://github.com/onlyf0ur/spiget-deno
- Owner: OnlyF0uR
- License: mit
- Created: 2020-11-03T13:36:12.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-04T13:24:58.000Z (about 4 years ago)
- Last Synced: 2024-11-17T14:12:35.537Z (about 2 months ago)
- Topics: deno, deno-module, denoland, spiget, spiget-api, spigotmc, wrapper
- Language: TypeScript
- Homepage: https://deno.land/x/spiget_deno
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Spiget-Deno
Simple Spiget API wrapper for Deno### Example
```ts
import { Spiget } from 'https://deno.land/x/[email protected]/mod.ts';const example_user_id = 12345; // Change this
const spiget = new Spiget();
const author = await spiget.getAuthor(example_user_id);if (author == null) {
console.log('Couldn\'t find an author with that id.');
} else {
console.log(`Username: ${author.username}`);
// etc.const resources = await author.getResources();
if (!resources.length) {
console.log('This user doesn\'t have any resources.');
} else {
const resource = resources[0];console.log(`Resource Name: ${resource.name}`);
console.log(`Tag: ${resource.tag}`);
console.log(`Likes: ${resource.likes}`);
console.log(`Downloads: ${resource.downloads}`);
// etc.const reviews = await resource.getReviews();
if (!reviews.length) {
console.log('This resource doesn\'t have any reviews.');
} else {
const review = reviews[0];console.log(`Rating: ${resource.downloads}/5`);
console.log(`Date: ${review.date.toLocaleString()}`);
// etc.
}
}
}
```