-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: use classes to expose api funcs
- allows for jsdoc comments to show in ide, arrow functions were stripping these
- Loading branch information
1 parent
c273848
commit 6bbfceb
Showing
4 changed files
with
25 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { Kient } from '../kient' | ||
|
||
export class APIBase { | ||
readonly kient: Kient | ||
|
||
constructor(kient: Kient) { | ||
this.kient = kient | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { APIBase } from '../api-base' | ||
import { getChannel } from './get-channel' | ||
|
||
export class ChannelsAPI extends APIBase { | ||
/** | ||
* Returns channel and user information of the specified channel | ||
* | ||
* @param {string} slugOrId Accepts either a channel slug, i.e `xqc` or, an id such as `channel_ULID` | ||
*/ | ||
get(slugOrId: string) { | ||
return getChannel(this.kient, slugOrId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters