Skip to main content

privchat_protocol/rpc/
sticker.rs

1// Copyright 2025 Shanghai Boyu Information Technology Co., Ltd.
2// https://privchat.dev
3//
4// Author: zoujiaqing <zoujiaqing@gmail.com>
5//
6// Licensed under the Apache License, Version 2.0 (the "License");
7// you may not use this file except in compliance with the License.
8// You may obtain a copy of the License at
9//
10//     http://www.apache.org/licenses/LICENSE-2.0
11//
12// Unless required by applicable law or agreed to in writing, software
13// distributed under the License is distributed on an "AS IS" BASIS,
14// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15// See the License for the specific language governing permissions and
16// limitations under the License.
17
18/// 表情包相关 RPC
19use serde::{Deserialize, Serialize};
20
21/// 获取表情包列表请求
22///
23/// RPC路由: `sticker/package/list`
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub struct StickerPackageListRequest {}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct StickerInfo {
29    pub sticker_id: String,
30    pub package_id: String,
31    pub image_url: String,
32    pub alt_text: String,
33    #[serde(skip_serializing_if = "Option::is_none")]
34    pub emoji: Option<String>,
35    pub width: u32,
36    pub height: u32,
37    pub mime_type: String,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
41pub struct StickerPackageInfo {
42    pub package_id: String,
43    pub name: String,
44    pub thumbnail_url: String,
45    pub author: String,
46    pub description: String,
47    pub sticker_count: usize,
48    #[serde(skip_serializing_if = "Option::is_none")]
49    pub stickers: Option<Vec<StickerInfo>>,
50}
51
52/// 获取表情包列表响应
53///
54/// RPC路由: `sticker/package/list`
55#[derive(Debug, Clone, Serialize, Deserialize)]
56pub struct StickerPackageListResponse {
57    pub packages: Vec<StickerPackageInfo>,
58}
59
60/// 获取表情包详情请求
61///
62/// RPC路由: `sticker/package/detail`
63#[derive(Debug, Clone, Serialize, Deserialize)]
64pub struct StickerPackageDetailRequest {
65    pub package_id: String,
66}
67
68/// 获取表情包详情响应
69///
70/// RPC路由: `sticker/package/detail`
71#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct StickerPackageDetailResponse {
73    pub package: StickerPackageInfo,
74}