ncloudchat 0.0.19-beta
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.md +21 -0
- package/README.md +69 -0
- package/esm/CloudChat.d.ts +38 -0
- package/esm/CloudChat.js +592 -0
- package/esm/CloudChat.js.map +1 -0
- package/esm/CoreManager.d.ts +5 -0
- package/esm/CoreManager.js +27 -0
- package/esm/CoreManager.js.map +1 -0
- package/esm/Dispatcher.d.ts +21 -0
- package/esm/Dispatcher.js +78 -0
- package/esm/Dispatcher.js.map +1 -0
- package/esm/Type.d.ts +35 -0
- package/esm/Type.js +12 -0
- package/esm/Type.js.map +1 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +3 -0
- package/esm/index.js.map +1 -0
- package/esm/logger.d.ts +4 -0
- package/esm/logger.js +11 -0
- package/esm/logger.js.map +1 -0
- package/esm/mutations/channel.d.ts +4 -0
- package/esm/mutations/channel.js +162 -0
- package/esm/mutations/channel.js.map +1 -0
- package/esm/mutations/friend.d.ts +5 -0
- package/esm/mutations/friend.js +146 -0
- package/esm/mutations/friend.js.map +1 -0
- package/esm/mutations/index.d.ts +14 -0
- package/esm/mutations/index.js +15 -0
- package/esm/mutations/index.js.map +1 -0
- package/esm/mutations/invite.d.ts +1 -0
- package/esm/mutations/invite.js +71 -0
- package/esm/mutations/invite.js.map +1 -0
- package/esm/mutations/memberinvitation.d.ts +2 -0
- package/esm/mutations/memberinvitation.js +103 -0
- package/esm/mutations/memberinvitation.js.map +1 -0
- package/esm/mutations/memberreport.d.ts +10 -0
- package/esm/mutations/memberreport.js +110 -0
- package/esm/mutations/memberreport.js.map +1 -0
- package/esm/mutations/message.d.ts +2 -0
- package/esm/mutations/message.js +97 -0
- package/esm/mutations/message.js.map +1 -0
- package/esm/mutations/messageread.d.ts +1 -0
- package/esm/mutations/messageread.js +69 -0
- package/esm/mutations/messageread.js.map +1 -0
- package/esm/mutations/subscription.d.ts +4 -0
- package/esm/mutations/subscription.js +139 -0
- package/esm/mutations/subscription.js.map +1 -0
- package/esm/mutations/user.d.ts +1 -0
- package/esm/mutations/user.js +74 -0
- package/esm/mutations/user.js.map +1 -0
- package/esm/queries/channel.d.ts +2 -0
- package/esm/queries/channel.js +119 -0
- package/esm/queries/channel.js.map +1 -0
- package/esm/queries/friend.d.ts +1 -0
- package/esm/queries/friend.js +80 -0
- package/esm/queries/friend.js.map +1 -0
- package/esm/queries/index.d.ts +7 -0
- package/esm/queries/index.js +8 -0
- package/esm/queries/index.js.map +1 -0
- package/esm/queries/memberinvitation.d.ts +2 -0
- package/esm/queries/memberinvitation.js +110 -0
- package/esm/queries/memberinvitation.js.map +1 -0
- package/esm/queries/message.d.ts +2 -0
- package/esm/queries/message.js +117 -0
- package/esm/queries/message.js.map +1 -0
- package/esm/queries/messageread.d.ts +1 -0
- package/esm/queries/messageread.js +74 -0
- package/esm/queries/messageread.js.map +1 -0
- package/esm/queries/project.d.ts +1 -0
- package/esm/queries/project.js +74 -0
- package/esm/queries/project.js.map +1 -0
- package/esm/queries/subscription.d.ts +2 -0
- package/esm/queries/subscription.js +112 -0
- package/esm/queries/subscription.js.map +1 -0
- package/lib/CloudChat.js +1032 -0
- package/lib/CoreManager.js +35 -0
- package/lib/Dispatcher.js +109 -0
- package/lib/Type.js +25 -0
- package/lib/index.js +18 -0
- package/lib/logger.js +27 -0
- package/lib/mutations/channel.js +324 -0
- package/lib/mutations/friend.js +319 -0
- package/lib/mutations/index.js +128 -0
- package/lib/mutations/invite.js +208 -0
- package/lib/mutations/memberinvitation.js +271 -0
- package/lib/mutations/memberreport.js +272 -0
- package/lib/mutations/message.js +246 -0
- package/lib/mutations/messageread.js +215 -0
- package/lib/mutations/subscription.js +299 -0
- package/lib/mutations/user.js +207 -0
- package/lib/queries/channel.js +274 -0
- package/lib/queries/friend.js +220 -0
- package/lib/queries/index.js +102 -0
- package/lib/queries/memberinvitation.js +273 -0
- package/lib/queries/message.js +267 -0
- package/lib/queries/messageread.js +219 -0
- package/lib/queries/project.js +217 -0
- package/lib/queries/subscription.js +264 -0
- package/ncloudchat_javascript.md +290 -0
- package/package copy.json +74 -0
- package/package.json +76 -0
- package/tsconfig.json +31 -0
- package/types/exif.d.ts +10 -0
- package/types/window.d.ts +5 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 HEROPY <thesecon@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# cloudchat-sdk-javascript
|
|
2
|
+
|
|
3
|
+
엔클라우드챗 대시보드에 접속하여 프로젝트 아이디를 확인해 주십시오.
|
|
4
|
+
인스턴스를 초기화하려면 아래 코드를 사용해 주십시오.
|
|
5
|
+
|
|
6
|
+
## 초기화 하고 프로젝트ID 를 입력해 주세요.
|
|
7
|
+
``javascript
|
|
8
|
+
const client = new cloudchat.Chat();
|
|
9
|
+
client.initialize(projectId);
|
|
10
|
+
|
|
11
|
+
## 현재 사용자를 설정하고 접속을 시도합니다.
|
|
12
|
+
``javascript
|
|
13
|
+
client.setUser({
|
|
14
|
+
id: [user_id],
|
|
15
|
+
name: [nickname],
|
|
16
|
+
profile: '[url]'
|
|
17
|
+
});
|
|
18
|
+
await client.connect(user_id);
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## 접속해제
|
|
22
|
+
``javascript
|
|
23
|
+
await client.disconnect();
|
|
24
|
+
|
|
25
|
+
## 채널
|
|
26
|
+
``javascript
|
|
27
|
+
await client.subscribe(CHANNEL_ID);
|
|
28
|
+
await client.unsubscribe(CHANNEL_ID);
|
|
29
|
+
|
|
30
|
+
## 메시지
|
|
31
|
+
``javascript
|
|
32
|
+
const text = 'You completed your trip';
|
|
33
|
+
|
|
34
|
+
const message = {
|
|
35
|
+
text,
|
|
36
|
+
attachments: [{type:'trip', ...tripData}]
|
|
37
|
+
};
|
|
38
|
+
await channel.sendMessage(message);
|
|
39
|
+
|
|
40
|
+
## 파일 업로드
|
|
41
|
+
const files = event.target.files;
|
|
42
|
+
const response = await client.sendImage(CHANNEL_ID,files[0]);
|
|
43
|
+
|
|
44
|
+
### 이미지
|
|
45
|
+
image types are: image/bmp, image/gif, image/jpeg, image/png, image/webp, image/heic, image/heic-sequence, image/heif, image/heif-sequence, image/svg+xml.
|
|
46
|
+
You can set a more restrictive list for your application if needed.
|
|
47
|
+
The maximum file size is 100MB.
|
|
48
|
+
|
|
49
|
+
### 파일
|
|
50
|
+
will not block any file types from uploading, however, different clients may handle different types differently or not at all.
|
|
51
|
+
You can set a more restrictive list for your application if needed.
|
|
52
|
+
The maximum file size is 100MB.
|
|
53
|
+
|
|
54
|
+
## 이벤트
|
|
55
|
+
``javascript
|
|
56
|
+
|
|
57
|
+
수신되는 이벤트에 대해, 이벤트 핸들러를 등록하거나 해제하려면 아래 코드를 사용해 주십시오.
|
|
58
|
+
client.bind('onMessageReceived',function(channel, message) {
|
|
59
|
+
});
|
|
60
|
+
client.bind('onErrorReceived',function(error) {
|
|
61
|
+
});
|
|
62
|
+
client.bind('onResult',function(message) {
|
|
63
|
+
});
|
|
64
|
+
client.bind('onConnected',async function(channel, message) {
|
|
65
|
+
});
|
|
66
|
+
client.bind('onDisconnected',function(reason) {
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
## 마무리
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ChannelInput, MarkInput } from "./Type";
|
|
2
|
+
export default class NCloudChat {
|
|
3
|
+
private dp;
|
|
4
|
+
private socket;
|
|
5
|
+
private connected;
|
|
6
|
+
private connectedCount;
|
|
7
|
+
constructor();
|
|
8
|
+
clear(): void;
|
|
9
|
+
initialize(projectId: string): void;
|
|
10
|
+
getLang(): string;
|
|
11
|
+
getUser(): any;
|
|
12
|
+
setServerUrl(url: string): void;
|
|
13
|
+
setSocketUrl(url: string): void;
|
|
14
|
+
setProjectId(projectId: string): void;
|
|
15
|
+
setUser(user: any): void;
|
|
16
|
+
connect(user_id: string, callback: any): Promise<any>;
|
|
17
|
+
subscribe(channel: string, language?: string): Promise<any>;
|
|
18
|
+
unsubscribe(channel: string): Promise<any>;
|
|
19
|
+
translateMessage(source: string, target: string, message: string): Promise<void | null>;
|
|
20
|
+
sendMessage(channel: string, opt: any): Promise<any>;
|
|
21
|
+
sendImage(channel: string, file: any): Promise<void>;
|
|
22
|
+
updateMessage(channel: string, message_id: string, message: string): Promise<void>;
|
|
23
|
+
deleteMessage(channel: string, message_id: string): Promise<void>;
|
|
24
|
+
disconnect(): Promise<void>;
|
|
25
|
+
isConnected(): boolean;
|
|
26
|
+
bind(id: string, fn: any): Promise<void>;
|
|
27
|
+
unbind(id: string, fn: any): Promise<void>;
|
|
28
|
+
unbindall(id: string): Promise<void>;
|
|
29
|
+
ObjectId(id: string): string;
|
|
30
|
+
getChannels(filter: any, sort?: any, option?: any): Promise<any>;
|
|
31
|
+
getChannel(channelId: string): Promise<any>;
|
|
32
|
+
getMessage(channelId: string, messageId: string): Promise<any>;
|
|
33
|
+
getMessages(filter: any, sort: any, option: any): Promise<any>;
|
|
34
|
+
getSubscriptions(filter: any, sort: any, option: any): Promise<any>;
|
|
35
|
+
createChannel(channel: ChannelInput): Promise<any>;
|
|
36
|
+
deleteChannel(channelId: string): Promise<any>;
|
|
37
|
+
markRead(channelId: string, mark: MarkInput): Promise<any>;
|
|
38
|
+
}
|