Skip to content

Commit 01e837e

Browse files
Merge pull request #5 from NotReallyEight/0-0-2-draft
Change version to 0.0.2
2 parents 1267bad + 802f8f7 commit 01e837e

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,90 @@
11
# TechHost API Wrapper
2+
3+
An open source API wrapper for [TechHost API](https://api.techhost.live).
4+
5+
## Badges
6+
7+
Add badges from somewhere like: [shields.io](https://shields.io/)
8+
9+
[![Discord](https://img.shields.io/discord/746291190009430049?color=%235865f2&label=ATN%20Development&logo=discord)](https://discord.gg/qnqdUxF) [![GitHub repo size](https://img.shields.io/github/repo-size/NotReallyEight/techhost-api-wrapper?color=%23171515&label=Repository%20Size&logo=github)](https://github.com/NotReallyEight/techhost-api-wrapper) [![GitHub](https://img.shields.io/github/license/NotReallyEight/techhost-api-wrapper?label=License)](https://apache.org/licenses/LICENSE-2.0) [![GitHub Repo stars](https://img.shields.io/github/stars/NotReallyEight/techhost-api-wrapper?color=%23171515&label=Repository%20Stars&logo=github)](https://github.com/NotReallyEight/techhost-api-wrapper) [![npm (tag)](https://img.shields.io/npm/v/techhost-api-wrapper/latest?color=%23cc3534&logo=npm)](https://npmjs.com/package/techhost-api-wrapper)
10+
11+
## Installation
12+
13+
Install techhost-api-wrapper with [npm](https://npmjs.com/package/techhost-api-wrapper).
14+
15+
```bash
16+
npm install techhost-api-wrapper
17+
```
18+
19+
## Usage/Examples
20+
21+
#### JavaScript
22+
23+
```javascript
24+
const TechHost = require("techhost-api-wrapper");
25+
const client = new TechHost();
26+
27+
client.cat().then(console.log);
28+
```
29+
30+
#### TypeScript
31+
32+
```typescript
33+
import TechHost from "techhost-api-wrapper";
34+
const client = new TechHost();
35+
36+
void client.cat().then(console.log);
37+
```
38+
39+
40+
## Documentation
41+
42+
[Documentation](https://github.com/NotReallyEight/techhost-api-wrapper)
43+
44+
45+
## FAQ
46+
47+
#### Does the package support TypeScript?
48+
49+
Yes! It is written in TypeScript, so it also has typings support!
50+
51+
#### What is the minimum version of Node.JS I need to run the package?
52+
53+
Node.JS v16 is required in order for the package to run smoothly.
54+
55+
## Features
56+
57+
- Cat endpoint
58+
- Dog endpoint
59+
- Fact endpoint
60+
- Meme endpoint
61+
- HTTP Code endpoint
62+
- Reddit endpoint
63+
- Screenshot endpoint
64+
65+
## License
66+
67+
This project is licensed through the [Apache-2.0](https://.apache.org/licenses/LICENSE-2.0) license.
68+
69+
70+
## Feedback
71+
72+
If you have any feedback, please reach out to us at [our Discord Server](https://discord.gg/qnqdUxF).
73+
74+
## Contributing
75+
76+
Contributions are always welcome! Open up a Pull Request or an Issue.
77+
78+
Please adhere to this project's `code of conduct`.
79+
80+
81+
## Authors
82+
83+
- [@NotReallyEight](https://.github.com/NotReallyEight)
84+
85+
86+
## Acknowledgements
87+
88+
- [TechHost](https://techhost.live)
89+
- [TechHost API](https://api.techhost.live)
90+
- [ATN Development](https://discord.gg/qnqdUxF)

src/Client.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ export class Client {
8787
}
8888

8989
/**
90-
* Get a url from a screenshot
90+
* Get a screenshot from a url
9191
* @param url - The url
9292
* @returns - The Screenshot class
9393
*/
9494
async screenshot(url: string): Promise<Screenshot | null> {
95+
if (!/https:\/\//g.test(url))
96+
url = `https://${/http:\/\//g.test(url) ? `${url.slice(7)}` : url}`;
9597
const screenshot: EndpointResponse | null = await this.rest.get(
96-
`/screenshot?url=${url}`
98+
`/screenshot?url=${encodeURI(url)}`
9799
);
98100
return screenshot != null ? new Screenshot(screenshot) : null;
99101
}

0 commit comments

Comments
 (0)