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.

37 lines
1.3 KiB

  1. export namespace JsonAPI {
  2. export let principleName: string = localStorage.getItem("username") || "";
  3. export let contactName: string = "";
  4. export let authToken: string = localStorage.getItem("authToken") || "";
  5. export const ACTIVE_USERS_GET = `/api/chat/get/active-users`;
  6. /**
  7. * Json API URL for retrieving all messages between two users
  8. *
  9. * ### With sprintf
  10. * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName);
  11. *
  12. * @format /api/chat/get/messages/{contactName}
  13. * @example /api/chat/get/messages/some-user
  14. *
  15. *
  16. * @param contactName
  17. * The user whose messages we wish to retrieve.
  18. */
  19. export const CHAT_MESSAGES_GET = `/api/chat/get/messages/%s`;
  20. export const MESSAGE_POST = "/api/chat/post/message";
  21. /**
  22. * Json API URL for retrieving paginated messages between two users
  23. * Page index starts with 0
  24. *
  25. * ### With sprintf
  26. * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName);
  27. *
  28. * @example /api/chat/get/messages/some-user?page=0&size=5 will give the first page where each page has size 5
  29. *
  30. *
  31. *
  32. * @param contactName the user whose messages we wish to retrieve
  33. * @param page denotes the page required
  34. * @param size denotes the size of each page
  35. */
  36. export const CHAT_MESSAGE_PAGE_GET = `/api/chat/get/messages/%s?page=%d&size=%d`;
  37. }