Skip to content

Latest commit

 

History

History
271 lines (202 loc) · 3.92 KB

README.MD

File metadata and controls

271 lines (202 loc) · 3.92 KB

Receptor

Real-time messaging app. Available as a web, MacOS, Linux, and Windows application.

Logo

group_chat friends

See more?

receptor-chat receptor-chat receptor-chat receptor-chat

Schema

Events

// Websocket events
enum Event {
  Connect = "connect",
  Disconnect = "disconnect",
  AddFriend = "addFriend",
  AcceptFriend = "acceptFriend",
  RemoveFriend = "removeFriend",
  Notification = "notification",
  Login = "login",
  Logout = "logout",
  GetUser = "getUser",
  JoinRoom = "joinRoom",
  LeaveRoom = "leaveRoom",
  RoomMessage = "sendRoomMsg",
  UpdateUser = "updateUser",
}

API

For full API documentation try import this postman collection

Register - POST /api/v1/user/register

Reqeust

type Body = {
  username: string;
  email: string;
  password: string;
};

Response

type Response = {
  userId: number;
};
Login - POST /api/v1/user/login

Reqeust

type Body = {
  email: string;
  password: string;
};

Response

type Response = {
  user: User;
  token: string;
};
Get users - GET /api/v1/user

Reqeust

Query Param. Description Type Default
q Search by email and username string Empty string
page Number of the current page number 1
limit Number of items per response number 10

Response

type Reponse = {
  users: Array<User>;
  count: number;
};
Get friends - GET /api/v1/user/friends

Reqeust

Access only by authorized users

type Headers = {
  authorization: string; // Bearer auth token
};

Response

type Reponse = Array<User & { roomId: number }>;
Get room messages - GET /api/v1/room/:roomId

Reqeust

Access only by authorized users

type Headers = {
  authorization: string; // Bearer auth token
};

Response

type Reponse = Array<Message & { user: User }>;
Get user groups - GET /api/v1/group

Reqeust

Access only by authorized users

type Headers = {
  authorization: string; // Bearer auth token
};

Response

type Reponse = Array<{
  id: number;
  name: string;
  type: string;
  createdAt: Date;
  updatedAt: Data;
  participants: Array<User>;
}>;
Create new group- POST /api/v1/group

Reqeust

type Body = {
  groupName: string;
  userIds: number[];
};

Response

type Reponse = {
  roomId: number;
};
Delete group - DELETE /api/v1/group/:groupId - Owner only

Reqeust

Access only by authorized users

type Headers = {
  authorization: string; // Bearer auth token
};

Response

type Reponse = {
  roomId: number;
};
Leave group - DELETE /api/v1/group/:groupId/leave

Reqeust

Access only by authorized users

type Headers = {
  authorization: string; // Bearer auth token
};

Response

type Reponse = {
  roomId: number;
};