Method: labels.delta

通过应用一组更新请求来更新单个标签,从而生成新的草稿修订版本。“一刀切”式更新:如果任何更新请求无效,则不应用任何更改。必须先发布生成的草稿修订版本,然后更改才能用于云端硬盘内容。

HTTP 请求

POST https://drivelabels.googleapis.com/v2/{name=labels/*}:delta

网址采用 gRPC 转码语法。

路径参数

参数
name

string

必需。要更新的标签的资源名称。

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "writeControl": {
    object (WriteControl)
  },
  "requests": [
    {
      object (Request)
    }
  ],
  "useAdminAccess": boolean,
  "view": enum (LabelView),
  "languageCode": string
}
字段
writeControl

object (WriteControl)

控制写入请求的执行方式。

requests[]

object (Request)

要应用于标签的更新列表。请求将按照指定的顺序进行应用。

useAdminAccess

boolean

设置为 true 以使用用户的管理员凭据。在允许访问之前,服务器会先验证用户是否为唱片公司的管理员。

view

enum (LabelView)

指定后,系统将仅返回属于指定视图的特定字段。

languageCode

string

include_label_in_responsetrue 时,用于评估本地化字段标签的 BCP-47 语言代码。

响应正文

如果成功,响应正文将包含结构如下的数据:

对标签更新的响应。

JSON 表示法
{
  "responses": [
    {
      object (Response)
    }
  ],
  "updatedLabel": {
    object (Label)
  }
}
字段
responses[]

object (Response)

对更新的回复。此表与更新是 1 对 1 的映射,但对某些请求的响应可能为空。

updatedLabel

object (Label)

应用更新之后的标签。仅当 [BatchUpdateLabelResponse2.include_label_in_response] 为 true 且没有错误时,才会设置此字段。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/drive.labels
  • https://www.googleapis.com/auth/drive.admin.labels

有关详情,请参阅授权指南

请求

要应用于标签的一类更新。

JSON 表示法
{

  // Union field kind can be only one of the following:
  "updateLabel": {
    object (UpdateLabelPropertiesRequest)
  },
  "createField": {
    object (CreateFieldRequest)
  },
  "updateField": {
    object (UpdateFieldPropertiesRequest)
  },
  "updateFieldType": {
    object (UpdateFieldTypeRequest)
  },
  "enableField": {
    object (EnableFieldRequest)
  },
  "disableField": {
    object (DisableFieldRequest)
  },
  "deleteField": {
    object (DeleteFieldRequest)
  },
  "createSelectionChoice": {
    object (CreateSelectionChoiceRequest)
  },
  "updateSelectionChoiceProperties": {
    object (UpdateSelectionChoicePropertiesRequest)
  },
  "enableSelectionChoice": {
    object (EnableSelectionChoiceRequest)
  },
  "disableSelectionChoice": {
    object (DisableSelectionChoiceRequest)
  },
  "deleteSelectionChoice": {
    object (DeleteSelectionChoiceRequest)
  }
  // End of list of possible types for union field kind.
}
字段
联合字段 kind。更新的类型。必须且只能有一个字段。kind 只能是下列其中一项:
updateLabel

object (UpdateLabelPropertiesRequest)

更新标签属性。

createField

object (CreateFieldRequest)

创建新的字段。

updateField

object (UpdateFieldPropertiesRequest)

更新字段的基本属性。

updateFieldType

object (UpdateFieldTypeRequest)

更新字段类型和/或类型选项。

enableField

object (EnableFieldRequest)

启用字段。

disableField

object (DisableFieldRequest)

停用字段。

deleteField

object (DeleteFieldRequest)

从标签中删除 Field。

createSelectionChoice

object (CreateSelectionChoiceRequest)

在选择字段中创建选择。

updateSelectionChoiceProperties

object (UpdateSelectionChoicePropertiesRequest)

更新 Selection Field 中的 Choice 属性。

enableSelectionChoice

object (EnableSelectionChoiceRequest)

启用选择字段内的选项。

disableSelectionChoice

object (DisableSelectionChoiceRequest)

停用选择字段内的选项。

deleteSelectionChoice

object (DeleteSelectionChoiceRequest)

删除选择字段内的选项。

UpdateLabelPropertiesRequest

更新标签的基本属性。

JSON 表示法
{
  "updateMask": string,
  "properties": {
    object (Properties)
  }
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。根 label_properties 是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

properties

object (Properties)

必需。要更新的标签属性。

CreateFieldRequest

请求在标签内创建字段。

JSON 表示法
{
  "field": {
    object (Field)
  }
}
字段
field

object (Field)

必需。要创建的字段。

UpdateFieldPropertiesRequest

请求更新 Field 属性。

JSON 表示法
{
  "updateMask": string,
  "id": string,
  "properties": {
    object (Properties)
  }
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。根 properties 是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

id

string

必需。要更新的字段。

properties

object (Properties)

必需。基本字段属性。

UpdateFieldTypeRequest

请求更改字段类型。

JSON 表示法
{
  "updateMask": string,
  "id": string,

  // Union field type_options can be only one of the following:
  "textOptions": {
    object (TextOptions)
  },
  "longTextOptions": {
    object (LongTextOptions)
  },
  "integerOptions": {
    object (IntegerOptions)
  },
  "dateOptions": {
    object (DateOptions)
  },
  "selectionOptions": {
    object (SelectionOptions)
  },
  "userOptions": {
    object (UserOptions)
  }
  // End of list of possible types for union field type_options.
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。type_options 的根是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

id

string

必需。要更新的字段。

联合字段 type_options

type_options 只能是下列其中一项:

textOptions

object (TextOptions)

将字段更新为“文本”。

longTextOptions

object (LongTextOptions)

将字段更新为长文本。

integerOptions

object (IntegerOptions)

将字段更新为整数。

dateOptions

object (DateOptions)

将字段更新为“日期”。

selectionOptions

object (SelectionOptions)

将字段更新为“所选内容”。

userOptions

object (UserOptions)

将字段更新为“用户”。

LongTextOptions

用于选择“Long Text”字段类型的选项。

JSON 表示法
{
  "minLength": integer,
  "maxLength": integer
}
字段
minLength

integer

仅供输出。文本字段的最小有效长度。

maxLength

integer

仅供输出。文本字段的最大有效长度。

EnableFieldRequest

请求启用字段。

JSON 表示法
{
  "id": string
}
字段
id

string

必需。要启用的字段的 ID。

DisableFieldRequest

请求停用字段。

JSON 表示法
{
  "updateMask": string,
  "id": string,
  "disabledPolicy": {
    object (DisabledPolicy)
  }
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。根 disabledPolicy 是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

id

string

必需。要停用的字段的键。

disabledPolicy

object (DisabledPolicy)

必需。字段已停用的政策。

DeleteFieldRequest

请求删除字段。

JSON 表示法
{
  "id": string
}
字段
id

string

必需。要删除的字段的 ID。

CreateSelectionChoiceRequest

请求创建选择选项。

JSON 表示法
{
  "fieldId": string,
  "choice": {
    object (Choice)
  }
}
字段
fieldId

string

必需。将在其中创建选项的选择字段。

choice

object (Choice)

必需。创建选项。

UpdateSelectionChoicePropertiesRequest

请求更新 Choice 属性。

JSON 表示法
{
  "updateMask": string,
  "fieldId": string,
  "id": string,
  "properties": {
    object (Properties)
  }
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。根 properties 是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

fieldId

string

必需。要更新的选择字段。

id

string

必需。要更新的选项。

properties

object (Properties)

必需。要更新的 Choice 属性。

EnableSelectionChoiceRequest

请求启用选项。

JSON 表示法
{
  "fieldId": string,
  "id": string
}
字段
fieldId

string

必需。将在其中启用选项的选择字段。

id

string

必需。选择启用选项。

DisableSelectionChoiceRequest

请求停用某个选项。

JSON 表示法
{
  "updateMask": string,
  "fieldId": string,
  "id": string,
  "disabledPolicy": {
    object (DisabledPolicy)
  }
}
字段
updateMask

string (FieldMask format)

应更新的字段。必须至少指定一个字段。根 disabledPolicy 是隐式的,不应指定。单个 * 可用作更新每个字段的简写形式。

fieldId

string

必需。将在其中停用选项的 Selection 字段。

id

string

必需。选择停用选项。

disabledPolicy

object (DisabledPolicy)

必需。要更新的已停用政策。

DeleteSelectionChoiceRequest

请求删除选项。

JSON 表示法
{
  "fieldId": string,
  "id": string
}
字段
fieldId

string

必需。将要删除选项的 Selection 字段。

id

string

必需。选择删除。

响应

来自更新的单个响应。

JSON 表示法
{

  // Union field response can be only one of the following:
  "updateLabel": {
    object (UpdateLabelPropertiesResponse)
  },
  "createField": {
    object (CreateFieldResponse)
  },
  "updateField": {
    object (UpdateFieldPropertiesResponse)
  },
  "updateFieldType": {
    object (UpdateFieldTypeResponse)
  },
  "enableField": {
    object (EnableFieldResponse)
  },
  "disableField": {
    object (DisableFieldResponse)
  },
  "deleteField": {
    object (DeleteFieldResponse)
  },
  "createSelectionChoice": {
    object (CreateSelectionChoiceResponse)
  },
  "updateSelectionChoiceProperties": {
    object (UpdateSelectionChoicePropertiesResponse)
  },
  "enableSelectionChoice": {
    object (EnableSelectionChoiceResponse)
  },
  "disableSelectionChoice": {
    object (DisableSelectionChoiceResponse)
  },
  "deleteSelectionChoice": {
    object (DeleteSelectionChoiceResponse)
  }
  // End of list of possible types for union field response.
}
字段
联合字段 response。相应请求的响应。response 只能是下列其中一项:
updateLabel

object (UpdateLabelPropertiesResponse)

更新了标签的基本属性。

createField

object (CreateFieldResponse)

创建新的字段。

updateField

object (UpdateFieldPropertiesResponse)

更新字段的基本属性。

updateFieldType

object (UpdateFieldTypeResponse)

更新字段类型和/或类型选项。

enableField

object (EnableFieldResponse)

启用字段。

disableField

object (DisableFieldResponse)

停用字段。

deleteField

object (DeleteFieldResponse)

从标签中删除 Field。

createSelectionChoice

object (CreateSelectionChoiceResponse)

创建新的选择列表选项,以添加到选择字段。

updateSelectionChoiceProperties

object (UpdateSelectionChoicePropertiesResponse)

更新选择字段内的选项。

enableSelectionChoice

object (EnableSelectionChoiceResponse)

启用选择字段内的选项。

disableSelectionChoice

object (DisableSelectionChoiceResponse)

停用选择字段内的选项。

deleteSelectionChoice

object (DeleteSelectionChoiceResponse)

从选择字段中删除选项。

UpdateLabelPropertiesResponse

更新标签属性后的响应。

CreateFieldResponse

创建字段后的响应。

JSON 表示法
{
  "id": string,
  "priority": integer
}
字段
id

string

已创建字段的字段。如果创建请求中留空,系统会自动生成密钥,您可在此处识别密钥。

priority

integer

已创建字段的优先级。优先级可能会不同于指定的优先级,以确保字段 (1-n) 之间具有连续的优先级。

UpdateFieldPropertiesResponse

更新 Field 属性后的响应。

JSON 表示法
{
  "priority": integer
}
字段
priority

integer

已更新字段的优先级。优先级可能会不同于指定的优先级,以确保字段 (1-n) 之间具有连续的优先级。

UpdateFieldTypeResponse

更新字段类型后的响应。

EnableFieldResponse

字段启用后的响应。

DisableFieldResponse

停用以下字段后的响应。

DeleteFieldResponse

删除字段后的响应。

CreateSelectionChoiceResponse

创建选择选项后的响应。

JSON 表示法
{
  "fieldId": string,
  "id": string
}
字段
fieldId

string

由服务器生成的字段 ID。

id

string

由服务器为字段内所创建选项生成的 ID

UpdateSelectionChoicePropertiesResponse

在更新选择选项属性后响应。

JSON 表示法
{
  "priority": integer
}
字段
priority

integer

已更新选项的优先级。优先级可能会与指定的优先级有所不同,以确保选项之间的优先级是连续的 (1-n)。

EnableSelectionChoiceResponse

启用选项后的响应。

DisableSelectionChoiceResponse

停用选项后的响应。

DeleteSelectionChoiceResponse

删除选项后的回复。