[AAE-5021] Add listPeople method to PeopleContentService (#6947)

* [AAE-5021] Add listPeople method to PeopleContentService

* lint

* Replace Person with EcmUserModel

* Update imports to @alfresco/adf-core

* Change to const + lint
This commit is contained in:
Thomas Hunter
2021-04-28 17:50:53 +02:00
committed by GitHub
parent 42c81e46bb
commit 9cbae9abd8
11 changed files with 124 additions and 46 deletions

View File

@@ -63,6 +63,25 @@ export class PeopleContentService {
return this.getPerson('-me-');
}
/**
* Gets a list of people.
* @param opts Optional parameters supported by JS-API
* @returns Array of people
*/
listPeople(options?): Observable<EcmUserModel[]> {
const promise = this.peopleApi.listPeople(options);
return from(promise).pipe(
map(response => {
const people: EcmUserModel[] = [];
response.list.entries.forEach((person: PersonEntry) => {
people.push(<EcmUserModel> person?.entry);
});
return people;
}),
catchError((err) => this.handleError(err))
);
}
/**
* Creates new person.
* @param newPerson Object containing the new person details.