Page tree
Skip to end of metadata
Go to start of metadata

The "people" query returns a collection of Person objects. The "people" query can accept various attributes - a list of person IDs, part of a name, or pagination options.

NOTE

Queries from an application-authenticated WWClient can only use a list of IDs as an attribute. A query using any other attribute (or no attributes at all) from application-authenticated WWClient just return an HTTP 500 error. This is because those queries are looking for people within your organisation. But an application does not have an organisation.

The org.opencode4workspace.builders.PeopleGraphQLQuery class has two simple static helper methods available:

  • buildPersonQueryById(List<String>)
  • buildPersonQueryByName(String)

Similar methods are also available from WWClient and WWGraphQLEndpoint.

For greater control, create an ObjectDataSenderBuilder for the Person.PEOPLE_QUERY_OBJECT_NAME object, adding attributes as appropriate, passing in Person fields and children. Instantiate a new PeopleGraphQLQuery passing in the ObjectDataSenderBuilder as the parameter. Then pass this to WWClient.getPeopleWithQuery(). SInce 0.8.0 you can also pass this to WWClient.getPeopleContainerWithQuery(). The first one just returns the List of Person objects, the second one gives access to the MembersContainer, which gives access to the PageInfo object and the List of Person objects.

Examples

Basic getPeopleById
    ArrayList<String> ids = new ArrayList<String>();
    ids.add(profileId);
    ids.add(appId);

    List<Person> peopleResult = client.getPeople(ids);
Basic getPeopleByName
    List<Person> peopleResult = client.getPeopleByName("Paul");
getPeopleWithQuery
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder(Person.PEOPLE_QUERY_OBJECT_NAME, true);
    query.addAttribute(BasicPaginationEnum.FIRST.getLabel(), 10);
    query.addField(PersonFields.DISPLAY_NAME);

	List<Person> peopleResult = client.getPeopleWithQuery(new PeopleGraphQLQuery(query));
getPeopleContainerWithQuery - since 0.8.0
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder(Person.PEOPLE_QUERY_OBJECT_NAME, true);
    query.addAttribute(BasicPaginationEnum.FIRST.getLabel(), 10);
    query.addField(PersonFields.DISPLAY_NAME);

	MembersContainer peopleResult = client.getPeopleContainerWithQuery(new PeopleGraphQLQuery(query));
    PageInfo pageInfo = peopleResult.getPageInfo();
    List<Person> people = peopleResult.getItems();

1 Comment

  1. Anonymous

    I appreciate the positive approach to a balanced improvement set up. Somewhat is that the same sense as memorizing several formulas isn't a important side of learning mathematics, developing ability in winding up procedures by hand isn't any longer a key side of learning mathematics. I am working as an academic consultant and offer best dissertation writing service for college students.

Write a comment…