Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit b44006a

Browse files
committed
add typedefs to docs
1 parent 73acd3f commit b44006a

File tree

1 file changed

+67
-33
lines changed

1 file changed

+67
-33
lines changed

README.md

Lines changed: 67 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const pastebin = new PastebinClient(process.env.API_KEY)
1818
```
1919

2020
# Classes
21+
The module exports the following classes, you can use them like so:
22+
```js
23+
const { PastebinClient, PastebinError, Paste, User, ClientUser, PasteStore, UserStore, UserPasteStore } = require("pastebin.js")
24+
```
2125

2226
## PastebinClient
2327
The client used to interact with the Pastebin API.
@@ -93,21 +97,21 @@ new Paste(client, data)
9397
```
9498

9599
#### Parameters
96-
| name | description | type | default |
97-
|-----------------|------------------------------------------|----------------|---------|
98-
| client | The client used to get this paste | PastebinClient | |
99-
| data | | Object | |
100-
| data.key | The key of the paste | string | |
101-
| data.title | The title of the paste | string | `null` |
102-
| data.author | The author of the paste | User | `null` |
103-
| data.content | The content of the paste | string | `null` |
104-
| data.size | The length of the content of the paste | number | `null` |
105-
| data.date | The date the paste was posted | Date | `null` |
106-
| data.format | The format of the paste | string | `null` |
107-
| data.privacy | The privacy setting of the paste | number | `null` |
108-
| data.expiry | The expiry time of the paste | string | `null` |
109-
| data.expiryDate | The expiry date of the paste | Date | `null` |
110-
| data.hits | The number of times anyone saw the paste | number | `null` |
100+
| name | description | type | default |
101+
|-----------------|------------------------------------------|---------------------|---------|
102+
| client | The client used to get this paste | PastebinClient | |
103+
| data | | Object | |
104+
| data.key | The key of the paste | string | |
105+
| data.title | The title of the paste | string | `null` |
106+
| data.author | The author of the paste | User | `null` |
107+
| data.content | The content of the paste | string | `null` |
108+
| data.size | The length of the content of the paste | number | `null` |
109+
| data.date | The date the paste was posted | Date | `null` |
110+
| data.format | The format of the paste | [Format](#format) | `null` |
111+
| data.privacy | The privacy setting of the paste | [Privacy](#privacy) | `null` |
112+
| data.expiry | The expiry time of the paste | [Expiry](#expiry) | `null` |
113+
| data.expiryDate | The expiry date of the paste | Date | `null` |
114+
| data.hits | The number of times anyone saw the paste | number | `null` |
111115

112116
### client
113117
The client used to get this paste.
@@ -210,17 +214,17 @@ new ClientUser(client, data)
210214
#### Parameters
211215
| name | description | type | default |
212216
|-----------------|------------------------------------------|----------------|---------|
213-
| client | The client used to get this paste | PastebinClient | |
214-
| data | | Object | |
215-
| data.username | The user's username | string | |
216-
| data.format | The user's format setting | string | `null` |
217-
| data.expiry | The user's expiry setting | string | `null` |
218-
| data.avatarURL | The user's avatar URL | string | `null` |
219-
| data.privacy | The user's privacy setting | number | `null` |
220-
| data.website | The user's website | string | `null` |
221-
| data.email | The user's e-mail | string | `null` |
222-
| data.location | The user's location | string | `null` |
223-
| data.pro | Whether the user is a PRO account | boolean | `null` |
217+
| client | The client used to get this paste | PastebinClient | |
218+
| data | | Object | |
219+
| data.username | The user's username | string | |
220+
| data.format | The user's format setting | [Format](#format) | `null` |
221+
| data.expiry | The user's expiry setting | [Expiry](#expiry) | `null` |
222+
| data.avatarURL | The user's avatar URL | string | `null` |
223+
| data.privacy | The user's privacy setting | [Privacy](#privacy) | `null` |
224+
| data.website | The user's website | string | `null` |
225+
| data.email | The user's e-mail | string | `null` |
226+
| data.location | The user's location | string | `null` |
227+
| data.pro | Whether the user is a PRO account | boolean | `null` |
224228

225229
### username
226230
This user's username.
@@ -300,9 +304,9 @@ Create a paste, and store it in the cache.
300304
| content | The paste's content | any | |
301305
| options | | Array<Array<string, Paste>> | `null` |
302306
| options.title | The paste's title | string | `{}` |
303-
| options.format | The paste's format | string | `null` |
304-
| options.privacy | The paste's privacy setting | number | `null` |
305-
| options.expiry | The paste's expiry time | string | `null` |
307+
| options.format | The paste's format | [Format](#format) | `null` |
308+
| options.privacy | The paste's privacy setting | [Privacy](#privacy) | `null` |
309+
| options.expiry | The paste's expiry time | [Expiry](#expiry) | `null` |
306310

307311
#### Returns
308312
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[Paste](#paste)>**
@@ -329,9 +333,9 @@ The client this store belongs to.
329333
Fetch a user by their username, and store them in the cache.
330334

331335
#### Parameters
332-
| name | description | type | default |
333-
|----------|---------------------|----------------|---------|
334-
| username | The user's username | PastebinClient | |
336+
| name | description | type | default |
337+
|----------|---------------------|--------|---------|
338+
| username | The user's username | string | |
335339

336340
#### Returns
337341
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[User](#user)>**
@@ -368,4 +372,34 @@ Fetch this user's pastes, and store them in the cache.
368372
| max | The maximum number of pastes to fetch | number | `50` |
369373

370374
#### Returns
371-
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[UserPasteStore](#userpastestore)>**
375+
**[Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[UserPasteStore](#userpastestore)>**
376+
377+
# Typedefs
378+
379+
## Format
380+
381+
A "format," which will be used for syntax highlighting. You can see the full list of formats [here](https://pastebin.com/api#5).
382+
383+
**Type:** `string`
384+
385+
## Privacy
386+
387+
A privacy setting. Can be one of the following:
388+
* `0` (or `"public"`)
389+
* `1` (or `"unlisted"`)
390+
* `2` (or `"private"`)
391+
392+
**Type:** `string` or `number`
393+
394+
## Expiry
395+
396+
An expiry setting. Can be one of the following:
397+
* `"NEVER"` (or `"N"`)
398+
* `"10 MINUTES"` (or `"10M"`)
399+
* `"1 HOUR"` (or `"1H"`)
400+
* `"1 DAY"` (or `"1D"`)
401+
* `"1 WEEK"` (or `"1W"`)
402+
* `"2 WEEKS"` (or `"2W"`)
403+
* `"1 MONTH"` (or `"1M"`)
404+
* `"6 MONTHS"` (or `"6M"`)
405+
* `"1 YEAR"` (or `"1Y"`)

0 commit comments

Comments
 (0)