mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-25 00:15:26 -04:00
Sync: add support for timestamp on set.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "revolt.js",
|
||||
"version": "4.1.3-alpha.5",
|
||||
"version": "4.1.3-alpha.6",
|
||||
"main": "dist/index.js",
|
||||
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
|
||||
"author": "Paul Makles <insrt.uk>",
|
||||
|
||||
+4
-2
@@ -300,15 +300,17 @@ export class Client extends EventEmitter {
|
||||
/**
|
||||
* Set user settings for current user.
|
||||
* @param data Data to set as an object. Any non-string values will be automatically serialised.
|
||||
* @param timestamp Timestamp to use for the current revision.
|
||||
*/
|
||||
async syncSetSettings(data: { [key: string]: object | string }) {
|
||||
async syncSetSettings(data: { [key: string]: object | string }, timestamp?: number) {
|
||||
let requestData: { [key: string]: string } = {};
|
||||
for (let key of Object.keys(data)) {
|
||||
let value = data[key];
|
||||
requestData[key] = typeof value === 'string' ? value : JSON.stringify(value);
|
||||
}
|
||||
|
||||
await this.req('POST', '/sync/settings/set', requestData);
|
||||
let query = timestamp ? `?timestamp=${timestamp}` : '';
|
||||
await this.req('POST', `/sync/settings/set${query}` as '/sync/settings/set', requestData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
export * from './Client';
|
||||
export { Channel, User, Message } from './api/objects';
|
||||
|
||||
export const LIBRARY_VERSION = '4.1.3-alpha.5';
|
||||
export const LIBRARY_VERSION = '4.1.3-alpha.6';
|
||||
|
||||
export const defaultConfig = {
|
||||
apiURL: 'https://api.revolt.chat',
|
||||
|
||||
Reference in New Issue
Block a user