Skip to main content

Get

There are some get-functions that are applicable to basically all types like members, token and so on. This how-to will list and explain them. We will use members as an example.

Live listeners

All those functions also have a Live function, which returns an Observable you can listen to. Just append Live to the function name.

Pagination

Most of the functions have an optional startAfter parameter. You can use this parameter for pagination. You can pass, for example, the uid of the last member you received to get to the next page.

Get By Field

You need to call getByField. getByField takes a string as fieldName and the value you want to look for as fieldValue.

    members = await https(origin)
.project(SoonaverseApiKey[Build5.TEST])
.dataset(Dataset.MEMBER)
.getByField('name', name);

Get By Space

You need to call getBySpace. getBySpace takes a string as space id.

    members = await https(origin)
.project(SoonaverseApiKey[Build5.TEST])
.dataset(Dataset.MEMBER)
.getBySpace(space_id);

Get All Updated After

You need to call getAllUpdatedAfter. getAllUpdatedAfter takes a unix timestamp. The results will contain all members updated after this timestamp.

    members = await https(origin)
.project(SoonaverseApiKey[Build5.TEST])
.dataset(Dataset.MEMBER)
.getAllUpdatedAfter(updatedAfter);

Get Many By Id

You need to call getManyById. getManyById takes a list of IDs as string.

    members = await https(origin)
.project(SoonaverseApiKey[Build5.TEST])
.dataset(Dataset.MEMBER)
.getManyById(member_ids);

Get Top

You need to call getTop. getTop takes an optional limit to for example only get the top 3 members.

    members = await https(origin)
.project(SoonaverseApiKey[Build5.TEST])
.dataset(Dataset.MEMBER)
.getTop(3);