mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Revert "Revert "[ACS-9166] Migrate Saved Searches to preferences API from con…" (#10594)
This reverts commit fcd6e25dc6
.
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -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. |
|
||||
|
Reference in New Issue
Block a user