Skip to content
This repository has been archived by the owner on Dec 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #158 from kaimallea/next-dev
Browse files Browse the repository at this point in the history
Release next.3
  • Loading branch information
kaimallea committed Apr 3, 2021
2 parents 33e522b + cc6c77e commit f794588
Show file tree
Hide file tree
Showing 48 changed files with 879 additions and 1,332 deletions.
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
module.exports = {
root: true,
env: {
es2021: true,
node: true,
jest: true,
},
extends: ['eslint:recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
parserOptions: {
ecmaVersion: 12,
sourceType: 'module',
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,43 @@ Favorite an image:
```ts
client.favoriteImage('someImageHash');
```

### Get gallery images

```ts
client.getGallery({
section: 'hot',
sort: 'viral',
mature: false,
});
```

`getGallery()` accepts an object of type `GalleryOptions`. The follow options are available:

| Key | Required | Description |
| ---------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `section` | required | `hot` \| `top` \| `user` |
| `sort` | optional | `viral` \| `top` \| `time` \| `rising` (only available with user section). Defaults to viral |
| `page` | optional | `number` - the data paging number |
| `window` | optional | Change the date range of the request if the section is `top`. Accepted values are `day` \| `week` \| `month` \| `year` \| `all`. Defaults to `day` |
| `showViral` | optional | `true` \| `false` - Show or hide viral images from the `user` section. Defaults to `true` |
| `mature` | optional | `true` \| `false` - Show or hide mature (nsfw) images in the response section. Defaults to `false`. NOTE: This parameter is only required if un-authed. The response for authed users will respect their account setting |
| `album_previews` | optional | `true` \| `false` - Include image metadata for gallery posts which are albums |

### Get subreddit gallery images

```ts
client.getSubredditGallery({
subreddit: 'wallstreetbets',
sort: 'time',
});
```

`getSubredditGallery()` accepts an object of type `SubredditGalleryOptions`. The follow options are available:

| Key | Required | Description |
| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `subreddit` | required | A valid subreddit name |
| `sort` | optional | `time` \| `top` - defaults to time |
| `page` | optional | `number` - the data paging number |
| `window` | optional | Change the date range of the request if the section is `top`. Accepted values are `day` \| `week` \| `month` \| `year` \| `all`. Defaults to `week` |
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = {
setupFilesAfterEnv: ['./jest.setup.js'],
setupFilesAfterEnv: ['<rootDir>/src/mocks/jest.setup.ts'],
testPathIgnorePatterns: [
'<rootDir>/build/',
'<rootDir>/node_modules/',
'<rootDir>/src/__tests__/mocks/',
'<rootDir>/src/mocks/',
],
};
Loading

0 comments on commit f794588

Please sign in to comment.