npm install solid-user-search
Then you can import components like this:
import { PersonDetails, fetchPersonDetails } from 'solid-user-search';
import {
PersonTypes,
PersonTypeLists,
fetchPersonTypeLists
} from 'solid-user-search';
import { fetchConnections } from 'solid-user-search';
This is an enumeration it is used to describe the status of the connection.
The values are:
Name | Description |
---|---|
me | Logged in user |
requester | Another solid user that is requesting the logged in users friendship |
requested | Solid users whome the logged in person has requested friendship |
friend | Another solid user in which both parties have accepted a friendship |
blocked | Solid users the logged in user has unfriended |
stranger | Other solid users that are connected in some way to the logged in users current connections |
Person Details describe a solid user in relation to the logged in user. The object includes the following details of the solid user themselves:
Name | DataType |
---|---|
webId | string |
avatarUrl | string | null |
fullName | string | null |
follows | string[] | null |
In addition it includes the status of the relationship to the logged in user:
PersonType | PersonType | null |
PersonTypeLists are Objects that organize the collection of friends by PersonType. This can be used if...
export type PersonTypeLists = {
[type in PersonType]: {
[webId: string]: PersonDetails;
};
};
Fetches and returns the PersonDetails of the user with the given webId. This can be used like this:
const getUserDetails = async () => {
try {
await fetchPersonDetails(webId).then(() => {
//do something
});
} catch (e) {
console.log(e);
}
};
Fetches and returns the PersonTypeLists for the logged in user. It takes an array of PersonTypes for the data you want to retrieve. If no argument is passed in it will return everything. This function is an async generator. It can be used like this:
(async () => {
let generator = fetchPersonTypeLists();
for await (let users of generator) {
//do something
}
})();
Fetches and returns an array of PersonDetails for the logged in user. This function is an async generator. It takes an array of PersonTypes for the data you want to retrieve. If no argument is passed in it will return everything. It can be used like this:
(async () => {
let generator = fetchConnections([PersonType.friend]);
for await (let friends of generator) {
//do something
}
})();
See CHANGELOG.
MIT © Inrupt