1.0.6 • Published 5 years ago

dhl-core v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

dhl-core

Create your DHL(Dui Hua Liu) services on Web.

📦 Install

npm install dhl-core --save
yarn add dhl-core
<script src="https://dhl-sdk.oss-cn-beijing.aliyuncs.com/web_sdk/1.0.0/dhl.js"></script>

🔨 Usage

from node_modules

import { DHL } from 'dhl-core';

const client = new DHL({
  agentId: '<your agent id>',
  agentName: '<your agent name>'
});

from CDN

<script src="https://dhl-sdk.oss-cn-beijing.aliyuncs.com/web_sdk/1.0.0/dhl.js"></script>
<script>
  var client = new DHL({
    agentId: '<your agent id>',
    agentName: '<your agent name>'
  });
</script>

🌈 Methods

  • async verify(app: DHLAppInfo, callback?: (token: string) => void);
  Get authentication token.
interface DHLAppInfo {
  appId: string;
  appKey: string;
  appSecret: string;
}
  • connectWebsocket(params: DHLConnectParams, onMessage: (message: string, messageType: string, res: any) => void, onOpen?: () => void, onClose?: () => void, onError?: (error: any) => void)
  Connect Websocket and listen messages from server.
interface DHLConnectParams {
  userId: string;
  isCustomerService: boolean;
  userName?: string;
}
  • send(params: SendMessageParamsInfo, callback: (message: string, messageType: string, res: any) => void)
  Send messages.
interface SendMessageParamsInfo {
  message: string;
  messageContentType: dhlmixer.MessageContentType;
  forceHandleManually: boolean;
}
  • uploadImage(file: any, callback: (res: any) => void)

    Upload an image and get the URI

✨ Features

  • Written in TypeScript with complete define types

License

MIT License.

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago