1.0.2 • Published 9 months ago
oneable-collaboration-sdk v1.0.2
oneable-collaboration-Sdk
The information about collaboration api's can be found below
init:
SDK initialization
init(token: string, host: string);
Parameters
token: An access token retrieved using the authentication APIs of the platform.
host: API Domain
Return
void
Example
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.init("0447ee5c-3cd4-4835-bb4a-1b134e7c8517", "http://localhost:8088");
WorkSpace:
Workspace made up of channels, where team members can communicate and work together.
Create:
Creating workspace
create(create: ICreate, success: CallBackFunction, error: CallBackFunction);`
Parameters
create: ICreate;
success: CallBackFunction;
error: CallBackFunction;
Returns:
subscription: IWorkSpaceSubscription;
error: string
Example
import oneAbleCollaboration from 'dist\collaboration';
const create = {workSpaceName: 'test'};
oneAbleCollaboration.workSpace.create(create, success, error);
Get:
Get Created Workspaces
get(read: IRead, success: CallBackFunction, error: CallBackFunction)
Parameters:
create: IRead;
success: CallBackFunction;
error: CallBackFunction;
Returns:
pageSupport: PageSupport<IWorkSpace>;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const read = {page: 0, size: 10};
oneAbleCollaboration.workSpace.get(read, success, error);
Update:
Update the existing workspace
update(update: IUpdate, success: CallBackFunction, error: CallBackFunction);
Parameters:
update: IUpdate;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const update = {workSpaceName: "test", workSpaceId: ""};
oneAbleCollaboration.workSpace.update(update, success, error);
Delete:
Delete the existing workspace
delete(delete: IDelete, success: CallBackFunction, error: CallBackFunction);
Parameters:
delete: IDelete;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const delete = {workSpaceId: "123rfew"};
oneAbleCollaboration.workSpace.delete(delete, success, error);
WorkSpace Subscriptions:
User Workspace Subscriptions
Get:
Get user subscribed Workspaces
get(read: IRead, success: CallBackFunction, error: CallBackFunction);
Parameters:
read: IRead;
success: CallBackFunction;
error: CallBackFunction;
Returns:
pageSupport: PageSupport<IWorkSpaceResponse>;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const read = {page: 0, size: 10};
oneAbleCollaboration.workSpace.subscriptions.get(read, success, error);
Get Subscribers:
Get list of users subscribed to specific workspace
getSubscribers(request: ISubscriptionSelf, success: CallBackFunction, error: CallBackFunction)
Parameters:
request: ISubscriptionSelf;
success: CallBackFunction;
error: CallBackFunction;
Returns:
subscribers: List<IWorkSpaceSubscription>;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const self = {workSpaceId: '12321test};
oneAbleCollaboration.workSpace.subscriptions.getSubscribers(self, success, error);
Activate:
Workspace owner activates user subscription
activate(request: ISubscriptionRequest, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionRequest;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123", userIds: ["user1234", "user2123", "user3123"] };
oneAbleCollaboration.workSpace.subscriptions.activate(request, success, error);
De-Activate
Workspace owner removing user from the workspace.
deActivate(request: ISubscriptionRequest, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionRequest;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123", userIds: ["user1234", "user2123", "user3123"] };
oneAbleCollaboration.workSpace.subscriptions.deActivate(request, success, error);
Un-Subscribe:
User is unsubscribing from workspace.
unSubscribe(request: ISubscriptionSelf, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionSelf;
success: CallBackFunction;
error: CallBackFunction;
Returs:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123" };
oneAbleCollaboration.workSpace.subscriptions.unSubscribe(request, success, error);
Workspace Invitation:
Workspace invitations
Send:
Owner can invite users into the workspace
send(request: IInvitation, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IInvitation;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123", userIds: ["user1234", "user2123", "user3123"] };
oneAbleCollaboration.workSpace.invitation.send(request, success, error);
Accept:
accept workspace invitation.
accept(key: string, success: CallBackFunction, error: CallBackFunction);
Parameters:
key: string;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.workSpace.invitation.accept("dummy-key", success, error);
Reject:
reject workspace invitation.
reject(key: string, success: CallBackFunction, error: CallBackFunction);
Parameters:
key: string;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.workSpace.invitation.reject("dummy-key", success, error);
Room:
Offers many IRC-style features, including persistent chat rooms organized by topic, private groups, and direct messaging.
Create Direct:
Create Direct Room between 2 users.
createDirect(request: IDirect, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IDirect;
success: CallBackFunction;
error: CallBackFunction;
Returns:
subscription[]: ISubscription;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", userIds: ["user1323"]}
oneAbleCollaboration.room.createDirect(request, success, error);
Create Group:
Create a private group.
createGroup(request: ICreate, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ICreate;
success: CallBackFunction;
error: CallBackFunction;
Returns:
subscription[]: ISubscription;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", roomName: "test Group"}
oneAbleCollaboration.room.createGroup(request, success, error);
Create Channel:
Create a public channel.
createChannel(request: ICreate, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ICreate;
success: CallBackFunction;
error: CallBackFunction;
Returns:
subscription[]: ISubscription;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", roomName: "test channel"}
oneAbleCollaboration.room.createChannel(request, success, error);
Get:
get created channels
get(request: IRead, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IRead;
success: CallBackFunction;
error: CallBackFunction;
Returns:
pageSupport: PageSupport<IRoom>;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", page: 0, size: 10}
oneAbleCollaboration.room.get(request, success, error);
Update:
Room owner can update.
update(request: IUpdate, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IUpdate;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", roomName: "test room", roomId: "134e3423"}
oneAbleCollaboration.room.update(request, success, error);
Delete:
Room owner can delete.
update(request: IDelete, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IDelete;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", roomName: "test room", roomId: "134e3423"}
oneAbleCollaboration.room.delete(request, success, error);
Room Subscriptons:
User subscribed Rooms.
Get:
get user subscribed/joined rooms.
get(read: IRead, success: CallBackFunction, error: CallBackFunction);
Parameters:
workSpaceId: string;
page: number;
size: number;
Returns:
channelResponse[]: IChannelResponse;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "3efdsw34r", page: 0, size: 10};
oneAbleCollaboration.room.subscriptions.get(request, success, error);
Activate:
Room owner activates user subscription
activate(request: ISubscriptionRequest, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionRequest;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123", userIds: ["user1234", "user2123", "user3123"] , roomId: "12wwqw3ef"};
oneAbleCollaboration.room.subscriptions.activate(request, success, error);
De-Activate
Room owner can remove user from the room.
deActivate(request: ISubscriptionRequest, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionRequest;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123", userIds: ["user1234", "user2123", "user3123"], roomId: "12weawer" };
oneAbleCollaboration.room.subscriptions.deActivate(request, success, error);
Subscribe:
User can subscribe only for public channel.
subscribe(request: ISubscriptionSelf, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionSelf;
success: CallBackFunction;
error: CallBackFunction;
Returs:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123" , roomId: "123eerf3"};
oneAbleCollaboration.room.subscriptions.subscribe(request, success, error);
Un-Subscribe:
User is unsubscribing from private group/channel.
unSubscribe(request: ISubscriptionSelf, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: ISubscriptionSelf;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: string;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
const request = {workSpaceId: "test123" , roomId: "123eerf3"};
oneAbleCollaboration.room.subscriptions.unSubscribe(request, success, error);
Search:
Search within user subscribed/created worksapce/rooms/messages
search(keyWord: string, success: CallBackFunction, error: CallBackFunction);
Parameters:
keyWord: string;
success: CallBackFunction;
error: CallBackFunction;
Returns:
search[]: ISearch;
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.collaborationSearch.search("tes", success, error);
Message:
User can send/receive messages from subscribed rooms/channels.
send:
Send message to subscribed room/channel.
send(body: IMessageRequest, success: CallBackFunction, error: CallBackFunction);
Parameters:
body: IMessageRequest;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: IMessage
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.message.send({roomId: 'test123', message:'test message'}, success, error);
get:
Read message from subscribed room/channel.
get(request: IRead, success: CallBackFunction, error: CallBackFunction);
Parameters:
request: IRead;
success: CallBackFunction;
error: CallBackFunction;
Returns:
response: [IMessage]
error: string;
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.message.get({roomId: 'test123', page: 0, size: 10}, success, error);
Socket:
Oneable socket between client and server
Connect:
Establish a socket connection between client and server
connect(configuration: Configuration, stateChange: CallBackFunction, error: CallBackFunction);
Parameters:
configuration: Configuration;
stateChange: CallBackFunction;
error: CallBackFunction;
Returns:
void
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.socket.connect({reconnectDelay: 4000, heartbeatIncoming: 4000,heartbeatOutgoing: 4000}, stateChange, error);
Disconnect:
Disconnect from socket server
disconnect();
Returns:
void
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.socket.disconnect();
Subscribe:
Subscribes to room/channel
subscribe(roomId: string, onMessage: CallBackFunction);
Parameters:
roomId: string;
onMessage: CallBackFunction;
Returns:
void
Example:
import oneAbleCollaboration from 'dist\collaboration';
oneAbleCollaboration.socket.subscribe('test room 123', (message) => {
console.log(message);
});
Interfaces:
WorkSpace:
ICreate:
workSpaceName: string
IUpdate:
workSpaceName: string;
workSpaceId: string;
IDelete:
workSpaceId: string;
IRead:
page: number;
size: number;
ISubscriptionRequest:
workSpaceId: string;
userIds: [string];
ISubscriptionSelf:
workSpaceId: string;
IWorkSpace:
organizationId: string;
name: string;
active: boolean;
userSubscription: UserSubscription;
IWorkSpaceSubscription:
workSpaceId: string;
userSubscription: UserSubscription;
organizationId: string;
status: string;
IWorkSpaceResponse:
id: string;
userSubscription: UserSubscription;
name: string;
workSpaceId: string;
status: string;
Room:
IDirect:
workSpaceId: string;
userIds: [string];
ICreate:
roomName: string;
workSpaceId: string;
IUpdate:
roomName: string;
roomId: string;
workSpaceId: string;
IDelete:
roomId: string;
workSpaceId: string;
IRead:
workSpaceId: string;
page: number;
size: number;
ISubscriptionRequest:
workSpaceId: string;
userIds: [string];
roomId: string;
ISubscriptionSelf:
workSpaceId: string;
roomId: string;
IRoom:
roomType: string;
workspaceId: string;
name: string;
userSubscription: UserSubscription;
lastMessageTimeStamp: Date;
messageCounter: number;
active: boolean;
IChannelResponse:
id: string;
roomType: string;
userSubscription: UserSubscription;
name: string;
ISubscription:
roomType: string;
lastSeenTimeStamp: string;
roomName: string; // Target username if roomType: Direct
roomId: string;
organizationId: string;
userSubscription: UserSubscription;
workspaceId: string;
status: string;
isFavourite: boolean;
hasUnReadMessages: boolean;
unreadCount: number;
Message:
IMessageRequest:
roomId: string;
message: string;
IMessage:
roomId: string;
message: string;
user: User;
messageTimeStamp: string;
IRead:
page: number;
size: number;
roomId: string;
Invitation:
IInvitation:
workSpaceId: string;
userIds: [string];
User:
UserSubscription:
userId: string;
name: string;
owner: boolean;
Search:
ISearch:
id: string;
name: string;
userSubscription: UserSubscription;
type: string;
Others:
CallBackFunction:
(data: any): any;
Configuration:
reconnectDelay: number;
heartbeatIncoming: number;
heartbeatOutgoing: number;
PageSupport<T>:
content: [T];
pageNumber: number;
pageSize: number;