Skip to content

Commit 3e4d087

Browse files
committed
feat: initial docs
1 parent beff95e commit 3e4d087

23 files changed

+313
-23
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,8 @@ dist
173173

174174
# Finder (MacOS) folder config
175175
.DS_Store
176+
177+
# Vitepress docs
178+
docs/.vitepress/dist
179+
docs/.vitepress/cache
180+
docs/typedoc

bun.lockb

54.3 KB
Binary file not shown.

docs/.vitepress/config.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig } from 'vitepress'
2+
// @ts-expect-error vite will import json
3+
import typedocSidebar from '../typedoc/typedoc-sidebar.json'
4+
5+
// https://vitepress.dev/reference/site-config
6+
export default defineConfig({
7+
title: 'Kient',
8+
description: 'Typescript first API wrapper for Kick.com',
9+
themeConfig: {
10+
// https://vitepress.dev/reference/default-theme-config
11+
nav: [
12+
{ text: 'Home', link: '/' },
13+
{ text: 'Examples', link: '/markdown-examples' },
14+
{ text: 'API Reference', link: '/typedoc/' },
15+
],
16+
17+
sidebar: [
18+
{
19+
text: 'Examples',
20+
items: [
21+
{ text: 'Markdown Examples', link: '/markdown-examples' },
22+
{ text: 'Runtime API Examples', link: '/api-examples' },
23+
],
24+
},
25+
{
26+
text: 'API Reference',
27+
items: typedocSidebar,
28+
},
29+
],
30+
31+
socialLinks: [{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }],
32+
},
33+
})

docs/api-examples.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Runtime API Examples
6+
7+
This page demonstrates usage of some of the runtime APIs provided by VitePress.
8+
9+
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10+
11+
```md
12+
<script setup>
13+
import { useData } from 'vitepress'
14+
15+
const { theme, page, frontmatter } = useData()
16+
</script>
17+
18+
## Results
19+
20+
### Theme Data
21+
<pre>{{ theme }}</pre>
22+
23+
### Page Data
24+
<pre>{{ page }}</pre>
25+
26+
### Page Frontmatter
27+
<pre>{{ frontmatter }}</pre>
28+
```
29+
30+
<script setup>
31+
import { useData } from 'vitepress'
32+
33+
const { site, theme, page, frontmatter } = useData()
34+
</script>
35+
36+
## Results
37+
38+
### Theme Data
39+
<pre>{{ theme }}</pre>
40+
41+
### Page Data
42+
<pre>{{ page }}</pre>
43+
44+
### Page Frontmatter
45+
<pre>{{ frontmatter }}</pre>
46+
47+
## More
48+
49+
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

docs/index.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
# https://vitepress.dev/reference/default-theme-home-page
3+
layout: home
4+
5+
hero:
6+
name: "Kient"
7+
text: "Typescript first API wrapper for Kick.com"
8+
tagline: My great project tagline
9+
actions:
10+
- theme: brand
11+
text: Markdown Examples
12+
link: /markdown-examples
13+
- theme: alt
14+
text: API Examples
15+
link: /api-examples
16+
17+
features:
18+
- title: Feature A
19+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
20+
- title: Feature B
21+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
22+
- title: Feature C
23+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
24+
---
25+

docs/markdown-examples.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Markdown Extension Examples
2+
3+
This page demonstrates some of the built-in markdown extensions provided by VitePress.
4+
5+
## Syntax Highlighting
6+
7+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8+
9+
**Input**
10+
11+
````md
12+
```js{4}
13+
export default {
14+
data () {
15+
return {
16+
msg: 'Highlighted!'
17+
}
18+
}
19+
}
20+
```
21+
````
22+
23+
**Output**
24+
25+
```js{4}
26+
export default {
27+
data () {
28+
return {
29+
msg: 'Highlighted!'
30+
}
31+
}
32+
}
33+
```
34+
35+
## Custom Containers
36+
37+
**Input**
38+
39+
```md
40+
::: info
41+
This is an info box.
42+
:::
43+
44+
::: tip
45+
This is a tip.
46+
:::
47+
48+
::: warning
49+
This is a warning.
50+
:::
51+
52+
::: danger
53+
This is a dangerous warning.
54+
:::
55+
56+
::: details
57+
This is a details block.
58+
:::
59+
```
60+
61+
**Output**
62+
63+
::: info
64+
This is an info box.
65+
:::
66+
67+
::: tip
68+
This is a tip.
69+
:::
70+
71+
::: warning
72+
This is a warning.
73+
:::
74+
75+
::: danger
76+
This is a dangerous warning.
77+
:::
78+
79+
::: details
80+
This is a details block.
81+
:::
82+
83+
## More
84+
85+
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@
33
"module": "src/index.ts",
44
"type": "module",
55
"scripts": {
6-
"dev": "bun run --watch example/get-clips.ts"
6+
"dev": "bun run --watch example/init.ts",
7+
"docs:prepare": "typedoc",
8+
"docs:dev": "typedoc && vitepress dev docs",
9+
"docs:build": "vitepress build docs",
10+
"docs:preview": "vitepress preview docs"
711
},
812
"devDependencies": {
913
"@biomejs/biome": "1.8.3",
1014
"@deepkit/bun": "^1.0.1-alpha.153",
1115
"@deepkit/type-compiler": "^1.0.1-alpha.150",
12-
"@types/bun": "^1.1.6"
16+
"@types/bun": "^1.1.6",
17+
"typedoc": "^0.26.5",
18+
"typedoc-plugin-markdown": "^4.2.3",
19+
"typedoc-plugin-missing-exports": "^3.0.0",
20+
"typedoc-vitepress-theme": "^1.0.1",
21+
"vitepress": "^1.3.1"
1322
},
1423
"peerDependencies": {
1524
"typescript": "^5.5.4"

src/api.client.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export interface APIClientOptions {
55
ofetch?: FetchOptions<ResponseType>
66
}
77

8+
/** @internal */
89
export class APIClient {
910
private readonly apiFetch: $Fetch
1011

src/api/api-base.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Kient } from '../kient'
22

3+
/** @internal */
34
export class APIBase {
45
protected readonly kient: Kient
56

src/api/channels/index.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ import { APIBase } from '../api-base'
22
import { getChannel } from './get-channel'
33
import { getClips } from './get-clip'
44

5+
/**
6+
* Description placeholder
7+
*
8+
* @group APIs
9+
*/
510
export class ChannelsAPI extends APIBase {
611
/**
712
* Returns channel and user information of the specified channel

src/kient.ts

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import defu from 'defu'
2-
import { WSClient } from './ws.client'
2+
import { WSClient, type WSClientOptions } from './ws.client'
33
import { EventEmitter } from 'tseep'
44
import type { KientEventEmitters } from './events'
55
import { ChannelsAPI } from './api/channels'
@@ -9,24 +9,23 @@ type DeepPartial<T> = T extends object ? { [P in keyof T]?: DeepPartial<T[P]> }
99

1010
export interface KientOptions {
1111
connectToWebsocket: boolean
12-
pusher: {
13-
appKey: string
14-
cluster: string
15-
}
1612
apiClient: APIClientOptions
13+
wsClient: WSClientOptions
1714
}
1815

1916
const defaultKientOptions: KientOptions = {
2017
connectToWebsocket: true,
21-
pusher: {
22-
appKey: '32cbd69e4b950bf97679',
23-
cluster: 'us2',
24-
},
2518
apiClient: {
2619
ofetch: {
2720
baseURL: 'https://api.kick.com/private/v1',
2821
},
2922
},
23+
wsClient: {
24+
pusher: {
25+
appKey: '32cbd69e4b950bf97679',
26+
cluster: 'us2',
27+
},
28+
},
3029
}
3130

3231
export class Kient extends EventEmitter<KientEventEmitters> {
@@ -44,12 +43,7 @@ export class Kient extends EventEmitter<KientEventEmitters> {
4443
}
4544

4645
connectWebsocket() {
47-
this._wsClient = new WSClient(this, {
48-
pusher: {
49-
appKey: this.kientOptions.pusher.appKey,
50-
cluster: this.kientOptions.pusher.cluster,
51-
},
52-
})
46+
this._wsClient = new WSClient(this, this.kientOptions.wsClient)
5347
}
5448

5549
api = {

src/structures/category.ts

+6
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ import type { Kient } from '../kient'
44
// biome-ignore lint/style/useImportType: deepkit/type
55
import { Directory } from './directory'
66

7+
/**
8+
* Data structure of a stream category
9+
*
10+
* @group API Structures
11+
*/
712
export class Category {
813
constructor(
14+
/** @internal */
915
public kient: Kient & Group<'exclude'>,
1016

1117
public id: string,

src/structures/channel.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { serialize, Group } from '@deepkit/type'
33
import type { Kient } from '../kient'
44

5+
/**
6+
* Data structure of a user's channel
7+
*
8+
* @group API Structures
9+
*/
510
export class Channel {
611
constructor(
712
public kient: Kient & Group<'exclude'>,

src/structures/chatroom.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { serialize, Group } from '@deepkit/type'
33
import type { Kient } from '../kient'
44

5+
/**
6+
* Data structure of a channel's chatroom
7+
*
8+
* @group API Structures
9+
*/
510
export class Chatroom {
611
constructor(
712
public kient: Kient & Group<'exclude'>,

src/structures/clip.ts

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ import { Channel } from './channel'
88
// biome-ignore lint/style/useImportType: deepkit/type
99
import { User } from './user'
1010

11+
/**
12+
* Data structure of a clip from a livestream
13+
*
14+
* @group API Structures
15+
*/
1116
export class Clip {
1217
constructor(
1318
public kient: Kient & Group<'exclude'>,

src/structures/directory.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { serialize, Group } from '@deepkit/type'
33
import type { Kient } from '../kient'
44

5+
/**
6+
* Data structure of a directory
7+
*
8+
* @group API Structures
9+
*/
510
export class Directory {
611
constructor(
712
public kient: Kient & Group<'exclude'>,

src/structures/panel.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { serialize, Group } from '@deepkit/type'
33
import type { Kient } from '../kient'
44

5+
/**
6+
* Data structure of a channel's panels in their about page
7+
*
8+
* @group API Structures
9+
*/
510
export class Panel {
611
constructor(public kient: Kient & Group<'exclude'>) {}
712

src/structures/social.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { serialize, Group } from '@deepkit/type'
33
import type { Kient } from '../kient'
44

5+
/**
6+
* Data structure of a channel's social media links
7+
*
8+
* @group API Structures
9+
*/
510
export class Social {
611
constructor(public kient: Kient & Group<'exclude'>) {}
712

0 commit comments

Comments
 (0)