Пример #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="Organization"/> object.
        /// </summary>
        /// <param name="id">The organization's ID.</param>
        /// <param name="auth">(Optional) Custom authorization parameters. When not provided, <see cref="TrelloAuthorization.Default"/> will be used.</param>
        /// <remarks>
        /// The supplied ID can be either the full ID or the organization's name.
        /// </remarks>
        public Organization(string id, TrelloAuthorization auth = null)
        {
            Id       = id;
            _context = new OrganizationContext(id, auth);
            _context.Synchronized += Synchronized;

            _description     = new Field <string>(_context, nameof(Description));
            _displayName     = new Field <string>(_context, nameof(DisplayName));
            _isBusinessClass = new Field <bool>(_context, nameof(IsBusinessClass));
            _name            = new Field <string>(_context, nameof(Name));
            _name.AddRule(OrganizationNameRule.Instance);
            Preferences = new OrganizationPreferences(_context.OrganizationPreferencesContext);
            _url        = new Field <string>(_context, nameof(Url));
            _website    = new Field <string>(_context, nameof(Website));
            _website.AddRule(UriRule.Instance);

            TrelloConfiguration.Cache.Add(this);
        }
Пример #2
0
        /// <summary>
        /// Creates a new instance of the <see cref="Organization"/> object.
        /// </summary>
        /// <param name="id">The organization's ID.</param>
        /// <param name="auth">(Optional) Custom authorization parameters. When not provided,
        /// <see cref="TrelloAuthorization.Default"/> will be used.</param>
        /// <remarks>
        /// The supplied ID can be either the full ID or the organization's name.
        /// </remarks>
        public Organization(string id, TrelloAuthorization auth = null)
        {
            Id       = id;
            _context = new OrganizationContext(id, auth);
            _context.Synchronized += Synchronized;

            Actions          = new ReadOnlyActionCollection(typeof(Organization), () => Id, auth);
            Boards           = new BoardCollection(typeof(Organization), () => Id, auth);
            _description     = new Field <string>(_context, nameof(Description));
            _displayName     = new Field <string>(_context, nameof(DisplayName));
            _isBusinessClass = new Field <bool>(_context, nameof(IsBusinessClass));
            Members          = new ReadOnlyMemberCollection(EntityRequestType.Organization_Read_Members, () => Id, auth);
            Memberships      = new OrganizationMembershipCollection(() => Id, auth);
            _name            = new Field <string>(_context, nameof(Name));
            _name.AddRule(OrganizationNameRule.Instance);
            Preferences = new OrganizationPreferences(_context.OrganizationPreferencesContext);
            _url        = new Field <string>(_context, nameof(Url));
            _website    = new Field <string>(_context, nameof(Website));
            _website.AddRule(UriRule.Instance);

            TrelloConfiguration.Cache.Add(this);
        }