- Resource: Label
- LabelType
- UserInfo
- Properties
- Lifecycle
- State
- DisabledPolicy
- DisplayHints
- AppliedCapabilities
- SchemaCapabilities
- AppliedLabelPolicy
- CopyMode
- Field
- TextOptions
- IntegerOptions
- DateOptions
- DateFormat
- Date
- SelectionOptions
- ListOptions
- Choice
- Properties
- BadgeConfig
- Color
- DisplayHints
- BadgeColors
- SchemaCapabilities
- AppliedCapabilities
- LockStatus
- UserOptions
- Properties
- DisplayHints
- SchemaCapabilities
- AppliedCapabilities
- Methods
Resource: Label
A label defines a taxonomy that can be applied to Drive items in order to organize and search across items. Labels can be simple strings, or can contain fields that describe additional metadata that can be further used to organize and search Drive items.
JSON representation |
---|
{ "name" : string , "id" : string , "revisionId" : string , "labelType" : enum ( |
Fields | |
---|---|
name
|
Output only. Resource name of the label. Will be in the form of either: |
id
|
Output only. Globally unique identifier of this label. ID makes up part of the label |
revisionId
|
Output only. Revision ID of the label. Revision ID might be part of the label |
labelType
|
Required. The type of label. |
creator
|
Output only. The user who created this label. |
createTime
|
Output only. The time this label was created. |
revisionCreator
|
Output only. The user who created this label revision. |
revisionCreateTime
|
Output only. The time this label revision was created. |
publisher
|
Output only. The user who published this label. This value has no meaning when the label is not published. |
publishTime
|
Output only. The time this label was published. This value has no meaning when the label is not published. |
disabler
|
Output only. The user who disabled this label. This value has no meaning when the label is not disabled. |
disableTime
|
Output only. The time this label was disabled. This value has no meaning when the label is not disabled. |
customer
|
Output only. The customer this label belongs to. For example: "customers/123abc789." |
properties
|
Required. The basic properties of the label. |
lifecycle
|
Output only. The lifecycle state of the label including whether it's published, deprecated, and has draft changes. |
displayHints
|
Output only. UI display hints for rendering the label. |
appliedCapabilities
|
Output only. The capabilities related to this label on applied metadata. |
schemaCapabilities
|
Output only. The capabilities the user has on this label. |
appliedLabelPolicy
|
Output only. Behavior of this label when it's applied to Drive items. |
fields[]
|
List of fields in descending priority order. |
learnMoreUri
|
Custom URL to present to users to allow them to learn more about this label and how it should be used. |
lockStatus
|
Output only. The LockStatus of this label. |
LabelType
The type of this label.
Enums | |
---|---|
LABEL_TYPE_UNSPECIFIED
|
Unknown label type. |
SHARED
|
Shared labels may be shared with users to apply to Drive items. |
ADMIN
|
Admin-owned label. Only creatable and editable by admins. Supports some additional admin-only features. |
UserInfo
Information about a user.
JSON representation |
---|
{ "person" : string } |
Fields | |
---|---|
person
|
The identifier for this user that can be used with the People API to get more information. For example, people/12345678. |
Properties
Basic properties of the label.
JSON representation |
---|
{ "title" : string , "description" : string } |
Fields | |
---|---|
title
|
Required. Title of the label. |
description
|
The description of the label. |
Lifecycle
The lifecycle state of an object, such as label, field, or choice. The lifecycle enforces the following transitions:
-
UNPUBLISHED_DRAFT
(starting state) -
UNPUBLISHED_DRAFT
->PUBLISHED
-
UNPUBLISHED_DRAFT
-> (Deleted) -
PUBLISHED
->DISABLED
-
DISABLED
->PUBLISHED
-
DISABLED
-> (Deleted)
The published and disabled states have some distinct characteristics:
- Published—Some kinds of changes might be made to an object in this state, in which case
hasUnpublishedChanges
will be true. Also, some kinds of changes are not permitted. Generally, any change that would invalidate or cause new restrictions on existing metadata related to the label are rejected. - Disabled—When disabled, the configured
DisabledPolicy
takes effect.
JSON representation |
---|
{ "state" : enum ( |
Fields | |
---|---|
state
|
Output only. The state of the object associated with this lifecycle. |
hasUnpublishedChanges
|
Output only. Whether the object associated with this lifecycle has unpublished changes. |
disabledPolicy
|
The policy that governs how to show a disabled label, field, or selection choice. |
State
The state of the object associated with this lifecycle.
Enums | |
---|---|
STATE_UNSPECIFIED
|
Unknown State. |
UNPUBLISHED_DRAFT
|
The initial state of an object. Once published, the object can never return to this state. Once an object is published, certain kinds of changes are no longer permitted. |
PUBLISHED
|
The object has been published. The object might have unpublished draft changes as indicated by hasUnpublishedChanges
. |
DISABLED
|
The object has been published and has since been disabled. The object might have unpublished draft changes as indicated by hasUnpublishedChanges
. |
DELETED
|
The object has been deleted. |
DisabledPolicy
The policy that governs how to treat a disabled label, field, or selection choice in different contexts.
JSON representation |
---|
{ "hideInSearch" : boolean , "showInApply" : boolean } |
hideInSearch
boolean
Whether to hide this disabled object in the search menu for Drive items.
- When
false
, the object is generally shown in the UI as disabled but it appears in the search results when searching for Drive items. - When
true
, the object is generally hidden in the UI when searching for Drive items.
showInApply
boolean
Whether to show this disabled object in the apply menu on Drive items.
- When
true
, the object is generally shown in the UI as disabled and is unselectable. - When
false
, the object is generally hidden in the UI.
DisplayHints
UI display hints for rendering the label.
JSON representation |
---|
{ "disabled" : boolean , "hiddenInSearch" : boolean , "shownInApply" : boolean , "priority" : string } |
Fields | |
---|---|
disabled
|
Whether the label should be shown in the UI as disabled. |
shownInApply
|
This label should be shown in the apply menu when applying values to a Drive item. |
priority
|
Order to display label in a list. |
AppliedCapabilities
The capabilities a user has on this label's applied metadata.
JSON representation |
---|
{ "canRead" : boolean , "canApply" : boolean , "canRemove" : boolean } |
Fields | |
---|---|
canRead
|
Whether the user can read applied metadata related to this label. |
canApply
|
Whether the user can apply this label to items. |
canRemove
|
Whether the user can remove this label from items. |
SchemaCapabilities
The capabilities related to this label when editing the label.
JSON representation |
---|
{ "canUpdate" : boolean , "canDelete" : boolean , "canDisable" : boolean , "canEnable" : boolean } |
Fields | |
---|---|
canUpdate
|
Whether the user can change this label. |
canDelete
|
Whether the user can delete this label. The user must have permission and the label must be disabled. |
canDisable
|
Whether the user can disable this label. The user must have permission and this label must not already be disabled. |
canEnable
|
Whether the user can enable this label. The user must have permission and this label must be disabled. |
AppliedLabelPolicy
Behavior of this label when it's applied to Drive items.
JSON representation |
---|
{
"copyMode"
:
enum (
|
Fields | |
---|---|
copyMode
|
Indicates how the applied label and field values should be copied when a Drive item is copied. |
CopyMode
Indicates how the applied label and field values should be copied when a Drive item is copied.
Enums | |
---|---|
COPY_MODE_UNSPECIFIED
|
Copy mode unspecified. |
DO_NOT_COPY
|
The applied label and field values are not copied by default when the Drive item it's applied to is copied. |
ALWAYS_COPY
|
The applied label and field values are always copied when the Drive item it's applied to is copied. Only admins can use this mode. |
COPY_APPLIABLE
|
The applied label and field values are copied if the label is appliable by the user making the copy. |
Field
Defines a field that has a display name, data type, and other configuration options. This field defines the kind of metadata that may be set on a Drive item.
JSON representation |
---|
{ "id" : string , "queryKey" : string , "properties" : { object ( |
id
string
Output only. The key of a field, unique within a label or library.
This value is autogenerated. Matches the regex: ([a-zA-Z0-9])+
queryKey
string
Output only. The key to use when constructing Drive search queries to find files based on values defined for this field on files. For example, " {queryKey}
> 2001-01-01".
properties
object (
Properties
)
The basic properties of the field.
lifecycle
object (
Lifecycle
)
Output only. The lifecycle of this field.
displayHints
object (
DisplayHints
)
Output only. UI display hints for rendering a field.
schemaCapabilities
object (
SchemaCapabilities
)
Output only. The capabilities this user has when editing this field.
appliedCapabilities
object (
AppliedCapabilities
)
Output only. The capabilities this user has on this field and its value when the label is applied on Drive items.
creator
object (
UserInfo
)
Output only. The user who created this field.
createTime
string (
Timestamp
format)
Output only. The time this field was created.
updater
object (
UserInfo
)
Output only. The user who modified this field.
updateTime
string (
Timestamp
format)
Output only. The time this field was updated.
publisher
object (
UserInfo
)
Output only. The user who published this field. This value has no meaning when the field is not published.
disabler
object (
UserInfo
)
Output only. The user who disabled this field. This value has no meaning when the field is not disabled.
disableTime
string (
Timestamp
format)
Output only. The time this field was disabled. This value has no meaning when the field is not disabled.
lockStatus
object (
LockStatus
)
Output only. The LockStatus of this field.
type
. The data type and options of this field. Once published, the data type cannot be changed. type
can be only one of the following:TextOptions
Options for the Text field type.
JSON representation |
---|
{ "minLength" : integer , "maxLength" : integer } |
Fields | |
---|---|
minLength
|
Output only. The minimum valid length of values for the text field. |
maxLength
|
Output only. The maximum valid length of values for the text field. |
IntegerOptions
Options for the Integer field type.
JSON representation |
---|
{ "minValue" : string , "maxValue" : string } |
Fields | |
---|---|
minValue
|
Output only. The minimum valid value for the integer field. |
maxValue
|
Output only. The maximum valid value for the integer field. |
DateOptions
Options for the date field type.
JSON representation |
---|
{ "dateFormatType" : enum ( |
Fields | |
---|---|
dateFormatType
|
Localized date formatting option. Field values are rendered in this format according to their locale. |
dateFormat
|
Output only. ICU date format. |
minValue
|
Output only. Minimum valid value (year, month, day). |
maxValue
|
Output only. Maximum valid value (year, month, day). |
DateFormat
Localized date format options.
Enums | |
---|---|
DATE_FORMAT_UNSPECIFIED
|
Date format unspecified. |
LONG_DATE
|
Includes full month name. For example, January 12, 1999 (MMMM d, y) |
SHORT_DATE
|
Short, numeric, representation. For example, 12/13/99 (M/d/yy) |
Date
Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following:
- A full date, with non-zero year, month, and day values.
- A month and day, with a zero year (for example, an anniversary).
- A year on its own, with a zero month and a zero day.
- A year and month, with a zero day (for example, a credit card expiration date).
Related types:
-
google.type.TimeOfDay
-
google.type.DateTime
-
google.protobuf.Timestamp
JSON representation |
---|
{ "year" : integer , "month" : integer , "day" : integer } |
Fields | |
---|---|
year
|
Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. |
month
|
Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. |
day
|
Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. |
SelectionOptions
Options for the selection field type.
JSON representation |
---|
{ "listOptions" : { object ( |
Fields | |
---|---|
listOptions
|
When specified, indicates this field supports a list of values. Once the field is published, this cannot be changed. |
choices[]
|
The options available for this selection field. The list order is consistent, and modified with |
ListOptions
Options for a multi-valued variant of an associated field type.
JSON representation |
---|
{ "maxEntries" : integer } |
Fields | |
---|---|
maxEntries
|
Maximum number of entries permitted. |
Choice
Selection field choice.
JSON representation |
---|
{ "id" : string , "properties" : { object ( |
Fields | |
---|---|
id
|
The unique value of the choice. This ID is autogenerated. Matches the regex: |
properties
|
Basic properties of the choice. |
lifecycle
|
Output only. Lifecycle of the choice. |
displayHints
|
Output only. UI display hints for rendering a choice. |
schemaCapabilities
|
Output only. The capabilities related to this option when editing the option. |
appliedCapabilities
|
Output only. The capabilities related to this choice on applied metadata. |
creator
|
Output only. The user who created this choice. |
createTime
|
Output only. The time this choice was created. |
updater
|
Output only. The user who updated this choice last. |
updateTime
|
Output only. The time this choice was updated last. |
publisher
|
Output only. The user who published this choice. This value has no meaning when the choice is not published. |
publishTime
|
Output only. The time this choice was published. This value has no meaning when the choice is not published. |
disabler
|
Output only. The user who disabled this choice. This value has no meaning when the option is not disabled. |
disableTime
|
Output only. The time this choice was disabled. This value has no meaning when the choice is not disabled. |
lockStatus
|
Output only. The LockStatus of this choice. |
Properties
Basic properties of the choice.
JSON representation |
---|
{
"displayName"
:
string
,
"description"
:
string
,
"badgeConfig"
:
{
object (
|
Fields | |
---|---|
displayName
|
Required. The display text to show in the UI identifying this field. |
description
|
The description of this label. |
badgeConfig
|
The badge configuration for this choice. When set, the label that owns this choice is considered a "badged label". |
insertBeforeChoice
|
Input only. Insert or move this choice before the indicated choice. If empty, the choice is placed at the end of the list. |
BadgeConfig
Badge status of the label.
JSON representation |
---|
{
"color"
:
{
object (
|
Fields | |
---|---|
color
|
The color of the badge. When not specified, no badge is rendered. The background, foreground, and solo (light and dark mode) colors set here are changed in the Drive UI into the closest recommended supported color. |
priorityOverride
|
Override the default global priority of this badge. When set to 0, the default priority heuristic is used. |
Color
Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to and from color representations in various languages over compactness. For example, the fields of this representation can be trivially provided to the constructor of java.awt.Color
in Java; it can also be trivially provided to UIColor's +colorWithRed:green:blue:alpha
method in iOS; and, with just a little work, it can be easily formatted into a CSS rgba()
string in JavaScript.
This reference page doesn't have information about the absolute color space that should be used to interpret the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, applications should assume the sRGB color space.
When color equality needs to be decided, implementations, unless documented otherwise, treat two colors as equal if all their red, green, blue, and alpha values each differ by at most 1e-5
.
Example (Java):
import com.google.type.Color;
// ...
public static java.awt.Color fromProto(Color protocolor) {
float alpha = protocolor.hasAlpha()
? protocolor.getAlpha().getValue()
: 1.0;
return new java.awt.Color(
protocolor.getRed(),
protocolor.getGreen(),
protocolor.getBlue(),
alpha);
}
public static Color toProto(java.awt.Color color) {
float red = (float) color.getRed();
float green = (float) color.getGreen();
float blue = (float) color.getBlue();
float denominator = 255.0;
Color.Builder resultBuilder =
Color
.newBuilder()
.setRed(red / denominator)
.setGreen(green / denominator)
.setBlue(blue / denominator);
int alpha = color.getAlpha();
if (alpha != 255) {
result.setAlpha(
FloatValue
.newBuilder()
.setValue(((float) alpha) / denominator)
.build());
}
return resultBuilder.build();
}
// ...
Example (iOS / Obj-C):
// ...
static UIColor* fromProto(Color* protocolor) {
float red = [protocolor red];
float green = [protocolor green];
float blue = [protocolor blue];
FloatValue* alpha_wrapper = [protocolor alpha];
float alpha = 1.0;
if (alpha_wrapper != nil) {
alpha = [alpha_wrapper value];
}
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
}
static Color* toProto(UIColor* color) {
CGFloat red, green, blue, alpha;
if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
return nil;
}
Color* result = [[Color alloc] init];
[result setRed:red];
[result setGreen:green];
[result setBlue:blue];
if (alpha <= 0.9999) {
[result setAlpha:floatWrapperWithValue(alpha)];
}
[result autorelease];
return result;
}
// ...
Example (JavaScript):
// ...
var protoToCssColor = function(rgb_color) {
var redFrac = rgb_color.red || 0.0;
var greenFrac = rgb_color.green || 0.0;
var blueFrac = rgb_color.blue || 0.0;
var red = Math.floor(redFrac * 255);
var green = Math.floor(greenFrac * 255);
var blue = Math.floor(blueFrac * 255);
if (!('alpha' in rgb_color)) {
return rgbToCssColor(red, green, blue);
}
var alphaFrac = rgb_color.alpha.value || 0.0;
var rgbParams = [red, green, blue].join(',');
return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
};
var rgbToCssColor = function(red, green, blue) {
var rgbNumber = new Number((red << 16) | (green << 8) | blue);
var hexString = rgbNumber.toString(16);
var missingZeros = 6 - hexString.length;
var resultBuilder = ['#'];
for (var i = 0; i < missingZeros; i++) {
resultBuilder.push('0');
}
resultBuilder.push(hexString);
return resultBuilder.join('');
};
// ...
JSON representation |
---|
{ "red" : number , "green" : number , "blue" : number , "alpha" : number } |
Fields | |
---|---|
red
|
The amount of red in the color as a value in the interval [0, 1]. |
green
|
The amount of green in the color as a value in the interval [0, 1]. |
blue
|
The amount of blue in the color as a value in the interval [0, 1]. |
alpha
|
The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). |
DisplayHints
UI display hints for rendering an option.
JSON representation |
---|
{ "disabled" : boolean , "hiddenInSearch" : boolean , "shownInApply" : boolean , "badgeColors" : { object ( |
Fields | |
---|---|
disabled
|
Whether the option should be shown in the UI as disabled. |
shownInApply
|
This option should be shown in the apply menu when applying values to a Drive item. |
badgeColors
|
The colors to use for the badge. Changed to Google Material colors based on the chosen |
darkBadgeColors
|
The dark-mode color to use for the badge. Changed to Google Material colors based on the chosen |
badgePriority
|
The priority of this badge. Used to compare and sort between multiple badges. A lower number means the badge should be shown first. When a badging configuration is not present, this will be 0. Otherwise, this will be set to |
BadgeColors
The color derived from BadgeConfig and changed to the closest recommended supported color.
JSON representation |
---|
{ "backgroundColor" : { object ( |
Fields | |
---|---|
backgroundColor
|
Output only. Badge background that pairs with the foreground. |
foregroundColor
|
Output only. Badge foreground that pairs with the background. |
soloColor
|
Output only. Color that can be used for text without a background. |
SchemaCapabilities
The capabilities related to this choice when editing the choice.
JSON representation |
---|
{ "canUpdate" : boolean , "canDelete" : boolean , "canDisable" : boolean , "canEnable" : boolean } |
Fields | |
---|---|
canUpdate
|
Whether the user can update this choice. |
canDelete
|
Whether the user can delete this choice. |
canDisable
|
Whether the user can disable this choice. |
canEnable
|
Whether the user can enable this choice. |
AppliedCapabilities
The capabilities related to this choice on applied metadata.
JSON representation |
---|
{ "canRead" : boolean , "canSearch" : boolean , "canSelect" : boolean } |
Fields | |
---|---|
canRead
|
Whether the user can read related applied metadata on items. |
canSearch
|
Whether the user can use this choice in search queries. |
canSelect
|
Whether the user can select this choice on an item. |
LockStatus
Contains information about whether a label component should be considered locked.
JSON representation |
---|
{ "locked" : boolean } |
Fields | |
---|---|
locked
|
Output only. Indicates whether this label component is the (direct) target of a LabelLock. A label component can be implicitly locked even if it's not the direct target of a LabelLock, in which case this field is set to false. |
UserOptions
Options for the user field type.
JSON representation |
---|
{
"listOptions"
:
{
object (
|
Fields | |
---|---|
listOptions
|
When specified, indicates that this field supports a list of values. Once the field is published, this cannot be changed. |
Properties
The basic properties of the field.
JSON representation |
---|
{ "displayName" : string , "required" : boolean , "insertBeforeField" : string } |
Fields | |
---|---|
displayName
|
Required. The display text to show in the UI identifying this field. |
required
|
Whether the field should be marked as required. |
insertBeforeField
|
Input only. Insert or move this field before the indicated field. If empty, the field is placed at the end of the list. |
DisplayHints
UI display hints for rendering a field.
JSON representation |
---|
{ "required" : boolean , "disabled" : boolean , "hiddenInSearch" : boolean , "shownInApply" : boolean } |
Fields | |
---|---|
required
|
Whether the field should be shown as required in the UI. |
disabled
|
Whether the field should be shown in the UI as disabled. |
shownInApply
|
This field should be shown in the apply menu when applying values to a Drive item. |
SchemaCapabilities
The capabilities related to this field when editing the field.
JSON representation |
---|
{ "canUpdate" : boolean , "canDelete" : boolean , "canDisable" : boolean , "canEnable" : boolean } |
Fields | |
---|---|
canUpdate
|
Whether the user can change this field. |
canDelete
|
Whether the user can delete this field. The user must have permission and the field must be deprecated. |
canDisable
|
Whether the user can disable this field. The user must have permission and this field must not already be disabled. |
canEnable
|
Whether the user can enable this field. The user must have permission and this field must be disabled. |
AppliedCapabilities
The capabilities related to this field on applied metadata.
JSON representation |
---|
{ "canRead" : boolean , "canSearch" : boolean , "canWrite" : boolean } |
Fields | |
---|---|
canRead
|
Whether the user can read related applied metadata on items. |
canSearch
|
Whether the user can search for Drive items referencing this field. |
canWrite
|
Whether the user can set this field on Drive items. |
Methods |
|
---|---|
|
Creates a new Label. |
|
Permanently deletes a Label and related metadata on Drive Items. |
|
Updates a single Label by applying a set of update requests resulting in a new draft revision. |
|
Disable a published Label. |
|
Enable a disabled Label and restore it to its published state. |
|
Get a label by its resource name. |
|
List labels. |
|
Publish all draft changes to the Label. |
|
Updates a Label's CopyMode
. |
|
Updates a Label's permissions. |