export namespace JsonAPI { export let principleName: string = localStorage.getItem("username") || ""; export let contactName: string = ""; export let authToken: string = localStorage.getItem("authToken") || ""; export const CHAT_PAGE_SIZE: number = parseInt(localStorage.getItem("CHAT_PAGE_SIZE") || "9") || 9; export const ACTIVE_USERS_GET = `/api/chat/get/active-users`; /** * Json API URL for retrieving all messages between two users * * ### With sprintf * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName); * * @format /api/chat/get/messages/{contactName} * @example /api/chat/get/messages/some-user * * * @param contactName * The user whose messages we wish to retrieve. */ export const CHAT_MESSAGES_GET = `/api/chat/get/messages/%s`; export const MESSAGE_POST = "/api/chat/post/message"; /** * Json API URL for retrieving paginated messages between two users * Page index starts with 0 * * ### With sprintf * const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName); * * @example /api/chat/get/messages/some-user?page=0&size=5 will give the first page where each page has size 5 * * * * @param contactName the user whose messages we wish to retrieve * @param page denotes the page required * @param size denotes the size of each page */ export const CHAT_MESSAGE_PAGE_GET = `/api/chat/get/messages/%s?page=%d&size=%d`; }