Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepositoryAbridgedDto" /> class.
        /// </summary>
        /// <param name="_public">Whether or not a repository is publicly viewable (default to true).</param>
        /// <param name="keywords">keywords.</param>
        /// <param name="description">description.</param>
        /// <param name="icon">icon.</param>
        /// <param name="name">The name of the repository (required).</param>
        /// <param name="latestTag">The latest package version to be indexed (required).</param>
        /// <param name="owner">The owner of the repository (required).</param>
        /// <param name="slug">The repository slug.</param>
        public RepositoryAbridgedDto
        (
            string name, string latestTag, AccountPublic owner,                                                                               // Required parameters
            bool _public = true, List <string> keywords = default, string description = default, string icon = default, string slug = default // Optional parameters
        )                                                                                                                                     // BaseClass
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for RepositoryAbridgedDto and cannot be null");
            }
            else
            {
                this.Name = name;
            }

            // to ensure "latestTag" is required (not null)
            if (latestTag == null)
            {
                throw new InvalidDataException("latestTag is a required property for RepositoryAbridgedDto and cannot be null");
            }
            else
            {
                this.LatestTag = latestTag;
            }

            // to ensure "owner" is required (not null)
            if (owner == null)
            {
                throw new InvalidDataException("owner is a required property for RepositoryAbridgedDto and cannot be null");
            }
            else
            {
                this.Owner = owner;
            }

            // use default value if no "_public" provided
            if (_public == null)
            {
                this.Public = true;
            }
            else
            {
                this.Public = _public;
            }
            this.Keywords    = keywords;
            this.Description = description;
            this.Icon        = icon;
            this.Slug        = slug;

            // Set non-required readonly properties with defaultValue
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectDto" /> class.
        /// </summary>
        /// <param name="name">The name of the project. Must be unique to a given owner (required).</param>
        /// <param name="description">A description of the project (default to &quot;&quot;).</param>
        /// <param name="_public">Whether or not a project is publicly viewable (default to true).</param>
        /// <param name="id">The project ID (required).</param>
        /// <param name="owner">owner (required).</param>
        /// <param name="permissions">permissions (required).</param>
        /// <param name="slug">The project name in slug format (required).</param>
        public ProjectDto
        (
            string name, string id, AccountPublic owner, ProjectPermissions permissions, string slug, // Required parameters
            string description = "", bool _public = true                                              // Optional parameters
        )                                                                                             // BaseClass
        {
            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for ProjectDto and cannot be null");
            }
            else
            {
                this.Name = name;
            }

            // to ensure "id" is required (not null)
            if (id == null)
            {
                throw new InvalidDataException("id is a required property for ProjectDto and cannot be null");
            }
            else
            {
                this.Id = id;
            }

            // to ensure "owner" is required (not null)
            if (owner == null)
            {
                throw new InvalidDataException("owner is a required property for ProjectDto and cannot be null");
            }
            else
            {
                this.Owner = owner;
            }

            // to ensure "permissions" is required (not null)
            if (permissions == null)
            {
                throw new InvalidDataException("permissions is a required property for ProjectDto and cannot be null");
            }
            else
            {
                this.Permissions = permissions;
            }

            // to ensure "slug" is required (not null)
            if (slug == null)
            {
                throw new InvalidDataException("slug is a required property for ProjectDto and cannot be null");
            }
            else
            {
                this.Slug = slug;
            }

            // use default value if no "description" provided
            if (description == null)
            {
                this.Description = "";
            }
            else
            {
                this.Description = description;
            }
            // use default value if no "_public" provided
            if (_public == null)
            {
                this.Public = true;
            }
            else
            {
                this.Public = _public;
            }

            // Set non-required readonly properties with defaultValue
        }