const db = await context.openDatabase('test_db', {
permissions: {
read: PERMISSIONS.PUBLIC,
write: PERMISSIONS.OWNER
}
})
const contactDatastore = await context.openDatastore
('https://common.schemas.verida.
io/social/contact/v0.1.0/schema.json')
const contact = {
firstName: 'John',
email: 'john@smith.com'
}
const success = await contactDatastore.save(contact)
if (!success) {
console.error(contacts.errors)
}
const filter = {
organization: 'Google'
}
const options = {
limit: 20,
skip: 0,
sort: [{insertedAt: 'desc'}]
}
const results = contacts.getMany(filter, options)
console.log(results)
const messaging = await context.getMessaging()
const data = {
data: [
{
firstName: 'Verida',
lastName: 'Example',
email: 'verida.example@example.com',
schema: 'https://common.schemas.verida.io/social
/contact/v0.1.0/schema.json'
}
]
}
const message = 'Sending you a contact'
messaging.send('did:vda:0x6B2a1bE81ee770cbB4648801e343E135e8D2Aa6F'
, 'inbox/type/dataSend', data, message)