Esempio n. 1
0
 /// <summary>
 /// Creates a new <see cref="OasParameterKey"/> value.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="location">The location of the parameter.</param>
 public OasParameterKey(
     string name = default,
     OasParameterLocation location = default)
     : this()
 {
     Name     = name;
     Location = location;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="OasApiKeySecurityScheme"/> class.
 /// </summary>
 /// <param name="description">The short description for security scheme.</param>
 /// <param name="name">The name of the header, query or cookie parameter to be used.</param>
 /// <param name="location">The location of the API key.</param>
 public OasApiKeySecurityScheme(
     string description            = default,
     string name                   = default,
     OasParameterLocation location = default)
     : base(description)
 {
     Name     = name;
     Location = location;
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasApiKeySecuritySchemeBuilder"/> class.
 /// </summary>
 /// <param name="value">The <see cref="OasApiKeySecurityScheme"/> to copy values from.</param>
 public OasApiKeySecuritySchemeBuilder(OasApiKeySecurityScheme value)
     : base(value)
 {
     if (value is null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     Name     = value.Name;
     Location = value.Location;
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasParameterBuilder"/> class.
 /// </summary>
 /// <param name="value">The <see cref="OasParameter"/> to copy values from.</param>
 public OasParameterBuilder(OasParameter value)
     : base(value)
 {
     if (value is null)
     {
         throw new ArgumentNullException(nameof(value));
     }
     Name     = value.Name;
     Location = value.Location;
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a new instance of the <see cref="OasParameterBody"/> class.
 /// </summary>
 /// <param name="name">The name of the parameter.</param>
 /// <param name="location">The location of the parameter.</param>
 /// <param name="description">The brief description of the parameter.</param>
 /// <param name="options">The parameter options.</param>
 /// <param name="style">The value which indicates how the parameter value will be serialized depending on the type of the parameter value.</param>
 /// <param name="schema">The schema defining the type used for the parameter.</param>
 /// <param name="examples">The list of examples of the parameter.</param>
 /// <param name="content">The map containing the representations for the parameter.</param>
 public OasParameter(
     string name = default,
     OasParameterLocation location   = default,
     string description              = default,
     OasParameterOptions options     = default,
     OasParameterStyle style         = default,
     OasReferable <OasSchema> schema = default,
     IReadOnlyDictionary <ContentType, OasReferable <OasExample> > examples = default,
     IReadOnlyDictionary <ContentType, OasMediaType> content = default)
     : base(description, options, style, schema, examples, content)
 {
     Name     = name;
     Location = location;
 }
Esempio n. 6
0
        /// <summary>
        /// Converts the specified <see cref="OasParameterLocation"/> to a <see cref="JToken"/>.
        /// </summary>
        /// <param name="parameterLocation">The <see cref="OasParameterLocation"/> to convert.</param>
        /// <returns>The <see cref="JToken"/>.</returns>
        protected virtual JToken ToJsonValue(OasParameterLocation parameterLocation)
        {
            switch (parameterLocation)
            {
            case OasParameterLocation.Query: return(EnumConstants.Query);

            case OasParameterLocation.Header: return(EnumConstants.Header);

            case OasParameterLocation.Path: return(EnumConstants.Path);

            case OasParameterLocation.Cookie: return(EnumConstants.Cookie);

            default: throw new ArgumentOutOfRangeException(nameof(parameterLocation));
            }
        }