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.4 KiB
35 lines
1.4 KiB
export namespace JsonAPI {
|
|
// @ts-ignore: Cannot find name 'hostAddress'.
|
|
export let principleName: string | null = localStorage.getItem('username');
|
|
export let contactName: string | null;
|
|
export let authToken: string | null = localStorage.getItem('authToken');
|
|
export const ACTIVE_USERS_GET = `/api/chat/get/active-users`;
|
|
/**
|
|
* Json API URL for retrieving all messages between two users
|
|
*
|
|
* @format /api/chat/get/messages/{contactName}
|
|
* @example /api/chat/get/messages/some-user
|
|
*
|
|
* ### With sprintf
|
|
* const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName);
|
|
*
|
|
* @param contactName
|
|
* The user whose messages 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
|
|
* @example /api/chat/get/messages/some-user?page=0&size=5 will give the first page where each page has size 5
|
|
*
|
|
* ### With sprintf
|
|
* const url = Sprintf(JsonAPI.CHAT_MESSAGES_GET, contactName);
|
|
*
|
|
* @param contactName the user whose messages 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`;
|
|
|
|
}
|