Skip to content

Latest commit

 

History

History
288 lines (186 loc) · 10.1 KB

MetadataTemplates.md

File metadata and controls

288 lines (186 loc) · 10.1 KB

IMetadataTemplatesManager

Find metadata template by instance ID

Finds a metadata template by searching for the ID of an instance of the template.

This operation is performed by calling function GetMetadataTemplatesByInstanceId.

See the endpoint docs at API Reference.

await client.MetadataTemplates.GetMetadataTemplatesByInstanceIdAsync(queryParams: new GetMetadataTemplatesByInstanceIdQueryParams(metadataInstanceId: NullableUtils.Unwrap(createdMetadataInstance.Id)));

Arguments

  • queryParams GetMetadataTemplatesByInstanceIdQueryParams
    • Query parameters of getMetadataTemplatesByInstanceId method
  • headers GetMetadataTemplatesByInstanceIdHeaders
    • Headers of getMetadataTemplatesByInstanceId method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplates.

Returns a list containing the 1 metadata template that matches the instance ID.

Get metadata template by name

Retrieves a metadata template by its scope and templateKey values.

To find the scope and templateKey for a template, list all templates for an enterprise or globally, or list all templates applied to a file or folder.

This operation is performed by calling function GetMetadataTemplate.

See the endpoint docs at API Reference.

await client.MetadataTemplates.GetMetadataTemplateAsync(scope: GetMetadataTemplateScope.Enterprise, templateKey: NullableUtils.Unwrap(template.TemplateKey));

Arguments

  • scope GetMetadataTemplateScope
    • The scope of the metadata template Example: "global"
  • templateKey string
    • The name of the metadata template Example: "properties"
  • headers GetMetadataTemplateHeaders
    • Headers of getMetadataTemplate method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplate.

Returns the metadata template matching the scope and template name.

Update metadata template

Updates a metadata template.

The metadata template can only be updated if the template already exists.

The update is applied atomically. If any errors occur during the application of the operations, the metadata template will not be changed.

This operation is performed by calling function UpdateMetadataTemplate.

See the endpoint docs at API Reference.

await client.MetadataTemplates.UpdateMetadataTemplateAsync(scope: UpdateMetadataTemplateScope.Enterprise, templateKey: templateKey, requestBody: Array.AsReadOnly(new [] {new UpdateMetadataTemplateRequestBody(op: UpdateMetadataTemplateRequestBodyOpField.AddField) { FieldKey = "newfieldname", Data = new Dictionary<string, object>() { { "type", "string" }, { "displayName", "newFieldName" } } }}));

Arguments

  • scope UpdateMetadataTemplateScope
    • The scope of the metadata template Example: "global"
  • templateKey string
    • The name of the metadata template Example: "properties"
  • requestBody IReadOnlyList<UpdateMetadataTemplateRequestBody>
    • Request body of updateMetadataTemplate method
  • headers UpdateMetadataTemplateHeaders
    • Headers of updateMetadataTemplate method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplate.

Returns the updated metadata template, with the custom template data included.

Remove metadata template

Delete a metadata template and its instances. This deletion is permanent and can not be reversed.

This operation is performed by calling function DeleteMetadataTemplate.

See the endpoint docs at API Reference.

await client.MetadataTemplates.DeleteMetadataTemplateAsync(scope: DeleteMetadataTemplateScope.Enterprise, templateKey: NullableUtils.Unwrap(template.TemplateKey));

Arguments

  • scope DeleteMetadataTemplateScope
    • The scope of the metadata template Example: "global"
  • templateKey string
    • The name of the metadata template Example: "properties"
  • headers DeleteMetadataTemplateHeaders
    • Headers of deleteMetadataTemplate method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type null.

Returns an empty response when the metadata template is successfully deleted.

Get metadata template by ID

Retrieves a metadata template by its ID.

This operation is performed by calling function GetMetadataTemplateById.

See the endpoint docs at API Reference.

await client.MetadataTemplates.GetMetadataTemplateByIdAsync(templateId: template.Id);

Arguments

  • templateId string
    • The ID of the template Example: "f7a9891f"
  • headers GetMetadataTemplateByIdHeaders
    • Headers of getMetadataTemplateById method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplate.

Returns the metadata template that matches the ID.

List all global metadata templates

Used to retrieve all generic, global metadata templates available to all enterprises using Box.

This operation is performed by calling function GetGlobalMetadataTemplates.

See the endpoint docs at API Reference.

await client.MetadataTemplates.GetGlobalMetadataTemplatesAsync();

Arguments

  • queryParams GetGlobalMetadataTemplatesQueryParams
    • Query parameters of getGlobalMetadataTemplates method
  • headers GetGlobalMetadataTemplatesHeaders
    • Headers of getGlobalMetadataTemplates method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplates.

Returns all of the metadata templates available to all enterprises and their corresponding schema.

List all metadata templates for enterprise

Used to retrieve all metadata templates created to be used specifically within the user's enterprise

This operation is performed by calling function GetEnterpriseMetadataTemplates.

See the endpoint docs at API Reference.

await client.MetadataTemplates.GetEnterpriseMetadataTemplatesAsync();

Arguments

  • queryParams GetEnterpriseMetadataTemplatesQueryParams
    • Query parameters of getEnterpriseMetadataTemplates method
  • headers GetEnterpriseMetadataTemplatesHeaders
    • Headers of getEnterpriseMetadataTemplates method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplates.

Returns all of the metadata templates within an enterprise and their corresponding schema.

Create metadata template

Creates a new metadata template that can be applied to files and folders.

This operation is performed by calling function CreateMetadataTemplate.

See the endpoint docs at API Reference.

await client.MetadataTemplates.CreateMetadataTemplateAsync(requestBody: new CreateMetadataTemplateRequestBody(scope: "enterprise", displayName: templateKey) { TemplateKey = templateKey, Fields = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsField(key: "firstName", displayName: "First name", type: CreateMetadataTemplateRequestBodyFieldsTypeField.String) { Description = "Person first name" },new CreateMetadataTemplateRequestBodyFieldsField(key: "lastName", displayName: "Last name", type: CreateMetadataTemplateRequestBodyFieldsTypeField.String) { Description = "Person last name" },new CreateMetadataTemplateRequestBodyFieldsField(key: "dateOfBirth", displayName: "Birth date", type: CreateMetadataTemplateRequestBodyFieldsTypeField.Date) { Description = "Person date of birth" },new CreateMetadataTemplateRequestBodyFieldsField(key: "age", displayName: "Age", type: CreateMetadataTemplateRequestBodyFieldsTypeField.Float) { Description = "Person age" },new CreateMetadataTemplateRequestBodyFieldsField(key: "hobby", displayName: "Hobby", type: CreateMetadataTemplateRequestBodyFieldsTypeField.MultiSelect) { Description = "Person hobby", Options = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "guitar"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "books")}) }}) });

Arguments

  • requestBody CreateMetadataTemplateRequestBody
    • Request body of createMetadataTemplate method
  • headers CreateMetadataTemplateHeaders
    • Headers of createMetadataTemplate method
  • cancellationToken System.Threading.CancellationToken?
    • Token used for request cancellation.

Returns

This function returns a value of type MetadataTemplate.

The schema representing the metadata template created.