@saltify/milky-types 1.0.0-draft.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +116 -0
- package/README.md +3 -0
- package/package.json +24 -0
- package/src/api/file.ts +110 -0
- package/src/api/friend.ts +40 -0
- package/src/api/group.ts +160 -0
- package/src/api/index.ts +5 -0
- package/src/api/message.ts +94 -0
- package/src/api/system.ts +125 -0
- package/src/common.ts +134 -0
- package/src/constants.ts +1 -0
- package/src/event.ts +279 -0
- package/src/index.ts +5 -0
- package/src/message.ts +236 -0
- package/src/scalar.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
Statement of Purpose
|
|
4
|
+
|
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
|
7
|
+
subsequent owner(s) (each and all, an "owner") of an original work of
|
|
8
|
+
authorship and/or a database (each, a "Work").
|
|
9
|
+
|
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific
|
|
12
|
+
works ("Commons") that the public can reliably and without fear of later
|
|
13
|
+
claims of infringement build upon, modify, incorporate in other works, reuse
|
|
14
|
+
and redistribute as freely as possible in any form whatsoever and for any
|
|
15
|
+
purposes, including without limitation commercial purposes. These owners may
|
|
16
|
+
contribute to the Commons to promote the ideal of a free culture and the
|
|
17
|
+
further production of creative, cultural and scientific works, or to gain
|
|
18
|
+
reputation or greater distribution for their Work in part through the use and
|
|
19
|
+
efforts of others.
|
|
20
|
+
|
|
21
|
+
For these and/or other purposes and motivations, and without any expectation
|
|
22
|
+
of additional consideration or compensation, the person associating CC0 with a
|
|
23
|
+
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
|
25
|
+
and publicly distribute the Work under its terms, with knowledge of his or her
|
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
|
27
|
+
effect of CC0 on those rights.
|
|
28
|
+
|
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
30
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
31
|
+
Related Rights"). Copyright and Related Rights include, but are not limited
|
|
32
|
+
to, the following:
|
|
33
|
+
|
|
34
|
+
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
|
35
|
+
and translate a Work;
|
|
36
|
+
|
|
37
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
38
|
+
|
|
39
|
+
iii. publicity and privacy rights pertaining to a person's image or likeness
|
|
40
|
+
depicted in a Work;
|
|
41
|
+
|
|
42
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
43
|
+
subject to the limitations in paragraph 4(a), below;
|
|
44
|
+
|
|
45
|
+
v. rights protecting the extraction, dissemination, use and reuse of data in
|
|
46
|
+
a Work;
|
|
47
|
+
|
|
48
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
49
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
50
|
+
protection of databases, and under any national implementation thereof,
|
|
51
|
+
including any amended or successor version of such directive); and
|
|
52
|
+
|
|
53
|
+
vii. other similar, equivalent or corresponding rights throughout the world
|
|
54
|
+
based on applicable law or treaty, and any national implementations thereof.
|
|
55
|
+
|
|
56
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
|
57
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
|
58
|
+
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
|
59
|
+
and Related Rights and associated claims and causes of action, whether now
|
|
60
|
+
known or unknown (including existing as well as future claims and causes of
|
|
61
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
|
62
|
+
duration provided by applicable law or treaty (including future time
|
|
63
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
64
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
65
|
+
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
|
66
|
+
the Waiver for the benefit of each member of the public at large and to the
|
|
67
|
+
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
|
68
|
+
shall not be subject to revocation, rescission, cancellation, termination, or
|
|
69
|
+
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
|
70
|
+
by the public as contemplated by Affirmer's express Statement of Purpose.
|
|
71
|
+
|
|
72
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
|
73
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
|
74
|
+
shall be preserved to the maximum extent permitted taking into account
|
|
75
|
+
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
|
76
|
+
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
|
77
|
+
non transferable, non sublicensable, non exclusive, irrevocable and
|
|
78
|
+
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
|
79
|
+
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
|
80
|
+
provided by applicable law or treaty (including future time extensions), (iii)
|
|
81
|
+
in any current or future medium and for any number of copies, and (iv) for any
|
|
82
|
+
purpose whatsoever, including without limitation commercial, advertising or
|
|
83
|
+
promotional purposes (the "License"). The License shall be deemed effective as
|
|
84
|
+
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
|
85
|
+
License for any reason be judged legally invalid or ineffective under
|
|
86
|
+
applicable law, such partial invalidity or ineffectiveness shall not
|
|
87
|
+
invalidate the remainder of the License, and in such case Affirmer hereby
|
|
88
|
+
affirms that he or she will not (i) exercise any of his or her remaining
|
|
89
|
+
Copyright and Related Rights in the Work or (ii) assert any associated claims
|
|
90
|
+
and causes of action with respect to the Work, in either case contrary to
|
|
91
|
+
Affirmer's express Statement of Purpose.
|
|
92
|
+
|
|
93
|
+
4. Limitations and Disclaimers.
|
|
94
|
+
|
|
95
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
96
|
+
surrendered, licensed or otherwise affected by this document.
|
|
97
|
+
|
|
98
|
+
b. Affirmer offers the Work as-is and makes no representations or warranties
|
|
99
|
+
of any kind concerning the Work, express, implied, statutory or otherwise,
|
|
100
|
+
including without limitation warranties of title, merchantability, fitness
|
|
101
|
+
for a particular purpose, non infringement, or the absence of latent or
|
|
102
|
+
other defects, accuracy, or the present or absence of errors, whether or not
|
|
103
|
+
discoverable, all to the greatest extent permissible under applicable law.
|
|
104
|
+
|
|
105
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
106
|
+
that may apply to the Work or any use thereof, including without limitation
|
|
107
|
+
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
|
108
|
+
disclaims responsibility for obtaining any necessary consents, permissions
|
|
109
|
+
or other rights required for any use of the Work.
|
|
110
|
+
|
|
111
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
112
|
+
party to this document and has no duty or obligation with respect to this
|
|
113
|
+
CC0 or use of the Work.
|
|
114
|
+
|
|
115
|
+
For more information, please see
|
|
116
|
+
<http://creativecommons.org/publicdomain/zero/1.0/>
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@saltify/milky-types",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0-draft.1",
|
|
5
|
+
"description": "Type definitions for Milky protocol",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"keywords": [],
|
|
11
|
+
"author": "SaltifyDev",
|
|
12
|
+
"license": "CC0-1.0",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"zod": "^4.0.17"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@eslint/js": "^9.33.0",
|
|
18
|
+
"globals": "^16.3.0",
|
|
19
|
+
"typescript-eslint": "^8.39.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/api/file.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZInt64, ZString } from '../scalar';
|
|
3
|
+
import { GroupFileEntity, GroupFolderEntity } from '../common';
|
|
4
|
+
|
|
5
|
+
export const UploadPrivateFileInput = z.object({
|
|
6
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
7
|
+
file_uri: ZString.describe('文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式'),
|
|
8
|
+
file_name: ZString.describe('文件名称'),
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const UploadPrivateFileOutput = z.object({
|
|
12
|
+
file_id: ZString.describe('文件 ID'),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const UploadGroupFileInput = z.object({
|
|
16
|
+
group_id: ZInt64.describe('群号'),
|
|
17
|
+
parent_folder_id: ZString.default('/').describe('目标文件夹 ID'),
|
|
18
|
+
file_uri: ZString.describe('文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式'),
|
|
19
|
+
file_name: ZString.describe('文件名称'),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const UploadGroupFileOutput = z.object({
|
|
23
|
+
file_id: ZString.describe('文件 ID'),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export const GetPrivateFileDownloadUrlInput = z.object({
|
|
27
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
28
|
+
file_id: ZString.describe('文件 ID'),
|
|
29
|
+
file_hash: ZString.describe('文件的 TriSHA1 哈希值'),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const GetPrivateFileDownloadUrlOutput = z.object({
|
|
33
|
+
download_url: ZString.describe('文件下载链接'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const GetGroupFileDownloadUrlInput = z.object({
|
|
37
|
+
group_id: ZInt64.describe('群号'),
|
|
38
|
+
file_id: ZString.describe('文件 ID'),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const GetGroupFileDownloadUrlOutput = z.object({
|
|
42
|
+
download_url: ZString.describe('文件下载链接'),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const GetGroupFilesInput = z.object({
|
|
46
|
+
group_id: ZInt64.describe('群号'),
|
|
47
|
+
parent_folder_id: ZString.default('/').describe('父文件夹 ID'),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const GetGroupFilesOutput = z.object({
|
|
51
|
+
files: z.array(z.lazy(() => GroupFileEntity)).describe('文件列表'),
|
|
52
|
+
folders: z.array(z.lazy(() => GroupFolderEntity)).describe('文件夹列表'),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const MoveGroupFileInput = z.object({
|
|
56
|
+
group_id: ZInt64.describe('群号'),
|
|
57
|
+
file_id: ZString.describe('文件 ID'),
|
|
58
|
+
parent_folder_id: ZString.default('/').describe('文件所在的文件夹 ID'),
|
|
59
|
+
target_folder_id: ZString.default('/').describe('目标文件夹 ID'),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const RenameGroupFileInput = z.object({
|
|
63
|
+
group_id: ZInt64.describe('群号'),
|
|
64
|
+
file_id: ZString.describe('文件 ID'),
|
|
65
|
+
parent_folder_id: ZString.default('/').describe('文件所在的文件夹 ID'),
|
|
66
|
+
new_file_name: ZString.describe('新文件名称'),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const DeleteGroupFileInput = z.object({
|
|
70
|
+
group_id: ZInt64.describe('群号'),
|
|
71
|
+
file_id: ZString.describe('文件 ID'),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const CreateGroupFolderInput = z.object({
|
|
75
|
+
group_id: ZInt64.describe('群号'),
|
|
76
|
+
folder_name: ZString.describe('文件夹名称'),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const CreateGroupFolderOutput = z.object({
|
|
80
|
+
folder_id: ZString.describe('文件夹 ID'),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const RenameGroupFolderInput = z.object({
|
|
84
|
+
group_id: ZInt64.describe('群号'),
|
|
85
|
+
folder_id: ZString.describe('文件夹 ID'),
|
|
86
|
+
new_folder_name: ZString.describe('新文件夹名'),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const DeleteGroupFolderInput = z.object({
|
|
90
|
+
group_id: ZInt64.describe('群号'),
|
|
91
|
+
folder_id: ZString.describe('文件夹 ID'),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export type UploadPrivateFileInput = z.infer<typeof UploadPrivateFileInput>;
|
|
95
|
+
export type UploadPrivateFileOutput = z.infer<typeof UploadPrivateFileOutput>;
|
|
96
|
+
export type UploadGroupFileInput = z.infer<typeof UploadGroupFileInput>;
|
|
97
|
+
export type UploadGroupFileOutput = z.infer<typeof UploadGroupFileOutput>;
|
|
98
|
+
export type GetPrivateFileDownloadUrlInput = z.infer<typeof GetPrivateFileDownloadUrlInput>;
|
|
99
|
+
export type GetPrivateFileDownloadUrlOutput = z.infer<typeof GetPrivateFileDownloadUrlOutput>;
|
|
100
|
+
export type GetGroupFileDownloadUrlInput = z.infer<typeof GetGroupFileDownloadUrlInput>;
|
|
101
|
+
export type GetGroupFileDownloadUrlOutput = z.infer<typeof GetGroupFileDownloadUrlOutput>;
|
|
102
|
+
export type GetGroupFilesInput = z.infer<typeof GetGroupFilesInput>;
|
|
103
|
+
export type GetGroupFilesOutput = z.infer<typeof GetGroupFilesOutput>;
|
|
104
|
+
export type MoveGroupFileInput = z.infer<typeof MoveGroupFileInput>;
|
|
105
|
+
export type RenameGroupFileInput = z.infer<typeof RenameGroupFileInput>;
|
|
106
|
+
export type DeleteGroupFileInput = z.infer<typeof DeleteGroupFileInput>;
|
|
107
|
+
export type CreateGroupFolderInput = z.infer<typeof CreateGroupFolderInput>;
|
|
108
|
+
export type CreateGroupFolderOutput = z.infer<typeof CreateGroupFolderOutput>;
|
|
109
|
+
export type RenameGroupFolderInput = z.infer<typeof RenameGroupFolderInput>;
|
|
110
|
+
export type DeleteGroupFolderInput = z.infer<typeof DeleteGroupFolderInput>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZInt32, ZInt64, ZBoolean, ZString } from '../scalar';
|
|
3
|
+
import { FriendRequest } from '../common';
|
|
4
|
+
|
|
5
|
+
export const SendFriendNudgeInput = z.object({
|
|
6
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
7
|
+
is_self: ZBoolean.default(false).describe('是否戳自己'),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const SendProfileLikeInput = z.object({
|
|
11
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
12
|
+
count: ZInt32.default(1).describe('点赞数量'),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const GetFriendRequestsInput = z.object({
|
|
16
|
+
limit: ZInt32.default(20).describe('获取的最大请求数量'),
|
|
17
|
+
is_filtered: ZBoolean.default(false).describe('`true` 表示只获取被过滤(由风险账号发起)的通知,`false` 表示只获取未被过滤的通知'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const GetFriendRequestsOutput = z.object({
|
|
21
|
+
requests: z.array(z.lazy(() => FriendRequest)).describe('好友请求列表'),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const AcceptFriendRequestInput = z.object({
|
|
25
|
+
initiator_uid: ZString.describe('请求发起者 UID'),
|
|
26
|
+
is_filtered: ZBoolean.default(false).describe('是否是被过滤的请求'),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const RejectFriendRequestInput = z.object({
|
|
30
|
+
initiator_uid: ZString.describe('请求发起者 UID'),
|
|
31
|
+
is_filtered: ZBoolean.default(false).describe('是否是被过滤的请求'),
|
|
32
|
+
reason: ZString.optional().describe('拒绝理由'),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type SendFriendNudgeInput = z.infer<typeof SendFriendNudgeInput>;
|
|
36
|
+
export type SendProfileLikeInput = z.infer<typeof SendProfileLikeInput>;
|
|
37
|
+
export type GetFriendRequestsInput = z.infer<typeof GetFriendRequestsInput>;
|
|
38
|
+
export type GetFriendRequestsOutput = z.infer<typeof GetFriendRequestsOutput>;
|
|
39
|
+
export type AcceptFriendRequestInput = z.infer<typeof AcceptFriendRequestInput>;
|
|
40
|
+
export type RejectFriendRequestInput = z.infer<typeof RejectFriendRequestInput>;
|
package/src/api/group.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZInt64, ZString, ZBoolean, ZInt32 } from '../scalar';
|
|
3
|
+
import { GroupAnnouncementEntity, GroupNotification } from '../common';
|
|
4
|
+
import { GroupEssenceMessage } from '../message';
|
|
5
|
+
|
|
6
|
+
const PictureApiBase = z.object({
|
|
7
|
+
image_uri: ZString.describe('图像文件 URI,支持 `file://` `http(s)://` `base64://` 三种格式'),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const SetGroupNameInput = z.object({
|
|
11
|
+
group_id: ZInt64.describe('群号'),
|
|
12
|
+
new_group_name: ZString.describe('新群名称'),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const SetGroupAvatarInput = z.object({
|
|
16
|
+
group_id: ZInt64.describe('群号'),
|
|
17
|
+
}).extend(PictureApiBase.shape);
|
|
18
|
+
|
|
19
|
+
export const SetGroupMemberCardInput = z.object({
|
|
20
|
+
group_id: ZInt64.describe('群号'),
|
|
21
|
+
user_id: ZInt64.describe('被设置的群成员 QQ 号'),
|
|
22
|
+
card: ZString.describe('新群名片'),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const SetGroupMemberSpecialTitleInput = z.object({
|
|
26
|
+
group_id: ZInt64.describe('群号'),
|
|
27
|
+
user_id: ZInt64.describe('被设置的群成员 QQ 号'),
|
|
28
|
+
special_title: ZString.describe('新专属头衔'),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const SetGroupMemberAdminInput = z.object({
|
|
32
|
+
group_id: ZInt64.describe('群号'),
|
|
33
|
+
user_id: ZInt64.describe('被设置的 QQ 号'),
|
|
34
|
+
is_set: ZBoolean.default(true).describe('是否设置为管理员,`false` 表示取消管理员'),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const SetGroupMemberMuteInput = z.object({
|
|
38
|
+
group_id: ZInt64.describe('群号'),
|
|
39
|
+
user_id: ZInt64.describe('被设置的 QQ 号'),
|
|
40
|
+
duration: ZInt64.default(0).describe('禁言持续时间(秒),设为 `0` 为取消禁言'),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const SetGroupWholeMuteInput = z.object({
|
|
44
|
+
group_id: ZInt64.describe('群号'),
|
|
45
|
+
is_mute: ZBoolean.default(true).describe('是否开启全员禁言,`false` 表示取消全员禁言'),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const KickGroupMemberInput = z.object({
|
|
49
|
+
group_id: ZInt64.describe('群号'),
|
|
50
|
+
user_id: ZInt64.describe('被踢的 QQ 号'),
|
|
51
|
+
reject_add_request: ZBoolean.default(true).describe('是否拒绝加群申请,`false` 表示不拒绝'),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const GetGroupAnnouncementListInput = z.object({
|
|
55
|
+
group_id: ZInt64.describe('群号'),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const GetGroupAnnouncementListOutput = z.object({
|
|
59
|
+
announcements: z.array(z.lazy(() => GroupAnnouncementEntity)).describe('群公告列表'),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const SendGroupAnnouncementInput = z.object({
|
|
63
|
+
group_id: ZInt64.describe('群号'),
|
|
64
|
+
content: ZString.describe('公告内容'),
|
|
65
|
+
}).extend(PictureApiBase.shape);
|
|
66
|
+
|
|
67
|
+
export const DeleteGroupAnnouncementInput = z.object({
|
|
68
|
+
group_id: ZInt64.describe('群号'),
|
|
69
|
+
announcement_id: ZString.describe('公告 ID'),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export const GetGroupEssenceMessagesInput = z.object({
|
|
73
|
+
group_id: ZInt64.describe('群号'),
|
|
74
|
+
page_index: ZInt32.describe('页码索引,从 0 开始'),
|
|
75
|
+
page_size: ZInt32.describe('每页包含的精华消息数量'),
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const GetGroupEssenceMessagesOutput = z.object({
|
|
79
|
+
messages: z.array(z.lazy(() => GroupEssenceMessage)).describe('精华消息列表'),
|
|
80
|
+
is_end: ZBoolean.describe('是否已到最后一页'),
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const SetGroupEssenceMessageInput = z.object({
|
|
84
|
+
group_id: ZInt64.describe('群号'),
|
|
85
|
+
message_seq: ZInt64.describe('消息序列号'),
|
|
86
|
+
is_set: ZBoolean.default(true).describe('是否设置为精华消息,`false` 表示取消精华'),
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const QuitGroupInput = z.object({
|
|
90
|
+
group_id: ZInt64.describe('群号'),
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const SendGroupMessageReactionInput = z.object({
|
|
94
|
+
group_id: ZInt64.describe('群号'),
|
|
95
|
+
message_seq: ZInt64.describe('要回应的消息序列号'),
|
|
96
|
+
reaction: ZString.describe('表情 ID'),
|
|
97
|
+
is_add: ZBoolean.default(true).describe('是否添加表情,`false` 表示取消'),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
export const SendGroupNudgeInput = z.object({
|
|
101
|
+
group_id: ZInt64.describe('群号'),
|
|
102
|
+
user_id: ZInt64.describe('被戳的群成员 QQ 号'),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export const GetGroupNotificationsInput = z.object({
|
|
106
|
+
start_notification_seq: ZInt64.optional().describe('起始通知序列号'),
|
|
107
|
+
is_filtered: ZBoolean.default(false).describe('`true` 表示只获取被过滤(由风险账号发起)的通知,`false` 表示只获取未被过滤的通知'),
|
|
108
|
+
limit: ZInt32.default(20).describe('获取的最大通知数量'),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const GetGroupNotificationsOutput = z.object({
|
|
112
|
+
notifications: z.array(z.lazy(() => GroupNotification)).describe('获取到的群通知(notification_seq 降序排列),序列号不一定连续'),
|
|
113
|
+
next_notification_seq: ZInt64.optional().describe('下一页起始通知序列号'),
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
export const AcceptGroupRequestInput = z.object({
|
|
117
|
+
notification_seq: ZString.describe('请求对应的通知序列号'),
|
|
118
|
+
is_filtered: ZBoolean.default(false).describe('是否是被过滤的请求'),
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const RejectGroupRequestInput = z.object({
|
|
122
|
+
notification_seq: ZString.describe('请求对应的通知序列号'),
|
|
123
|
+
is_filtered: ZBoolean.default(false).describe('是否是被过滤的请求'),
|
|
124
|
+
reason: ZString.optional().describe('拒绝理由'),
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export const AcceptGroupInvitationInput = z.object({
|
|
128
|
+
group_id: ZInt64.describe('群号'),
|
|
129
|
+
invitation_seq: ZString.describe('邀请序列号'),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export const RejectGroupInvitationInput = z.object({
|
|
133
|
+
group_id: ZInt64.describe('群号'),
|
|
134
|
+
invitation_seq: ZString.describe('邀请序列号'),
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
export type SetGroupNameInput = z.infer<typeof SetGroupNameInput>;
|
|
138
|
+
export type SetGroupAvatarInput = z.infer<typeof SetGroupAvatarInput>;
|
|
139
|
+
export type SetGroupMemberCardInput = z.infer<typeof SetGroupMemberCardInput>;
|
|
140
|
+
export type SetGroupMemberSpecialTitleInput = z.infer<typeof SetGroupMemberSpecialTitleInput>;
|
|
141
|
+
export type SetGroupMemberAdminInput = z.infer<typeof SetGroupMemberAdminInput>;
|
|
142
|
+
export type SetGroupMemberMuteInput = z.infer<typeof SetGroupMemberMuteInput>;
|
|
143
|
+
export type SetGroupWholeMuteInput = z.infer<typeof SetGroupWholeMuteInput>;
|
|
144
|
+
export type KickGroupMemberInput = z.infer<typeof KickGroupMemberInput>;
|
|
145
|
+
export type GetGroupAnnouncementListInput = z.infer<typeof GetGroupAnnouncementListInput>;
|
|
146
|
+
export type GetGroupAnnouncementListOutput = z.infer<typeof GetGroupAnnouncementListOutput>;
|
|
147
|
+
export type SendGroupAnnouncementInput = z.infer<typeof SendGroupAnnouncementInput>;
|
|
148
|
+
export type DeleteGroupAnnouncementInput = z.infer<typeof DeleteGroupAnnouncementInput>;
|
|
149
|
+
export type GetGroupEssenceMessagesInput = z.infer<typeof GetGroupEssenceMessagesInput>;
|
|
150
|
+
export type GetGroupEssenceMessagesOutput = z.infer<typeof GetGroupEssenceMessagesOutput>;
|
|
151
|
+
export type SetGroupEssenceMessageInput = z.infer<typeof SetGroupEssenceMessageInput>;
|
|
152
|
+
export type QuitGroupInput = z.infer<typeof QuitGroupInput>;
|
|
153
|
+
export type SendGroupMessageReactionInput = z.infer<typeof SendGroupMessageReactionInput>;
|
|
154
|
+
export type SendGroupNudgeInput = z.infer<typeof SendGroupNudgeInput>;
|
|
155
|
+
export type GetGroupNotificationsInput = z.infer<typeof GetGroupNotificationsInput>;
|
|
156
|
+
export type GetGroupNotificationsOutput = z.infer<typeof GetGroupNotificationsOutput>;
|
|
157
|
+
export type AcceptGroupRequestInput = z.infer<typeof AcceptGroupRequestInput>;
|
|
158
|
+
export type RejectGroupRequestInput = z.infer<typeof RejectGroupRequestInput>;
|
|
159
|
+
export type AcceptGroupInvitationInput = z.infer<typeof AcceptGroupInvitationInput>;
|
|
160
|
+
export type RejectGroupInvitationInput = z.infer<typeof RejectGroupInvitationInput>;
|
package/src/api/index.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ZInt32, ZInt64, ZString } from '../scalar';
|
|
3
|
+
import { OutgoingSegment, IncomingMessage, IncomingForwardedMessage } from '../message';
|
|
4
|
+
|
|
5
|
+
const SendMessageApiBase = z.object({
|
|
6
|
+
message: z.array(z.lazy(() => OutgoingSegment)).describe('消息内容'),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const SendMessageApiCommonOutput = z.object({
|
|
10
|
+
message_seq: ZInt64.describe('消息序列号'),
|
|
11
|
+
time: ZInt64.describe('消息发送时间'),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const SendPrivateMessageInput = z.object({
|
|
15
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
16
|
+
}).extend(SendMessageApiBase.shape);
|
|
17
|
+
|
|
18
|
+
export const SendPrivateMessageOutput = SendMessageApiCommonOutput;
|
|
19
|
+
|
|
20
|
+
export const SendGroupMessageInput = z.object({
|
|
21
|
+
group_id: ZInt64.describe('群号'),
|
|
22
|
+
}).extend(SendMessageApiBase.shape);
|
|
23
|
+
|
|
24
|
+
export const SendGroupMessageOutput = SendMessageApiCommonOutput;
|
|
25
|
+
|
|
26
|
+
export const GetMessageInput = z.object({
|
|
27
|
+
message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
|
|
28
|
+
peer_id: ZInt64.describe('好友 QQ 号或群号'),
|
|
29
|
+
message_seq: ZInt64.describe('消息序列号'),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const GetMessageOutput = z.object({
|
|
33
|
+
message: z.lazy(() => IncomingMessage).describe('消息内容'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const GetHistoryMessagesInput = z.object({
|
|
37
|
+
message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
|
|
38
|
+
peer_id: ZInt64.describe('好友 QQ 号或群号'),
|
|
39
|
+
start_message_seq: ZInt64.optional().describe('起始消息序列号,由此开始从新到旧查询,不提供则从最新消息开始'),
|
|
40
|
+
limit: ZInt32.max(30).default(20).describe('期望获取到的消息数量,最多 30 条'),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const GetHistoryMessagesOutput = z.object({
|
|
44
|
+
messages: z.array(z.lazy(() => IncomingMessage)).describe('获取到的消息(message_seq 升序排列),部分消息可能不存在,如撤回的消息'),
|
|
45
|
+
next_message_seq: ZInt64.optional().describe('下一页起始消息序列号'),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const GetResourceTempUrlInput = z.object({
|
|
49
|
+
resource_id: ZString.describe('资源 ID'),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export const GetResourceTempUrlOutput = z.object({
|
|
53
|
+
url: ZString.describe('临时资源链接'),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const GetForwardedMessagesInput = z.object({
|
|
57
|
+
forward_id: ZString.describe('转发消息 ID'),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const GetForwardedMessagesOutput = z.object({
|
|
61
|
+
messages: z.array(z.lazy(() => IncomingForwardedMessage)).describe('转发消息内容'),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const RecallPrivateMessageInput = z.object({
|
|
65
|
+
user_id: ZInt64.describe('好友 QQ 号'),
|
|
66
|
+
message_seq: ZInt64.describe('消息序列号'),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export const RecallGroupMessageInput = z.object({
|
|
70
|
+
group_id: ZInt64.describe('群号'),
|
|
71
|
+
message_seq: ZInt64.describe('消息序列号'),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const MarkMessageAsReadInput = z.object({
|
|
75
|
+
message_scene: z.enum(['friend', 'group', 'temp']).describe('消息场景'),
|
|
76
|
+
peer_id: ZInt64.describe('好友 QQ 号或群号'),
|
|
77
|
+
message_seq: ZInt64.describe('标为已读的消息序列号,该消息及更早的消息将被标记为已读'),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export type SendPrivateMessageInput = z.infer<typeof SendPrivateMessageInput>;
|
|
81
|
+
export type SendPrivateMessageOutput = z.infer<typeof SendPrivateMessageOutput>;
|
|
82
|
+
export type SendGroupMessageInput = z.infer<typeof SendGroupMessageInput>;
|
|
83
|
+
export type SendGroupMessageOutput = z.infer<typeof SendGroupMessageOutput>;
|
|
84
|
+
export type GetMessageInput = z.infer<typeof GetMessageInput>;
|
|
85
|
+
export type GetMessageOutput = z.infer<typeof GetMessageOutput>;
|
|
86
|
+
export type GetHistoryMessagesInput = z.infer<typeof GetHistoryMessagesInput>;
|
|
87
|
+
export type GetHistoryMessagesOutput = z.infer<typeof GetHistoryMessagesOutput>;
|
|
88
|
+
export type GetResourceTempUrlInput = z.infer<typeof GetResourceTempUrlInput>;
|
|
89
|
+
export type GetResourceTempUrlOutput = z.infer<typeof GetResourceTempUrlOutput>;
|
|
90
|
+
export type GetForwardedMessagesInput = z.infer<typeof GetForwardedMessagesInput>;
|
|
91
|
+
export type GetForwardedMessagesOutput = z.infer<typeof GetForwardedMessagesOutput>;
|
|
92
|
+
export type RecallPrivateMessageInput = z.infer<typeof RecallPrivateMessageInput>;
|
|
93
|
+
export type RecallGroupMessageInput = z.infer<typeof RecallGroupMessageInput>;
|
|
94
|
+
export type MarkMessageAsReadInput = z.infer<typeof MarkMessageAsReadInput>;
|