updateLabels method

Future<User> updateLabels({
  1. required String userId,
  2. required List<String> labels,
})

Update user labels

Update the user labels by its unique ID.

Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the Permissions docs for more info.

Implementation

Future<models.User> updateLabels(
    {required String userId, required List<String> labels}) async {
  final String apiPath =
      '/users/{userId}/labels'.replaceAll('{userId}', userId);

  final Map<String, dynamic> apiParams = {
    'labels': labels,
  };

  final Map<String, String> apiHeaders = {
    'content-type': 'application/json',
  };

  final res = await client.call(HttpMethod.put,
      path: apiPath, params: apiParams, headers: apiHeaders);

  return models.User.fromMap(res.data);
}