create method
- GoogleAppsDriveLabelsV2LabelPermission request,
- String parent, {
- bool? useAdminAccess,
- String? $fields,
Updates a Label's permissions.
If a permission for the indicated principal doesn't exist, a new Label Permission is created, otherwise the existing permission is updated. Permissions affect the Label resource as a whole, are not revisioned, and do not require publishing.
request
- The metadata request object.
Request parameters:
parent
- Required. The parent Label resource name on the Label
Permission is created. Format: labels/{label}
Value must have pattern ^labels/\[^/\]+/revisions/\[^/\]+$
.
useAdminAccess
- Set to true
in order to use the user's admin
credentials. The server will verify the user is an admin for the Label
before allowing access.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleAppsDriveLabelsV2LabelPermission.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleAppsDriveLabelsV2LabelPermission> create(
GoogleAppsDriveLabelsV2LabelPermission request,
core.String parent, {
core.bool? useAdminAccess,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (useAdminAccess != null) 'useAdminAccess': ['${useAdminAccess}'],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/permissions';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleAppsDriveLabelsV2LabelPermission.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}