0.11.0 • Published 6 years ago

swagchat-sdk v0.11.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

MIT License npm version

swagchat SDK(TypeScript & JavaScript)

swagchat is an open source chat components for your webapps.

This is SDK for Chat API

Architecture

Architecture

Related repositories

Installation

CDN

<script src="https://unpkg.com/swagchat-sdk/dist/swagchat-sdk.min.js"></script>

npm

npm install --save swagchat-sdk

Please use TypeScript for development, but you do not need to install @types/swagchat-sdk.

Type definitions are included in this repository.

Usage

Browser

<script src="https://unpkg.com/swagchat-sdk/dist/swagchat-sdk.min.js"></script>
<script >
// Initialize client.
var sc = new SwagChat.Client({
  apiKey: "API_KEY",
  apiSecret: "API_SECRET",
  apiEndpoint: "http://localhost:9000/v0",
  realtime: {
    endpoint: "ws://localhost:9100/v0"
  }
});

// Create user.
sc.createUser({
  name: "USER_NAME",
}).then(function(res) {
  if (res.error) {
    console.log(res.error);
  } else {
    console.log(res.user);
  }
})
</script>

Node

import { Client } from "swagchat-sdk";

// Initialize client.
const sc = new Client({
  apiKey: "API_KEY",
  apiSecret: "API_SECRET",
  apiEndpoint: "http://localhost:9000/v0",
  realtime: {
    endpoint: "ws://localhost:9100/v0"
  }
});

// Create user.
sc.createUser({
  name: "USER_NAME",
}).then(function(res) {
  if (res.error) {
    console.log(res.error);
  } else {
    console.log(res.user);
  }
})

Document

Open doc/index.html in browser.

Generated using TypeDoc

License

MIT License.

0.11.0

6 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.0

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago