Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add OAuth client last synced datetime update #1584

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docs/api/cozy-stack-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ Implements `DocumentCollection` API to interact with the /settings endpoint of t
* [SettingsCollection](#SettingsCollection)
* [.get(id)](#SettingsCollection+get) ⇒ <code>object</code>
* [.update(document)](#SettingsCollection+update)
* [.updateLastSynced()](#SettingsCollection+updateLastSynced)

<a name="SettingsCollection+get"></a>

Expand All @@ -1682,6 +1683,12 @@ Updates a settings document
| --- | --- | --- |
| document | <code>object</code> | Document to update. Do not forget the _id attribute |

<a name="SettingsCollection+updateLastSynced"></a>

### settingsCollection.updateLastSynced()
Updates the current OAuth client's last synchronization date

**Kind**: instance method of [<code>SettingsCollection</code>](#SettingsCollection)
<a name="SharingCollection"></a>

## SharingCollection
Expand Down
7 changes: 7 additions & 0 deletions packages/cozy-stack-client/src/SettingsCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class SettingsCollection extends DocumentCollection {
data: normalizeDoc(resp.data, this.doctype)
}
}

/**
* Updates the current OAuth client's last synchronization date
*/
async updateLastSynced() {
return this.stackClient.fetchJSON('POST', '/settings/synchronized')
}
}

SettingsCollection.normalizeDoctype = DocumentCollection.normalizeDoctypeJsonApi
Expand Down
Loading