public Parameter(TypeDefinition type, ParameterIn parameterIn, bool isRequired, string description, string collectionFormat)
 {
     this.Type = type;
     this.ParameterIn = parameterIn;
     this.IsRequired = isRequired;
     this.Description = description;
     this.CollectionFormat = collectionFormat;
 }
Exemple #2
0
 public Parameter(TypeDefinition type, ParameterIn parameterIn, bool isRequired, string description, string collectionFormat)
 {
     this.Type             = type;
     this.ParameterIn      = parameterIn;
     this.IsRequired       = isRequired;
     this.Description      = description;
     this.CollectionFormat = collectionFormat;
 }
        /// <summary>
        /// Add the location of the parameter. Use <see cref="BodyParameterBuilder"/> for body parameters
        /// </summary>
        /// <param name="parameterIn">
        /// The parameter in.
        /// </param>
        /// <returns>
        /// The <see cref="ParameterBuilder"/>.
        /// </returns>
        public ParameterBuilder In(ParameterIn parameterIn)
        {
            if (parameterIn == ParameterIn.Body)
            {
                throw new InvalidOperationException("Use a BodyParameterBuilder to create Parameter objects where the parameter is in the Body.");
            }

            this.parameterIn = parameterIn;
            return(this);
        }
        public async Task <HospMonData> Authentication([FromBody] ParameterIn parameterIn)
        {
            HospMonData hospMonData = new HospMonData();
            var         data        = await passReBLL.SaveForm(new PassRecordEntity
            {
                sId = parameterIn.sId
            }, "webapi");

            hospMonData.Code    = data.Tag;
            hospMonData.Message = data.Message;
            return(hospMonData);
        }
Exemple #5
0
 private IEnumerable <Parameter> SelectParameterByLocation(OpenApiEndpointModel parentEndpoint,
                                                           ParameterIn paramIn)
 {
     return(parentEndpoint.Parameters?
            .Where(p => p.In == paramIn)
            .Select(p => new Parameter()
     {
         Name = p.Name,
         Required = p.Required,
         Type = _primitiveService.GetType(p.Schema,
                                          parentEndpoint.ShortName + p.Name)
     }));
 }
 public RouteParamAttribute(ParameterIn paramIn, string name = null)
     : base(name)
 {
     this.ParamIn = paramIn;
 }
        // Token: 0x060006CD RID: 1741 RVA: 0x00035310 File Offset: 0x00033510
        public static StoreObjectId GetStoreObjectId(HttpRequest request, string parameterName, bool required, ParameterIn parameterIn)
        {
            string text;

            if (parameterIn == ParameterIn.QueryString)
            {
                text = Utilities.GetQueryStringParameter(request, parameterName, required);
            }
            else
            {
                text = Utilities.GetFormParameter(request, parameterName, required);
            }
            if (text == null)
            {
                return(null);
            }
            return(Utilities.CreateStoreObjectId(UserContextManager.GetUserContext().MailboxSession, text));
        }
        // Token: 0x060006C9 RID: 1737 RVA: 0x00035264 File Offset: 0x00033464
        public static int GetIntValueFromRequest(HttpRequest request, string parameterName, ParameterIn parameterIn, bool required, int defaultValue)
        {
            if (request == null)
            {
                throw new ArgumentNullException("HttpRequest");
            }
            if (string.IsNullOrEmpty(parameterName))
            {
                throw new ArgumentException("parameterName is null or empty.");
            }
            string text = null;

            if (parameterIn == ParameterIn.QueryString)
            {
                text = Utilities.GetQueryStringParameter(request, parameterName, required);
                if (text == null)
                {
                    return(defaultValue);
                }
            }
            else if (parameterIn == ParameterIn.Form)
            {
                text = Utilities.GetFormParameter(request, parameterName, required);
                if (text == null || (!required && string.IsNullOrEmpty(text)))
                {
                    return(defaultValue);
                }
            }
            int result;

            if (!int.TryParse(text, out result))
            {
                throw new OwaInvalidRequestException(parameterName + " should be a valid number");
            }
            return(result);
        }
Exemple #9
0
 public RouteParamAttribute(ParameterIn paramIn, string name = null)
     : base(name)
 {
     this.ParamIn = paramIn;
 }
 public RouteParamAttribute(ParameterIn paramIn, string name = null)
     : base(name)
 {
     this.ParamIn   = paramIn;
     this.ParamType = typeof(string);
 }
        public async Task <HospMonData <List <HospMonitorInLinePeopleViewModel> > > QueryInPatList([FromBody] ParameterIn parameterIn)
        {
            HospMonData <List <HospMonitorInLinePeopleViewModel> > hospMonData = new HospMonData <List <HospMonitorInLinePeopleViewModel> >();
            var data = await inLineBLL.GetInLineDetailsList(new Model.Param.HospMonitorManage.InlinePeopleListParam
            {
                sId   = parameterIn.sId,
                sName = parameterIn.sName
            });

            hospMonData.Code    = data.Tag;
            hospMonData.Message = data.Message;
            hospMonData.Data    = data.Data;
            return(hospMonData);
        }
        public void ShouldNot_Required_WhenNotSetIsRequiredAndParameterInIsNotPathOrBody(ParameterIn parameterIn)
        {
            var parameter = builder.Name(name).In(parameterIn).Build();

            Assert.False(parameter.Required.HasValue);
        }