public static async Task <BoxMetadataTemplate> CreateMetadataTemplate(Dictionary <string, object> metadata = null, CommandScope commandScope = CommandScope.Test, CommandAccessLevel accessLevel = CommandAccessLevel.Admin) { var createMetadataTemplateCommand = new CreateMetadataTemplateCommand(GetUniqueName("template_key", false), ToStringMetadataFields(metadata), commandScope, accessLevel); await ExecuteCommand(createMetadataTemplateCommand); return(createMetadataTemplateCommand.MetadataTemplate); }
public static async Task <Tuple <BoxFile, string> > CreateSmallFileWithMetadata (string parentId = "0", Dictionary <string, object> metadata = null, CommandScope commandScope = CommandScope.Test, CommandAccessLevel accessLevel = CommandAccessLevel.Admin) { var createFileCommand = new CreateFileCommand(GetUniqueName("file"), GetSmallFilePath(), parentId, commandScope, accessLevel); await ExecuteCommand(createFileCommand); var createMetadataTemplateCommand = new CreateMetadataTemplateCommand(GetUniqueName("template_key", false), ToStringMetadataFields(metadata), commandScope, accessLevel); await ExecuteCommand(createMetadataTemplateCommand); var applyMetadataCommand = new ApplyMetadataCommand(createMetadataTemplateCommand.TemplateKey, createFileCommand.FileId, metadata, commandScope, accessLevel); await ExecuteCommand(applyMetadataCommand); return(Tuple.Create(createFileCommand.File, createMetadataTemplateCommand.TemplateKey)); }