create method

Future<GoogleAppsDriveLabelsV2Label> create(
  1. GoogleAppsDriveLabelsV2Label request, {
  2. String? languageCode,
  3. bool? useAdminAccess,
  4. String? $fields,
})

Creates a new Label.

request - The metadata request object.

Request parameters:

languageCode - The BCP-47 language code to use for evaluating localized Field labels in response. When not specified, values in the default configured language will be used.

useAdminAccess - Set to true in order to use the user's admin privileges. The server will verify the user is an admin before allowing access.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleAppsDriveLabelsV2Label.

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<GoogleAppsDriveLabelsV2Label> create(
  GoogleAppsDriveLabelsV2Label request, {
  core.String? languageCode,
  core.bool? useAdminAccess,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (languageCode != null) 'languageCode': [languageCode],
    if (useAdminAccess != null) 'useAdminAccess': ['${useAdminAccess}'],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'v2/labels';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return GoogleAppsDriveLabelsV2Label.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}