Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thedrone7/shieldbow
An all-purpose league of legends API Client.
https://github.com/thedrone7/shieldbow
hacktoberfest league-of-legends nodejs npm typescript
Last synced: about 18 hours ago
JSON representation
An all-purpose league of legends API Client.
- Host: GitHub
- URL: https://github.com/thedrone7/shieldbow
- Owner: TheDrone7
- License: gpl-3.0
- Created: 2022-02-12T01:41:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T14:27:28.000Z (2 months ago)
- Last Synced: 2024-12-18T19:48:05.615Z (7 days ago)
- Topics: hacktoberfest, league-of-legends, nodejs, npm, typescript
- Language: TypeScript
- Homepage: https://shieldbow.thedrone7.dev/
- Size: 33.9 MB
- Stars: 34
- Watchers: 3
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# shieldbow (v2)
An all-purpose, easy-to-use API wrapper for the league of legends API
> The code in the repository is for the unpublished, work in progress version (v3) of shieldbow.
> The published version (v2) is available for use on npm.
---
### Installing
Node.JS 16 or higher is recommended.
Install using
```
npm install shieldbowyarn add shieldbow
pnpm add shieldbow
```See the [documentation](https://thedrone7.github.io/shieldbow/) to learn more!
---
# @shieldbow/web (v1)
An all-purpose, easy-to-use client for the league of legends API.
This is safe to use on the frontend, requires no API key, but is less powerful than the full library.This is part of Shieldbow (v3) - a work in progress.
There are no shieldbow-web specific documentation (yet), but is fairly intuitive and similar to shieldbow (v2) on the surface.
The documentation will be available upon completion of shieldbow (v3).To install shieldbow-web, use (depending on your package manager)
```bash
npm install @shieldbow/web axiosyarn add @shieldbow/web axios
pnpm add @shieldbow/web axios
```### NOTE
In [`@shieldbow/web`](https://npmjs.com/package/@shieldbow/web), the `axios` package is an optional dependency.
This means that you can use any other HTTP client too! However, if you do not provide a HTTP client,
shieldbow will try to default to `axios` (if it is installed).If it is not installed, shieldbow will throw an error.
You can provide your own HTTP client by passing it to the `Client` initialization
Here is an example with the built-in JavaScript fetch API (which is available in the browser)
```ts// Typescript
client.initialize({
// ... other options,
fetchMethod: (url: string) => fetch(url).then(res => {
if (!res.ok) throw new Error(res.statusText);
if (res.headers.get('content-type')?.includes('application/json')) return res.json() as Promise;
else return res.text() as unknown as Promise;
});
})// Javascript
client.initialize({
// ... other options,
fetchMethod: function (url) {
return fetch(url).then(res => {
if (!res.ok) throw new Error(res.statusText);
if (res.headers.get('content-type')?.includes('application/json')) return res.json();
else return res.text();
});
}
})
```---