Labels

Labels are a good way to categorize a user to grant them access to resources. For example, a subscriber label can be added to a user once they've purchased a subscription.

const sdk = require('node-appwrite');

const client = new sdk.Client()
    .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
    .setProject('<PROJECT_ID>')                 // Your project ID
    .setKey('98fd4...a2ad2');                    // Your secret API key

const users = new sdk.Users(client);

const promise = users.updateLabels(
    '[USER_ID]',
    [ 'subscriber' ]
);

promise.then(function (response) {
    console.log(response); // Success
}, function (error) {
    console.log(error); // Failure
});

This would correspond with the permissions below.

DescriptionCode Snippet
ReadPermissions.read(Role.label('subscriber'))
UpdatePermissions.update(Role.label('subscriber'))
DeletePermissions.delete(Role.label('subscriber'))
CreatePermissions.create(Role.label('subscriber'))

Learn more about permissions