示例#1
0
        public override ITagadaBuilder DeleteAsync <TCommand, TResult>(string path, Func <TCommand, Task <TResult> > function)
        {
            base.DeleteAsync(path, function);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath = TopPath.Trim('/');
                var    operationSplittedNames = path.Split("/", StringSplitOptions.RemoveEmptyEntries);
                string operationName          = operationSplittedNames[0];

                var commandProperties   = CachedTypes.GetTypeProperties(typeof(TCommand));
                var operationParameters = _getNonBodyParametersFromQueryCommand(schemaRegistry, commandProperties, operationSplittedNames);

                return(new Operation
                {
                    OperationId = topPath.Capitalize() +
                                  string.Join("", operationSplittedNames.Select(n => GetOperationPartName(n))) +
                                  "Delete",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = new List <string>(),
                    Produces = _producesJson,
                    Parameters = operationParameters.Cast <IParameter>().ToList(),
                    Responses = _createSuccessResponses(schemaRegistry, function.Method.ReturnType)
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Delete, addSwaggerOperation);

            return(this);
        }
示例#2
0
        public override ITagadaBuilder DeleteAsync <TResult>(string path, Func <Task <TResult> > function)
        {
            base.DeleteAsync(path, function);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath       = TopPath.Trim('/');
                string operationName = path.Split("/", StringSplitOptions.RemoveEmptyEntries)[0];

                return(new Operation
                {
                    OperationId = topPath.Capitalize() + operationName.Capitalize() + "Delete",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = new List <string>(),
                    Produces = _producesJson,
                    Responses = _createSuccessResponses(schemaRegistry, function.Method.ReturnType)
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Delete, addSwaggerOperation);

            return(this);
        }
示例#3
0
        public override ITagadaBuilder DeleteAsync(string path, Func <Task> action)
        {
            base.DeleteAsync(path, action);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath       = TopPath.Trim('/');
                string operationName = path.Split("/", StringSplitOptions.RemoveEmptyEntries)[0];

                return(new Operation
                {
                    OperationId = topPath.Capitalize() + operationName.Capitalize() + "Delete",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = new List <string>(),
                    Responses = new Dictionary <string, Response>
                    {
                        {
                            "200",
                            new Response
                            {
                                Description = "Success"
                            }
                        }
                    }
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Delete, addSwaggerOperation);

            return(this);
        }
示例#4
0
        public override ITagadaBuilder PutAsync <TCommand>(string path, Func <TCommand, Task> action)
        {
            base.PutAsync(path, action);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath       = TopPath.Trim('/');
                string operationName = path.Split("/", StringSplitOptions.RemoveEmptyEntries)[0];

                return(new Operation
                {
                    OperationId = topPath.Capitalize() + operationName.Capitalize() + "Put",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = _consumesJson,
                    Produces = _producesJson,
                    Parameters = _getCommandParameters(schemaRegistry, typeof(TCommand)),
                    Responses = new Dictionary <string, Response>
                    {
                        {
                            "200",
                            new Response
                            {
                                Description = "Success"
                            }
                        }
                    }
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Put, addSwaggerOperation);

            return(this);
        }
示例#5
0
        public override ITagadaBuilder Put <TCommand, TResult>(string path, Func <TCommand, TResult> function)
        {
            base.Put(path, function);

            Operation addSwaggerOperation(ISchemaRegistry schemaRegistry)
            {
                string topPath       = TopPath.Trim('/');
                string operationName = path.Split("/", StringSplitOptions.RemoveEmptyEntries)[0];

                return(new Operation
                {
                    OperationId = topPath.Capitalize() + operationName.Capitalize() + "Put",
                    Tags = new List <string> {
                        operationName
                    },
                    Consumes = _consumesJson,
                    Produces = _producesJson,
                    Parameters = _getCommandParameters(schemaRegistry, typeof(TCommand)),
                    Responses = _createSuccessResponses(schemaRegistry, function.Method.ReturnType)
                });
            }

            AddSwaggerOperationFunc(path, SwaggerOperationMethod.Put, addSwaggerOperation);

            return(this);
        }
示例#6
0
        /*
         * キー登録処理。複数同時処理はやめて単一の処理にしておきます
         */
        public void CreateValue(TopPath toppath, string path, string name, string value)
        {
            switch (toppath)
            {
            case TopPath.CurrentUser:
                key = Registry.CurrentUser;
                break;

            case TopPath.etc:
                throw new Exception("この選択肢は未実装です 2017/3");
                break;
            }

            key = key.CreateSubKey(@path);
            key.SetValue(name, value);
        }