Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface PersonsAndGroupsManager

It holds a root group, which contains the list of all clients and groups known to the client.

Hierarchy

  • PersonsAndGroupsManager

Index

Properties

all

all: Group

The root group contains a list of all contacts and groups.

This is the root group contains 'persons' as a collection of all contacts, and 'groups' as a collection of all groups (user-created groups, server created groups and relationship groups).

mePerson

mePerson: MePerson

Represents signed in user. Here is a correct way to display the availability state of the user:

client.signInManager.state.when("SignedIn", () => {
    var tag = $("<span>").appendTo($("body"));
    var pgm = client.personsAndGroupsManager;
    pgm.mePerson.status.subscribe();
    pgm.mePerson.status.changed((status) => {
        tag.text(status);
    });
});

Methods

createGroup

  • Creates a group which can be then added to another group.

    The created group must be given a unique name first:

    var g = pgm.createGroup(); g.name("ABC"); pgm.all.groups.add(g);

    Returns Group

createGroupSearchQuery

  • Creates a search query for searching groups. The search results will be provided after the request of searching query is resolved by server.

    var searchQuery = client.personsAndGroupsManager.createPersonSearchQuery(); searchQuery.text("FooGroup"); searchQuery.limit(10); searchQuery.getMore().then(() => { if (searchQuery.getMore.enabled()) console.log("More results are available on the server"); else console.log("No more results are available on the server");

    searchQuery.results().forEach((r) => {
        console.log("group:", r.result.name());
    });
    

    });

    Returns SearchQuery<Group>

createPersonSearchQuery

  • Creates a search query for searching persons. The search results will be provided after the request of searching query is resolved by server.

    var searchQuery = client.personsAndGroupsManager.createPersonSearchQuery(); searchQuery.text("John"); searchQuery.limit(10); searchQuery.getMore().then(() => { if (searchQuery.getMore.enabled()) console.log("More results are available on the server"); else console.log("No more results are available on the server");

    searchQuery.results().forEach((r) => {
        console.log("person:", r.result.name());
    });
    

    });

    Returns SearchQuery<Person>