diff --git a/docs/api/cozy-stack-client.md b/docs/api/cozy-stack-client.md index 548f41d93..0ea3bd8a3 100644 --- a/docs/api/cozy-stack-client.md +++ b/docs/api/cozy-stack-client.md @@ -1827,6 +1827,7 @@ Implements `DocumentCollection` API to interact with the /settings endpoint of t * [SettingsCollection](#SettingsCollection) * [.get(id)](#SettingsCollection+get) ⇒ object * [.update(document)](#SettingsCollection+update) + * [.updateLastSynced()](#SettingsCollection+updateLastSynced) @@ -1851,6 +1852,12 @@ Updates a settings document | --- | --- | --- | | document | object | Document to update. Do not forget the _id attribute | + + +### settingsCollection.updateLastSynced() +Updates the current OAuth client's last synchronization date + +**Kind**: instance method of [SettingsCollection](#SettingsCollection) ## SharingCollection diff --git a/packages/cozy-stack-client/src/SettingsCollection.js b/packages/cozy-stack-client/src/SettingsCollection.js index 006429f32..93735ceb5 100644 --- a/packages/cozy-stack-client/src/SettingsCollection.js +++ b/packages/cozy-stack-client/src/SettingsCollection.js @@ -87,6 +87,13 @@ class SettingsCollection extends DocumentCollection { data: normalizeSettings(resp.data) } } + + /** + * Updates the current OAuth client's last synchronization date + */ + async updateLastSynced() { + return this.stackClient.fetchJSON('POST', '/settings/synchronized') + } } SettingsCollection.normalizeDoctype = normalizeDoctypeJsonApi