1. Create a Boost
To create a boost, use the createBoost
method. This method accepts a credential
object (which can be an UnsignedVC
or VC
) and an optional metadata
object.
Copy const credential = your_credential;
const metadata = {
name : 'Your Boost Name' ,
description : 'Your Boost Description' ,
};
learnCard . invoke .createBoost (credential , metadata);
Creates a boost This route creates a boost
POST ../api /boost/create
Copy const response = await fetch ( '../api/boost/create' , {
method : 'POST' ,
headers : {
"Authorization" : "Bearer <token>" ,
"Content-Type" : "application/json"
} ,
body : JSON .stringify ({
"credential" : {
"@context" : [
"text"
] ,
"type" : [
"text"
] ,
"issuer" : "text" ,
"issuanceDate" : "text" ,
"credentialSubject" : {} ,
"proof" : {
"type" : "text" ,
"created" : "text" ,
"proofPurpose" : "text" ,
"verificationMethod" : "text"
}
}
}) ,
});
const data = await response .json ();
2. Get a Boost
To get a boost, use the getBoost
method. This method accepts a uri
parameter.
Copy const uri = 'your_boost_uri' ;
learnCard . invoke .getBoost (uri);
Get boost This endpoint gets metadata about a boost
GET ../api /boost/{uri}
Copy const response = await fetch ( '../api/boost/{uri}' , {
method : 'GET' ,
headers : {
"Authorization" : "Bearer <token>"
} ,
});
const data = await response .json ();
Copy {
"name" : "text" ,
"type" : "text" ,
"category" : "text" ,
"status" : "DRAFT" ,
"autoConnectRecipients" : false ,
"uri" : "text" ,
"boost" : {
"@context" : [
"text"
] ,
"id" : "text" ,
"type" : [
"text"
] ,
"issuer" : "text" ,
"issuanceDate" : "text" ,
"expirationDate" : "text" ,
"credentialSubject" : {
"id" : "text"
} ,
"credentialStatus" : {
"type" : "text" ,
"id" : "text"
} ,
"credentialSchema" : [
{
"id" : "text" ,
"type" : "text"
}
] ,
"refreshService" : {
"id" : "text" ,
"type" : "text"
}
}
}
3. Get Boosts
To retrieve all boosts, use the getBoosts
method.
Copy learnCard . invoke .getBoosts ();
4. Get Boost Recipients
To get boost recipients, use the getBoostRecipients
method. This method accepts a uri
parameter and optional limit
and skip
parameters.
Copy const uri = 'your_boost_uri' ;
const limit = 10 ;
const skip = 0 ;
learnCard . invoke .getBoostRecipients (uri , limit , skip);
Get boost recipients This endpoint gets the recipients of a particular boost.
Warning! This route is deprecated and currently has a hard limit of returning only the first 50 boosts. Please use getPaginatedBoostRecipients instead
GET ../api /boost/recipients/{uri}
Copy const response = await fetch ( '../api/boost/recipients/{uri}' , {
method : 'GET' ,
headers : {
"Authorization" : "Bearer <token>"
} ,
});
const data = await response .json ();
Copy [
{
"to" : {
"profileId" : "text" ,
"displayName" : "text" ,
"shortBio" : "text" ,
"bio" : "text" ,
"did" : "text" ,
"email" : "text" ,
"image" : "text" ,
"heroImage" : "text" ,
"websiteLink" : "text" ,
"isServiceProfile" : false ,
"type" : "text" ,
"notificationsWebhook" : "https://example.com"
} ,
"from" : "text" ,
"received" : "text"
}
]
5. Update a Boost
To update a boost, use the updateBoost
method. This method accepts a uri
parameter, an updates
object, and a credential
object (which can be an UnsignedVC
or VC
).
Copy const uri = 'your_boost_uri' ;
const updates = {
name : 'Updated Boost Name' ,
description : 'Updated Boost Description' ,
};
const credential = updated_credential;
learnCard . invoke .updateBoost (uri , updates , credential);
6. Delete a Boost
To delete a boost, use the deleteBoost
method. This method accepts a uri
parameter.
Copy const uri = 'your_boost_uri' ;
learnCard . invoke .deleteBoost (uri);
Delete a boost This route deletes a boost
DELETE ../api /boost/{uri}
Copy const response = await fetch ( '../api/boost/{uri}' , {
method : 'DELETE' ,
headers : {
"Authorization" : "Bearer <token>"
} ,
});
const data = await response .json ();
7. Send a Boost
To send a boost to another profile, use the sendBoost
method. This method accepts a profileId
, a boostUri
parameter, and an optional encrypt
parameteropconst profileId = 'janesmith';
Copy const boostUri = 'your_boost_uri' ;
const encrypt = true ;
learnCard . invoke .sendBoost (profileId , boostUri , encrypt);
These are the API calls related to boosts management in the LearnCard Network API. Use these methods to create, update, retrieve, and delete boosts, as well as send boosts to other profiles.
Send a Boost This endpoint sends a boost to a profile
POST ../api /boost/send/{profileId}
Copy const response = await fetch ( '../api/boost/send/{profileId}' , {
method : 'POST' ,
headers : {
"Authorization" : "Bearer <token>" ,
"Content-Type" : "application/json"
} ,
body : JSON .stringify ({
"uri" : "text" ,
"credential" : {
"@context" : [
"text"
] ,
"type" : [
"text"
] ,
"issuer" : "text" ,
"issuanceDate" : "text" ,
"credentialSubject" : {} ,
"proof" : {
"type" : "text" ,
"created" : "text" ,
"proofPurpose" : "text" ,
"verificationMethod" : "text"
}
}
}) ,
});
const data = await response .json ();
Send a Credential This endpoint sends a credential to a user based on their profileId
POST ../api /credential/send/{profileId}
Copy const response = await fetch ( '../api/credential/send/{profileId}' , {
method : 'POST' ,
headers : {
"Authorization" : "Bearer <token>" ,
"Content-Type" : "application/json"
} ,
body : JSON .stringify ({
"credential" : {
"@context" : [
"text"
] ,
"type" : [
"text"
] ,
"issuer" : "text" ,
"issuanceDate" : "text" ,
"credentialSubject" : {}
}
}) ,
});
const data = await response .json ();
Claim a Boost
Copy const boostUri = 'https://example.com/boost-uri' ;
const challenge = 'example-challenge' ;
await networkLearnCard . invoke .claimBoostWithLink (boostUri , challenge);
These examples demonstrate some of the ways you can interact with the LearnCard Network API using the @learncard/network-plugin
.