File tree 5 files changed +40
-0
lines changed
5 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { env } from 'bun'
2
+ import { Kient } from 'kient'
3
+
4
+ const kient = new Kient ( )
5
+ kient . setAuthToken ( env . KICK_TOKEN as string )
6
+
7
+ const publicKey = await kient . api . misc . getPublicKey ( )
8
+ console . log ( publicKey )
Original file line number Diff line number Diff line change
1
+ import type { Kient } from 'kient'
2
+ import type { APIResponse } from '../../util/api-response'
3
+ import type { PublicKey } from '../../structures/public-key'
4
+
5
+ export async function getPublicKey ( kient : Kient ) {
6
+ const response = await kient . _apiClient . fetch < APIResponse < PublicKey > > ( '/public-key' )
7
+
8
+ return response . data . public_key
9
+ }
Original file line number Diff line number Diff line change
1
+ import { APIBase } from '../api-base'
2
+ import { getPublicKey } from './get-public-key'
3
+
4
+ /**
5
+ * Description placeholder
6
+ *
7
+ * @group APIs
8
+ */
9
+ export class MiscAPI extends APIBase {
10
+ /**
11
+ * Returns an array of users by an array of IDs
12
+ *
13
+ * @param ids Accepts an array of user IDs that will be queried for
14
+ */
15
+ getPublicKey ( ) {
16
+ return getPublicKey ( this . kient )
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { CategoryAPI } from './api/category'
7
7
import { UserAPI } from './api/user'
8
8
import { ChannelAPI } from './api/channel'
9
9
import { ChatAPI } from './api/chat'
10
+ import { MiscAPI } from './api/misc'
10
11
11
12
type DeepPartial < T > = T extends object ? { [ P in keyof T ] ?: DeepPartial < T [ P ] > } : T
12
13
@@ -56,6 +57,7 @@ export class Kient extends EventEmitter<KientEventEmitters> {
56
57
}
57
58
58
59
api = {
60
+ misc : new MiscAPI ( this ) ,
59
61
category : new CategoryAPI ( this ) ,
60
62
user : new UserAPI ( this ) ,
61
63
channel : new ChannelAPI ( this ) ,
Original file line number Diff line number Diff line change
1
+ export interface PublicKey {
2
+ public_key : string
3
+ }
You can’t perform that action at this time.
0 commit comments