1.0.26 • Published 3 years ago

@amurse/chat_sdk v1.0.26

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Chat SDK for Amurse

Different functions to access chat API

getConversation(data, errorHandler)

data: {receiverAddress, address} returns a conversation or null

getConversations(data, errorHandler);

data: {address} returns an array of conversations for the given address

getMessages(data, errorHandler)

data: {convoId} returns an array of messages for conversation

createMessage(data, errorHandler);

data: {text, address, convoId, convoIndex} returns true if message created

Setting UP

The SDK is a class which exposes the above functions. It must be initialized through a constructor requiring 2 things: 1. accessToken 2. walletSignature

Code Example

yarn add '@amurse/chat_sdk';

import {amurseChatSDK} from '@amurse/chat_sdk';

let chatSDK;

//could be called from other files
export const initializeChatSDK = ({accessToken, walletSignature}) => {
  chatSDK = new amurseChatSDK({accessToken, walletSignature});
}
initializeChatSDK({accessToken: receiverToken, walletSignature: user.signature});

const data = {address: user.address}
let convos = await chatSDK.getConversations(data, handleError);

console.log(convos)
1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago