A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.5 KiB

  1. export namespace JsonAPI {
  2. // @ts-ignore: Cannot find name 'hostAddress'.
  3. export let principleName: string | null = localStorage.getItem('username');
  4. export let contactName: string | null;
  5. export let authToken: string | null = localStorage.getItem('authToken');
  6. export const ACTIVE_USERS_GET = `/api/chat/get/active-users`;
  7. /**
  8. * Json API URL for retrieving all messages between two users
  9. *
  10. * @format /api/chat/get/messages/some-user
  11. *
  12. * ### With sprintf
  13. * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, toUser);
  14. *
  15. * @param toUser
  16. * The user whose messages wish to retrieve. The 'from user' part of the message is given by the current user logged in.
  17. * /api/chat/get/messages/{toUser}
  18. *
  19. */
  20. export const CHAT_MESSAGES_GET = `/api/chat/get/messages/%s`;
  21. export const MESSAGE_POST = '/api/chat/post/message';
  22. /**
  23. * Json API URL for retrieving paginated messages between two users
  24. *
  25. * @format /api/chat/get/messages/some-user?page=1&size=5 will give the first page with size 5
  26. *
  27. * ### With sprintf
  28. * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, toUser);
  29. *
  30. * @param toUser The user whose messages wish to retrieve. The 'from user' part of the message is given by the current user logged in.
  31. * @param page Denotes the page required
  32. * @param denotes the size of each page
  33. */
  34. export const CHAT_MESSAGE_PAGE_GET = `/api/chat/get/messages/%s?page=%d&size=%d`;
  35. }