Example #1
0
        public MethodJs()
        {
            // methods that have no group name get the client name as their name
            Group.OnGet += groupName =>
            {
                return(groupName.IsNullOrEmpty() ? CodeModel?.Name.Value : groupName);
            };

            OptionsParameterTemplateModel = (ParameterJs)New <Parameter>(new
            {
                Name           = "options",
                SerializedName = "options",
                IsRequired     = false,
                Documentation  = "Optional Parameters.",
                Location       = ParameterLocation.None,
                ModelType      = New <CompositeType>(new
                {
                    Name           = "options",
                    SerializedName = "options",
                    Documentation  = "Optional Parameters."
                })
            });

            OptionsParameterModelType.Add(New <Core.Model.Property>(new
            {
                IsReadOnly     = false,
                Name           = "customHeaders",
                IsRequired     = false,
                Documentation  = "Headers that will be added to the request",
                ModelType      = New <PrimaryType>(KnownPrimaryType.Object),
                SerializedName = "customHeaders"
            }));
        }
Example #2
0
        public override Parameter Add(Parameter item)
        {
            var parameter = base.Add(item) as ParameterJs;

            if (parameter.IsLocal && !parameter.IsRequired)
            {
                OptionsParameterModelType.Add(New <Core.Model.Property>(new
                {
                    IsReadOnly     = false,
                    Name           = parameter.Name,
                    IsRequired     = parameter.IsRequired,
                    DefaultValue   = parameter.DefaultValue,
                    Documentation  = parameter.Documentation,
                    ModelType      = parameter.ModelType,
                    SerializedName = parameter.SerializedName,
                    Constraints    = parameter.Constraints,
                    // optionalProperty.Constraints.AddRange(parameter.Constraints);
                    Extensions = parameter.Extensions // optionalProperty.Extensions.AddRange(parameter.Extensions);
                }));
            }

            return(parameter);
        }