Example #1
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "Update a collaboration.";
     _id = command.Argument("collaborationId",
                            "ID of the collaboration");
     _path              = FilePathOption.ConfigureOption(command);
     _bulkPath          = BulkFilePathOption.ConfigureOption(command);
     _save              = SaveOption.ConfigureOption(command);
     _fileFormat        = FileFormatOption.ConfigureOption(command);
     _fieldsOption      = FieldsOption.ConfigureOption(command);
     _editor            = command.Option("--editor", "Set the role to editor.", CommandOptionType.NoValue);
     _viewer            = command.Option("--viewer", "Set the role to viewer.", CommandOptionType.NoValue);
     _previewer         = command.Option("--previewer", "Set the role to previewer.", CommandOptionType.NoValue);
     _uploader          = command.Option("--uploader", "Set the role to uploader.", CommandOptionType.NoValue);
     _previewerUploader = command.Option("--previewer-uploader", "Set the role to previewer uploader.", CommandOptionType.NoValue);
     _viewerUploader    = command.Option("--viewer-uploader", "Set the role to viewer uploader.", CommandOptionType.NoValue);
     _coowner           = command.Option("--co-owner", "Set the role to co-owner.", CommandOptionType.NoValue);
     _owner             = command.Option("--owner", "Set the role to owner.", CommandOptionType.NoValue);
     _role              = command.Option("-r|--role", "An option to manually enter the role", CommandOptionType.SingleValue);
     _status            = command.Option("--status", "Update the collaboration status", CommandOptionType.SingleValue);
     _canViewPath       = command.Option("--can-view-path", "Whether view path collaboration feature is enabled or not.", CommandOptionType.NoValue);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "Create a collaboration for a Box item.";
            _path              = FilePathOption.ConfigureOption(command);
            _bulkPath          = BulkFilePathOption.ConfigureOption(command);
            _save              = SaveOption.ConfigureOption(command);
            _fileFormat        = FileFormatOption.ConfigureOption(command);
            _fieldsOption      = FieldsOption.ConfigureOption(command);
            _editor            = command.Option("--editor", "Set the role to editor.", CommandOptionType.NoValue);
            _viewer            = command.Option("--viewer", "Set the role to viewer.", CommandOptionType.NoValue);
            _previewer         = command.Option("--previewer", "Set the role to previewer.", CommandOptionType.NoValue);
            _uploader          = command.Option("--uploader", "Set the role to uploader.", CommandOptionType.NoValue);
            _previewerUploader = command.Option("--previewer-uploader", "Set the role to previewer uploader.", CommandOptionType.NoValue);
            _viewerUploader    = command.Option("--viewer-uploader", "Set the role to viewer uploader.", CommandOptionType.NoValue);
            _coowner           = command.Option("--co-owner", "Set the role to co-owner.", CommandOptionType.NoValue);
            _role              = command.Option("-r|--role", "An option to manually enter the role", CommandOptionType.SingleValue);
            _userId            = command.Option("--user-id", "Id for user to collaborate", CommandOptionType.SingleValue);
            _groupId           = command.Option("--group-id", "Id for group to collaborate", CommandOptionType.SingleValue);
            _login             = command.Option("--login", "Login for user to collaborate", CommandOptionType.SingleValue);
            _canViewPath       = command.Option("--can-view-path", "Whether view path collaboration feature is enabled or not.", CommandOptionType.NoValue);
            _idOnly            = IdOnlyOption.ConfigureOption(command);
            _id = command.Argument("boxItemId",
                                   "Id of the Box item");
            if (base._t == BoxType.enterprise)
            {
                _type = command.Argument("boxItemType", "Type of Box item");
            }

            command.OnExecute(async() =>
            {
                return(await this.Execute());
            });
            base.Configure(command);
        }
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all pending collaborations for a user.";
     _save         = SaveOption.ConfigureOption(command);
     _fileFormat   = FileFormatOption.ConfigureOption(command);
     _fieldsOption = FieldsOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Example #4
0
        public override void Configure(CommandLineApplication command)
        {
            _app = command;
            command.Description = "Get an individual collaboration.";
            _fieldsOption       = FieldsOption.ConfigureOption(command);
            _id = command.Argument("collaborationId",
                                   "Id of the collaboration");

            command.OnExecute(async() =>
            {
                return(await this.Execute());
            });
            base.Configure(command);
        }
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all collaborations on a Box item.";
     _id = command.Argument("boxItemId",
                            "Id of the Box item");
     _save         = SaveOption.ConfigureOption(command);
     _fileFormat   = FileFormatOption.ConfigureOption(command);
     _fieldsOption = FieldsOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Example #6
0
 public override void Configure(CommandLineApplication command)
 {
     _app = command;
     command.Description = "List all Box users.";
     _managedUsers       = ManagedUsersOnlyOption.ConfigureOption(command);
     _appUsers           = AppUsersOnlyOption.ConfigureOption(command);
     _save         = SaveOption.ConfigureOption(command);
     _path         = FilePathOption.ConfigureOption(command);
     _fileFormat   = FileFormatOption.ConfigureOption(command);
     _fieldsOption = FieldsOption.ConfigureOption(command);
     _limit        = LimitOption.ConfigureOption(command);
     command.OnExecute(async() =>
     {
         return(await this.Execute());
     });
     base.Configure(command);
 }
Example #7
0
        /// <summary>
        /// Allows you to specify the fields in the select list
        /// </summary>
        /// <typeparam name="TEntity"></typeparam>
        /// <param name="query"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public static IQueryLite <TEntity> Fields <TEntity>(this IQueryLite <TEntity> query, FieldsOption options, params string[] fields)
        {
            if (fields == null || fields.Length == 0)
            {
                return(query);
            }

            var metadata = typeof(TEntity).GetEntityMetadata();

            var invalidField = fields.FirstOrDefault(x => {
                if (x == "*")
                {
                    return(false);
                }
                PropertyMetadata propMetadata;
                if (metadata.Properties.TryGetValue(x, out propMetadata))
                {
                    return(propMetadata.SqlField == null && !propMetadata.IsLocalizedFiled);
                }
                return(true);
            });

            if (invalidField != null)
            {
                throw new ArgumentException(string.Format("\"{0}\" is an invalid field for \"{1}\"", invalidField, typeof(TEntity).Name));
            }

            List <string> sortedFields = new List <string>(fields);

            // Ordenamos los campos por dos razones:
            // 1.- evitar tener que crear un nuero método dinámico de carga de un datareader cuando son los mismos campos especificados en orden diferente
            // 2.- acelerar la búsqueda de los campos de la clave primaria y EntityRowVersion
            sortedFields.Sort(StringComparer.InvariantCultureIgnoreCase);

            if ((options & FieldsOption.IncludePrimaryKey) != 0)
            {
                sortedFields.EnsurePrimaryKey(metadata);
            }

            if ((options & FieldsOption.IncludeEntityRowVersion) != 0)
            {
                sortedFields.EnsureField(metadata, query.DataService.SpecialFieldNames.EntityRowVersionFieldName);
            }

            query.FieldList = sortedFields;
            return(query);
        }