1.1.166 • Published 3 years ago

lifemate-sdk v1.1.166

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

lifemate-sdk

###Every thing you need to create a professional live app

MasterUserSocket is the owner of the page , like manager of a company . this kind of user can manage the total politics of the app.

ApiUserSocket acts as a middleware between clients and our servers . this socket which will handle the server to server tasks.

ClientUserSocket is the socket which will handle the third party clients

after initializing the instance of lifemate :

LifeMateSession.initialize({  
    onRequestError: console.log,
    onRequestSuccessful: () => {},
    onRequestInitiating: () => {}
});

let's say your clients need to create a chat room , here is the procedure:

  1. client user will ask api user to create a chat room
const clientSocket = new ClientUserSocket({
  onDirectEmit: () => {

  },
  onDirectRequest: (senderUserId, packet) => {
    
  }
});

clientSocket.requestDirect(apiUserId,{
    type: 'create-room',
    data: 'any kind of data'
})
  1. api user received the packet and after applying page rules , will request the lifemate server to create a chat room
const apiSocket = new ApiUserSocket({
  ...
  onDirectRequest: async (senderUserId: string,packet: Packet) => {
       if(packet.type === 'create-room'){
           ...
          // custom pageId codes
          ...
          const room = await ClientService.chatRoomsApi().createChatRoom(pageId, 'my beloved room', ChatRoomType.DUO, { chat: true, fileTypes: [FileType.image, FileType.voice], videoCall: true, voiceCall: false }, {}, [senderUserId, 'anotherUserId']);
          return room;
       }
  }
});

just like that

Access Control

MethodMasterUserApiUserClientUser
CRUD api user
CRUD client user
CRUD chat rooms
CRUD chat room members
send chat message
send chat event
send chat file
create/delete conference room
enable/disable plugin

API Calls

POST /auth/signin

body:{
    // mobile or email or username
    mobileOrEmailOrUsername: string,
    // required of the other field is username otherwise pass empty string. if the request does not include username ,an otp will  be sent to the provided email or mobile number
    password: string
}

POST /auth/signin/otp

request:

body:{
    otp: string
}

response:

body:{
    user: User
}

headers:{
    set-cookie: [{authorization: jwt}]
}

POST /users/api-user

request:

body:{
    username,
    password, 
    name, 
    data  
}

headers:{
    authorization: string,
    pageId: string
}

response:

body:{
    credential: any,
    jwt: string    
}

POST /users/client-user

body:{
    credential: any,
    jwt: string    
}

headers:{
    authorization: string,
    pageId: string
}

PATCH /users/state

body:{
    data: any
}

headers:{
    authorization: string,
    pageId: string,
    targetUserId: string
}
1.1.166

3 years ago

1.1.165

3 years ago

1.1.164

3 years ago

1.1.163

3 years ago

1.1.162

3 years ago

1.1.161

3 years ago

1.1.160

3 years ago

1.1.159

3 years ago

1.1.158

3 years ago

1.1.157

3 years ago

1.1.156

3 years ago

1.1.155

3 years ago

1.1.154

3 years ago

1.1.153

3 years ago

1.1.152

3 years ago

1.1.151

3 years ago

1.1.150

3 years ago

1.1.149

3 years ago

1.1.148

3 years ago

1.1.147

3 years ago

1.1.146

3 years ago

1.1.144

3 years ago

1.1.143

3 years ago

1.1.142

3 years ago

1.1.145

3 years ago

1.1.141

3 years ago

1.1.140

3 years ago

1.1.139

3 years ago

1.1.138

3 years ago

1.1.137

3 years ago

1.1.136

3 years ago

1.1.135

3 years ago

1.1.129

3 years ago

1.1.128

3 years ago

1.1.133

3 years ago

1.1.132

3 years ago

1.1.131

3 years ago

1.1.130

3 years ago

1.1.134

3 years ago

1.1.127

3 years ago

1.1.126

3 years ago

1.1.125

3 years ago

1.1.124

3 years ago

1.1.123

3 years ago

1.1.122

3 years ago

1.1.121

3 years ago

1.1.111

3 years ago

1.1.120

3 years ago

1.1.119

3 years ago

1.1.118

3 years ago

1.1.117

3 years ago

1.1.116

3 years ago

1.1.115

3 years ago

1.1.114

3 years ago

1.1.113

3 years ago

1.1.112

3 years ago

1.1.109

3 years ago

1.1.110

3 years ago

1.1.108

3 years ago

1.1.107

3 years ago

1.1.106

3 years ago

1.1.105

3 years ago

1.1.104

3 years ago

1.1.103

3 years ago

1.1.102

3 years ago

1.1.101

3 years ago

1.1.1

3 years ago