@satorijs/adapter-dingtalk 1.0.0

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.
Files changed (53) hide show
  1. package/lib/api/alitrip.d.ts +396 -0
  2. package/lib/api/attendance.d.ts +62 -0
  3. package/lib/api/badge.d.ts +232 -0
  4. package/lib/api/blackboard.d.ts +16 -0
  5. package/lib/api/calendar.d.ts +620 -0
  6. package/lib/api/card.d.ts +184 -0
  7. package/lib/api/conference.d.ts +403 -0
  8. package/lib/api/connector.d.ts +78 -0
  9. package/lib/api/contact.d.ts +39 -0
  10. package/lib/api/convFile.d.ts +134 -0
  11. package/lib/api/crm.d.ts +661 -0
  12. package/lib/api/customerService.d.ts +127 -0
  13. package/lib/api/datacenter.d.ts +505 -0
  14. package/lib/api/devicemng.d.ts +160 -0
  15. package/lib/api/diot.d.ts +12 -0
  16. package/lib/api/doc.d.ts +140 -0
  17. package/lib/api/drive.d.ts +87 -0
  18. package/lib/api/edu.d.ts +22 -0
  19. package/lib/api/esign.d.ts +33 -0
  20. package/lib/api/exclusive.d.ts +303 -0
  21. package/lib/api/h3yun.d.ts +437 -0
  22. package/lib/api/hrm.d.ts +214 -0
  23. package/lib/api/im.d.ts +772 -0
  24. package/lib/api/industry.d.ts +117 -0
  25. package/lib/api/jzcrm.d.ts +254 -0
  26. package/lib/api/link.d.ts +72 -0
  27. package/lib/api/live.d.ts +131 -0
  28. package/lib/api/microApp.d.ts +239 -0
  29. package/lib/api/oapi.d.ts +3361 -0
  30. package/lib/api/oauth2.d.ts +114 -0
  31. package/lib/api/pedia.d.ts +185 -0
  32. package/lib/api/project.d.ts +1118 -0
  33. package/lib/api/resident.d.ts +106 -0
  34. package/lib/api/robot.d.ts +255 -0
  35. package/lib/api/rooms.d.ts +255 -0
  36. package/lib/api/serviceGroup.d.ts +175 -0
  37. package/lib/api/storage.d.ts +1240 -0
  38. package/lib/api/swform.d.ts +70 -0
  39. package/lib/api/todo.d.ts +168 -0
  40. package/lib/api/wiki.d.ts +194 -0
  41. package/lib/api/workbench.d.ts +45 -0
  42. package/lib/api/yida.d.ts +1837 -0
  43. package/lib/bot.d.ts +30 -0
  44. package/lib/http.d.ts +7 -0
  45. package/lib/index.d.ts +7 -0
  46. package/lib/index.js +1814 -0
  47. package/lib/index.js.map +7 -0
  48. package/lib/internal.d.ts +7 -0
  49. package/lib/message.d.ts +17 -0
  50. package/lib/types/index.d.ts +133 -0
  51. package/lib/utils.d.ts +4 -0
  52. package/lib/ws.d.ts +12 -0
  53. package/package.json +31 -0
@@ -0,0 +1,7 @@
1
+ import { Dict, Quester } from '@satorijs/satori';
2
+ import { DingtalkBot } from './bot';
3
+ export declare class Internal {
4
+ private bot;
5
+ constructor(bot: DingtalkBot);
6
+ static define(routes: Dict<Partial<Record<Quester.Method, Record<string, boolean>>>>): void;
7
+ }
@@ -0,0 +1,17 @@
1
+ import { Dict, h, MessageEncoder } from '@satorijs/satori';
2
+ import { DingtalkBot } from './bot';
3
+ import { SendMessageData } from './types';
4
+ export declare const escape: (val: string) => string;
5
+ export declare const unescape: (val: string) => string;
6
+ export declare class DingtalkMessageEncoder extends MessageEncoder<DingtalkBot> {
7
+ buffer: string;
8
+ /**
9
+ * Markdown: https://open.dingtalk.com/document/isvapp/robot-message-types-and-data-format
10
+ */
11
+ hasRichContent: boolean;
12
+ flush(): Promise<void>;
13
+ sendMessage<T extends keyof SendMessageData>(msgType: T, msgParam: SendMessageData[T]): Promise<void>;
14
+ uploadMedia(attrs: Dict): Promise<any>;
15
+ private listType;
16
+ visit(element: h): Promise<void>;
17
+ }
@@ -0,0 +1,133 @@
1
+ export type AtUser = {
2
+ dingtalkId: string;
3
+ staffId?: string;
4
+ };
5
+ export type DingtalkRequestBase = {
6
+ msgtype: string;
7
+ msgId: string;
8
+ createAt: string;
9
+ conversationType: string;
10
+ conversationId: string;
11
+ conversationTitle?: string;
12
+ senderId: string;
13
+ senderNick: string;
14
+ senderCorpId?: string;
15
+ sessionWebhook: string;
16
+ sessionWebhookExpiredTime: number;
17
+ isAdmin?: boolean;
18
+ chatbotCorpId?: string;
19
+ isInAtList?: boolean;
20
+ senderStaffId?: string;
21
+ chatbotUserId: string;
22
+ atUsers?: AtUser[];
23
+ robotCode: string;
24
+ };
25
+ export type Message = TextMessage | RichTextMessage | PictureMessage | FileMessage;
26
+ export interface TextMessage extends DingtalkRequestBase {
27
+ msgtype: 'text';
28
+ text: {
29
+ content: string;
30
+ };
31
+ }
32
+ export interface FileMessage extends DingtalkRequestBase {
33
+ msgtype: 'file';
34
+ content: {
35
+ spaceId: string;
36
+ fileName: string;
37
+ downloadCode: string;
38
+ fileId: string;
39
+ };
40
+ }
41
+ export interface PictureMessage extends DingtalkRequestBase {
42
+ msgtype: 'picture';
43
+ content: {
44
+ downloadCode: string;
45
+ };
46
+ }
47
+ export interface RichTextMessage extends DingtalkRequestBase {
48
+ msgtype: 'richText';
49
+ content: {
50
+ richText: ({
51
+ text: string;
52
+ } & {
53
+ pictureDownloadCode: string;
54
+ downloadCode: string;
55
+ type: 'picture';
56
+ })[];
57
+ };
58
+ }
59
+ export interface SendMessageData {
60
+ sampleText: {
61
+ content: string;
62
+ };
63
+ sampleMarkdown: {
64
+ title?: string;
65
+ text: string;
66
+ };
67
+ sampleImageMsg: {
68
+ photoURL: string;
69
+ };
70
+ sampleLink: {
71
+ text: string;
72
+ title: string;
73
+ picUrl: string;
74
+ messageUrl: string;
75
+ };
76
+ sampleAudio: {
77
+ mediaId: string;
78
+ duration: string;
79
+ };
80
+ sampleFile: {
81
+ mediaId: string;
82
+ fileName: string;
83
+ fileType: string;
84
+ };
85
+ sampleVideo: {
86
+ duration: string;
87
+ videoMediaId: string;
88
+ videoType: string;
89
+ picMediaId: string;
90
+ };
91
+ }
92
+ export * from '../api/oauth2';
93
+ export * from '../api/oapi';
94
+ export * from '../api/contact';
95
+ export * from '../api/swform';
96
+ export * from '../api/hrm';
97
+ export * from '../api/todo';
98
+ export * from '../api/attendance';
99
+ export * from '../api/calendar';
100
+ export * from '../api/blackboard';
101
+ export * from '../api/microApp';
102
+ export * from '../api/im';
103
+ export * from '../api/connector';
104
+ export * from '../api/exclusive';
105
+ export * from '../api/alitrip';
106
+ export * from '../api/project';
107
+ export * from '../api/edu';
108
+ export * from '../api/crm';
109
+ export * from '../api/yida';
110
+ export * from '../api/drive';
111
+ export * from '../api/workbench';
112
+ export * from '../api/robot';
113
+ export * from '../api/conference';
114
+ export * from '../api/serviceGroup';
115
+ export * from '../api/customerService';
116
+ export * from '../api/esign';
117
+ export * from '../api/jzcrm';
118
+ export * from '../api/badge';
119
+ export * from '../api/datacenter';
120
+ export * from '../api/resident';
121
+ export * from '../api/wiki';
122
+ export * from '../api/storage';
123
+ export * from '../api/doc';
124
+ export * from '../api/diot';
125
+ export * from '../api/h3yun';
126
+ export * from '../api/link';
127
+ export * from '../api/pedia';
128
+ export * from '../api/devicemng';
129
+ export * from '../api/convFile';
130
+ export * from '../api/industry';
131
+ export * from '../api/live';
132
+ export * from '../api/card';
133
+ export * from '../api/rooms';
package/lib/utils.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Session } from '@satorijs/satori';
2
+ import { Message } from './types';
3
+ import { DingtalkBot } from './bot';
4
+ export declare function decodeMessage(bot: DingtalkBot, body: Message): Promise<Session>;
package/lib/ws.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /// <reference types="ws" />
2
+ import { Adapter, Schema } from '@satorijs/satori';
3
+ import { DingtalkBot } from './bot';
4
+ export declare class WsClient extends Adapter.WsClient<DingtalkBot> {
5
+ prepare(): Promise<import("ws").WebSocket>;
6
+ accept(): void;
7
+ }
8
+ export declare namespace WsClient {
9
+ interface Config extends Adapter.WsClient.Config {
10
+ }
11
+ const Config: Schema<Config>;
12
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@satorijs/adapter-dingtalk",
3
+ "description": "Dingtalk Adapter for Satorijs",
4
+ "version": "1.0.0",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib"
9
+ ],
10
+ "author": "LittleC <i@ltlec.com>",
11
+ "license": "MIT",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/satorijs/satori.git",
15
+ "directory": "adapters/dingtalk"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/satorijs/satori/issues"
19
+ },
20
+ "homepage": "https://koishi.chat/plugins/adapter/dingtalk.html",
21
+ "keywords": [
22
+ "bot",
23
+ "dingtalk",
24
+ "adapter",
25
+ "chatbot",
26
+ "satori"
27
+ ],
28
+ "peerDependencies": {
29
+ "@satorijs/satori": "^2.5.3"
30
+ }
31
+ }