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

The "me" and "person" queries both return a Person object. The "person" query requires a mandatory attribute for either the id or the name of the Person to return.

NOTE

The "me" query and "person(email)" query can only be called from a user-authenticated WWClient. They cannot be called from an application-authenticated WWClient. At the time of writing, attempting to call those queries from an 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.PersonGraphQLQuery class has three simple static helper methods available:

  • buildMyProfileQuery()
  • buildPersonQueryByEmail(String)
  • buildPersonQueryById(String)

If the parameter is blank, the query will redirect to buildMyProfileQuery() to process the "me" query. Similar methods are also available from WWClient and WWGraphQLEndpoint.

For greater control, create an ObjectDataSenderBuilder for either the Person.MY_PROFILE_QUERY_OBJECT_NAME (i.e. "me") or Person.ONE_PERSON_QUERY_OBJECT_NAME (i.e. "person") object, adding attributes as appropriate, passing in Person fields and children. Instantiate a new PersonGraphQLQuery(String, Object) passing in PersonGraphQLQuery.METHOD_GET_MYSELF or PersonGraphQLQuery.METHOD_GET_PROFILE (or an arbitrary method name) as the first parameter and the ObjectDataSenderBuilder as the second. Then pass this to WWClient.getPersonWithQuery().

Examples

Basic getMe
    Person me = client.getMe();
    assert (myDisplayName.equals(me.getDisplayName()));
Basic getProfileById
    Person person = client.getPersonById(profileId);
    assert (myDisplayName.equals(person.getDisplayName()));
Basic getPofileByEmail
    Person person = client.getPersonByEmail(profileEmail);
    assert (myDisplayName.equals(person.getDisplayName()));
Customised getProfile
    ObjectDataSenderBuilder query = new ObjectDataSenderBuilder();
    query.setObjectName(Person.ONE_PERSON_QUERY_OBJECT_NAME);
    query.addAttribute(PersonAttributes.ID, personId);
    query.addField(PersonFields.ID);
    query.addField(PersonFields.DISPLAY_NAME);
    query.addField(PersonFields.EMAIL);
    query.addField(PersonFields.PHOTO_URL);
    query.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(PersonChildren.CREATED_BY));
    query.addChild(new BasicCreatedByUpdatedByDataSenderBuilder(PersonChildren.UPDATED_BY));
	Person person = client.getPersonWithQuery(new PersonGraphQLQuery(query));
    assert (myDisplayName.equals(person.getDisplayName()));

6 Comments

  1. Anonymous

    That is really complex for me to understand at once but I need to write about this in my Ph.D. Thesis Writing Help, so I tried to read it multiple times & now I think I am starting to making my concepts clear enough. 

  2. Anonymous

    The whole process of getting money will take you from several hours till one business day, which is much faster compared to the banks that may check all your documentation for several days and inform you about the 500 loan refusal in case you don’t have enough good credit score.

  3. Anonymous

    I want to be used as it's the perfect preference in relation to subjects. It could also be useful to recall the position of the word within the Cheap Office Space For Rent In Dubai sentence. At the same time as concerning yourself and every other person or distinct human beings, it is suitable to locate the other or others first, and your self ultimate.

  4. Anonymous

    It is now not absolutely wrong both ways (furnished that you are the use of Write My Dissertation them appropriately because of the problem or object of the sentence), but it's miles commonly higher to position the primary individual pronoun after the reference to the opposite individual. So, within the sentence, “she and that I went to the store,” the correct phrase to apply would be I in place of me. Why? Because I'm the situation of the sentence.

  5. Anonymous

    I want to be used as it's the appropriate choice in terms of Diesel Buyers In Ajman topics. So, inside the sentence, “she and that I went to the shop,” the proper word to apply could be I in place of me. Why? Due to the fact I'm the situation of the sentence.

    Diesel Buyers In Sharjah
    Diesel Buyers In Abu Dhabi

  6. Anonymous

    Hello there! When i have some troubles with studying i use dissertation assistance which helps me a lot. I recommend this service for everyone now so try it now and good luck!

Write a comment…