1.0.26 • Published 2 years ago

@amurse/chat_sdk v1.0.26

Weekly downloads
-
License
ISC
Repository
github
Last release
2 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

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago