Skip to content

Commit

Permalink
Updated docs for pipe client
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Nov 13, 2024
1 parent 6f931b0 commit dde3020
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 2 deletions.
18 changes: 18 additions & 0 deletions docs/quick_reference/http_api/message.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ title: 消息相关接口
```csharp
readonly KookSocketClient _socketClient = null;
readonly KookRestClient _restClient = null;
readonly KookPipeClient _pipeClient = null;

SocketTextChannel socketTextChannel = null;

Expand Down Expand Up @@ -179,6 +180,22 @@ await userMessage.RemoveReactionAsync(emoji, user);
await userMessage.RemoveReactionsAsync(user, emojis);
```

### [发送管道消息]

POST `/api/v3/message/send-pipemsg`

```csharp
string content = null; // 要发送到管道的消息文本
T parameters = default; // 要发送到管道的模板消息的参数
JsonSerializerOptions jsonSerializerOptions = null; // 要发送到管道的模板消息的参数的序列化选项
// API 请求,发送文本内容
await _pipeClient.SendContentAsync(content);
// API 请求,发送模板消息的参数
await _pipeClient.SendTemplateAsync(parameters, jsonSerializerOptions);
```


[获取频道聊天消息列表]: https://developer.kookapp.cn/doc/http/message#获取频道聊天消息列表
[获取频道聊天消息详情]: https://developer.kookapp.cn/doc/http/message#获取频道聊天消息详情
[发送频道聊天消息]: https://developer.kookapp.cn/doc/http/message#发送频道聊天消息
Expand All @@ -187,3 +204,4 @@ await userMessage.RemoveReactionsAsync(user, emojis);
[获取频道消息某回应的用户列表]: https://developer.kookapp.cn/doc/http/message#获取频道消息某回应的用户列表
[给某个消息添加回应]: https://developer.kookapp.cn/doc/http/message#给某个消息添加回应
[删除消息的某个回应]: https://developer.kookapp.cn/doc/http/message#删除消息的某个回应
[发送管道消息]: https://developer.kookapp.cn/doc/http/message#发送管道消息
1 change: 1 addition & 0 deletions docs/quick_reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ title: 快速参考指南
- @Guides.QuickReference.Startup.Rest
- @Guides.QuickReference.Startup.WebSocket
- @Guides.QuickReference.Startup.Webhook
- @Guides.QuickReference.Startup.Pipe
- HTTP 接口
- @Guides.QuickReference.Http.Guild
- @Guides.QuickReference.Http.Channel
Expand Down
34 changes: 34 additions & 0 deletions docs/quick_reference/startup/pipe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
uid: Guides.QuickReference.Startup.Pipe
title: Pipe 客户端
---

# Pipe 客户端

预声明变量

```csharp
readonly KookPipeClient _pipeClient;
```

```csharp
string accessToken; // 管道访问令牌
Uri pipeUrl; // 管道回调地址
// 使用访问令牌及默认配置创建 Pipe 客户端
_pipeClient = new KookPipeClient(accessToken);
// 使用回调地址及默认配置创建 Pipe 客户端
_pipeClient = new KookPipeClient(pipeUrl);
// 使用访问令牌及自定义配置创建 Pipe 客户端
_pipeClient = new KookPipeClient(accessToken, new KookRestConfig
{
// KookRestConfig 的全部配置项参见 Rest 客户端页面
});
// 使用回调地址及自定义配置创建 Pipe 客户端
_pipeClient = new KookPipeClient(pipeUrl, new KookRestConfig
{
// KookRestConfig 的全部配置项参见 Rest 客户端页面
});

// Pipe 客户端不实现 IKookClient 接口,创建即登录
```
2 changes: 1 addition & 1 deletion docs/quick_reference/startup/rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ readonly KookRestClient _restClient;
// 使用默认配置创建 Rest 客户端
_restClient = new KookRestClient();
// 使用自定义配置创建 Rest 客户端
_restClient = new KookRestClient(new KookRestConfig()
_restClient = new KookRestClient(new KookRestConfig
{
// 请求头 Accept-Language
AcceptLanguage = "zh-CN",
Expand Down
2 changes: 1 addition & 1 deletion docs/quick_reference/startup/websocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ readonly KookSocketClient _socketClient;
// 使用默认配置创建 WebSocket 客户端
_socketClient = new KookRestClient();
// 使用自定义配置创建 WebSocket 客户端
_socketClient = new KookSocketClient(new KookSocketConfig()
_socketClient = new KookSocketClient(new KookSocketConfig
{
// 包含 KookRestConfig 的全部配置项,此处略
Expand Down
2 changes: 2 additions & 0 deletions docs/quick_reference/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
topicUid: Guides.QuickReference.Startup.WebSocket
- name: Webhook 服务端
topicUid: Guides.QuickReference.Startup.Webhook
- name: Pipe 客户端
topicUid: Guides.QuickReference.Startup.Pipe
- name: HTTP 接口
items:
- name: 服务器相关接口
Expand Down

0 comments on commit dde3020

Please sign in to comment.