ProfileApi
interface OrganizationProfileInfoWithId implements OrganizationProfileInfo {
id: number
}
interface OrganizationProfileInfo {
name: string,
address?: string,
city?: string,
country?: string,
state?: string,
website?: string,
verified?: boolean,
uniqueId?: string,
zipCode?: string
}
interface ProfileInfo {
firstName?: string,
lastName?: string,
country?: {
alpha2: string,
name: string
},
email?: {
value: string,
confirmed: boolean
},
kycVerified?: boolean,
state?: string,
profilePicture?: string
}
Create a Profile API object.
endpoint
should be the Vulos Identity endpoint.
const profileApi = new ProfileApi(user, endpoint)
Get an user's public profile by the user's ID.
const userProfile = await profileApi.info(userId)
Get an organization's public profile by the organization's ID.
const organizationProfile = await profileApi.organization(organizationId)
Search for an organization by name using a string.
search
is the string we are searching with in the organization's name;amount
is the maximal amount of elements that can be returned (absolute maximal is100
, default is10
), this argument is optional;offset
is the amount of organizations that will get skipped in the result (default is0
), this argument is optional;
const [bestMatch] = await profileApi.organizationSearch('Example')
// ... or
let pageIndex = 0
const organizationsPerPage = 5
const nextPage = async () => {
const organizations = await profileApi.organizationSearch(
'Example',
organizationsPerPage,
organizationsPerPage * pageIndex)
pageIndex++
return organizations
}
let currentPage
while(currentPage = await nextPage()) {
// do something with the current page
}
Last modified 1yr ago