EvanBcService¶
Source | bc |
---|
- BCC business center API wrapper. Manages:
- bc object initialization
- bc contract creation & loading
- bc member loading
- …
joinLeaveBcQueueId
-QueueId
: queue id for checking joining / leaving membersprofileQueueId
-QueueId
: queue id for applying business center information to the users profile
getCurrentBusinessCenter¶
bcService.getCurrentBusinessCenter(ensDomain);
Gets the current business center. It is created using the BCBundle.createBC runtime function.
Parameters¶
ensDomain
-string
: bc ens domain
Returns¶
Promise
returns any
: the initialized business center
ensDomain
-string
: bc ens domainbcAddress
-string
: bc contract addressbusinessCenter
-any
: BusinessCenter contract addressbcRoles
-RightsAndRoles
: roles object for the business centeripld
-Ipld
: ipld for the business centerbcProfiles
-BusinessCenterProfile
: profiles object for the business centerdescription
-Description
: description object for the business centerdataContract
-DataContract
: dataContract specific for the business center
Example¶
const businessCenter = await this.bcService.getCurrentBusinessCenter('taskboard.evan');
reloadBc¶
bcService.reloadBc(ensDomain);
Refresh the data of a loaded business center. Have a look at “getCurrentBusinessCenter”
Parameters¶
ensDomain
-string
: ens domain to load the bc for
Returns¶
Promise
returns any
: business center object
Example¶
await this.bcService.reloadBc('taskboard.evan');
getMembers¶
bcService.getMembers(contract, ensDomain);
load the members for a contract within an business center
Parameters¶
contract
-any
: contract id or contract objectensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns Array<string>
: list of members
Example¶
this.bcService.getMembers(null, 'taskboard.evan')
getProfiles¶
bcService.getProfiles(members, ensDomain);
Load profiles for an member array
Parameters¶
members
-Array<any>
: members to load the profiles forensDomain
-string
: ens domain to load the contact cards from
Returns¶
Promise
returns void
: profiles analogous to addressbook profiles.
Example¶
const members = await bcService.getMembers(null, ensDomain);
const profiles = await bcService.getProfiles(members);
getProfileQueueId¶
bcService.getProfileQueueId(ensDomain);
Creates an queue id for users profile within a business center
Parameters¶
ensDomain
-string
: ens domain to create the queue id for
Example¶
this.queue.addQueueData(this.getProfileQueueId(ensDomain), {
alias,
description: loadedBc.description
});
isMember¶
bcService.isMember(accountId, ensDomain);
Checks if a member is joined to a business center
Parameters¶
accountId
-string
: account id to checkensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns boolean
: True if member, False otherwise.
Example¶
const isUserMember = bcService.isMember('0x000', 'taskboard.evan');
profileSet¶
bcService.profileSet(ensDomain);
Check if the user has a business center profile
Parameters¶
ensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns boolean
: true if profile exists, else false
Example¶
const isProfileSet = bcService.profileSet(ensDomain);
saveProfile¶
bcService.saveProfile(arguments);
Save the alias of a user to business center profile
Parameters¶
alias
-string
: alias to saveensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns void
: resolved when done
Example¶
bcService.saveProfile('cool alias', 'taskboard.evan');
getBCContracts¶
bcService.getBCContracts(ensDomain);
Get your contracts for a specific business center.
Parameters¶
ensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns Array<any>
: The bc contracts. ([ this.getBCContract() ])
Example¶
const bcContracts = bcService.getBCContracts('taskboard.evan');
getBCContract¶
initializedModule.getBCContract(ensDomain, contract);
load a contract of a business center
Parameters¶
ensDomain
-string
: ens domain of the business centercontractId
-string
: The contract identifier
Returns¶
Promise
returns any
: The bc contract.
Example¶
const bcContract = bcService.getBCContract('taskboard.evan', '0x000');
getJoinLeaveBcQueueId¶
bcService.getJoinLeaveBcQueueId(ensDomain);
Gets the join leave bc QueueId.
Parameters¶
ensDomain
-string
: The ens domain
Example¶
const queueId = bcService.getJoinLeaveBcQueueId('taskboard.evan');
joinBcViaQueue¶
bcService.joinBcViaQueue(ensDomain);
Join a business center using the bc profile QueueId
Parameters¶
ensDomain
-string
: The ens domain
Returns¶
Promise
returns void
: resolved when done
Example¶
await joinBcViaQueue('taskboard.evan');
executeOperationOnBc¶
bcService.executeOperationOnBc(ensDomain, operation);
Run a business-center contract function.
Parameters¶
ensDomain
-string
: ens domain of the business centeroperation
-string
: contract function
Returns¶
Promise
returns void
: resolved when done
Example¶
await this.executeOperationOnBC(ensDomain, 'join');
joinBc¶
bcService.joinBc(ensDomain);
Join a business center
Parameters¶
ensDomain
-string
: ens domain of the business center
Returns¶
Promise
returns void
: resolved when done
Example¶
await bcService.joinBc('taskboard.evan');