Revert "Revert "[ACS-9166] Migrate Saved Searches to preferences API from con…" (#10594)

This reverts commit fcd6e25dc6.
This commit is contained in:
MichalKinas
2025-01-28 08:41:23 +01:00
committed by GitHub
parent 78e527f7df
commit 35aec24c0f
5 changed files with 171 additions and 130 deletions

View File

@@ -84,4 +84,25 @@ export class PreferencesApi extends BaseApi {
queryParams
});
}
updatePreference(personId: string, preferenceName: string, preferenceValue: string): Promise<PreferenceEntry> {
throwIfNotDefined(personId, 'personId');
throwIfNotDefined(preferenceName, 'preferenceName');
throwIfNotDefined(preferenceValue, 'preferenceValue');
const pathParams = {
personId,
preferenceName
};
const bodyParam = {
value: preferenceValue
};
return this.put({
path: '/people/{personId}/preferences/{preferenceName}',
pathParams,
bodyParam: bodyParam
});
}
}

View File

@@ -2,10 +2,11 @@
All URIs are relative to *https://localhost/alfresco/api/-default-/public/alfresco/versions/1*
| Method | HTTP request | Description |
|-------------------------------------|---------------------------------------------------------|------------------|
| [getPreference](#getPreference) | **GET** /people/{personId}/preferences/{preferenceName} | Get a preference |
| [listPreferences](#listPreferences) | **GET** /people/{personId}/preferences | List preferences |
| Method | HTTP request | Description |
|---------------------------------------|----------------------------------------------------------|-------------------|
| [getPreference](#getPreference) | **GET** /people/{personId}/preferences/{preferenceName} | Get a preference |
| [listPreferences](#listPreferences) | **GET** /people/{personId}/preferences | List preferences |
| [updatePreference](#updatePreference) | **POST** /people/{personId}/preferences/{preferenceName} | Update preference |
## getPreference
@@ -71,6 +72,36 @@ preferencesApi.listPreferences(`<personId>`, opts).then((data) => {
});
```
## updatePreference
Update preference
You can use the `-me-` string in place of `<personId>` to specify the currently authenticated user.
### Parameters
| Name | Type | Description |
|---------------------|--------|-----------------------------|
| **personId** | string | The identifier of a person. |
| **preferenceName** | string | The name of the preference. |
| **preferenceValue** | string | New preference value. |
**Return type**: [PreferenceEntry](#PreferenceEntry)
**Example**
```javascript
import { AlfrescoApi, PreferencesApi } from '@alfresco/js-api';
const alfrescoApi = new AlfrescoApi(/*..*/);
const preferencesApi = new PreferencesApi(alfrescoApi);
const newPreferenceValue = 'test';
preferencesApi.updatePreference(`<personId>`, `<preferenceName>`, newPreferenceValue).then((data) => {
console.log('API called successfully. Returned data: ' + data);
});
```
# Models
## PreferencePaging
@@ -105,4 +136,4 @@ preferencesApi.listPreferences(`<personId>`, opts).then((data) => {
| Name | Type | Description |
|--------|--------|----------------------------------------------------------------------|
| **id** | string | The unique id of the preference |
| value | string | The value of the preference. Note that this can be of any JSON type. |
| value | string | The value of the preference. Note that this can be of any JSON type. |