internal ReadOnlyCardCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth, Dictionary <string, object> requestParameters = null)
     : base(getOwnerId, auth)
 {
     _updateRequestType = requestType;
     _requestParameters = requestParameters ?? new Dictionary <string, object>();
     _requestParameters.Add("_id", getOwnerId());
 }
        internal ReadOnlyActionCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
            : base(getOwnerId, auth)
        {
            _updateRequestType = RequestTypes[type];

            EventAggregator.Subscribe(this);
        }
 internal ReadOnlyBoardCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType = type == typeof(Organization)
                                              ? EntityRequestType.Organization_Read_Boards
                                              : EntityRequestType.Member_Read_Boards;
 }
        internal ReadOnlyMemberCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth)
            : base(getOwnerId, auth)
        {
            _updateRequestType = requestType;

            EventAggregator.Subscribe(this);
        }
Example #5
0
 internal BoardCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(type, getOwnerId, auth)
 {
     _addRequestType = type == typeof(Organization)
                                           ? EntityRequestType.Organization_Write_CreateBoard
                                           : EntityRequestType.Member_Write_CreateBoard;
 }
 internal ReadOnlyCardCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType = type == typeof(List)
                                              ? EntityRequestType.List_Read_Cards
                                              : EntityRequestType.Board_Read_Cards;
     _requestParameters = new Dictionary <string, object>();
 }
        internal ReadOnlyCardCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth, Dictionary <string, object> requestParameters = null)
            : base(getOwnerId, auth)
        {
            _updateRequestType = requestType;
            _requestParameters = requestParameters ?? new Dictionary <string, object>();

            EventAggregator.Subscribe(this);
        }
 internal ReadOnlyMemberCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType    = requestType;
     _additionalParameters = new Dictionary <string, object> {
         { "fields", "all" }
     };
 }
Example #9
0
 internal ReadOnlyActionCollection(ReadOnlyActionCollection source, TrelloAuthorization auth)
     : base(() => source.OwnerId, auth)
 {
     _updateRequestType = source._updateRequestType;
     if (source._additionalParameters != null)
     {
         _additionalParameters = new Dictionary <string, object>(source._additionalParameters);
     }
 }
Example #10
0
        private static Endpoint BuildUrl(EntityRequestType requestType, IDictionary <string, object> parameters)
        {
            var endpoint           = _library[requestType]();
            var requiredParameters = endpoint.Where(p => p.StartsWith("_")).ToList();

            if (parameters != null)
            {
                foreach (var parameter in requiredParameters)
                {
                    if (!parameters.ContainsKey(parameter))
                    {
                        throw new Exception("Attempted to build endpoint with incomplete parameter collection.");
                    }
                    var value = parameters[parameter] ?? string.Empty;
                    endpoint.Resolve(parameter, value.ToString());
                }
            }
            else if (requiredParameters.Any())
            {
                throw new Exception("Attempted to build endpoint with incomplete parameter collection.");
            }
            return(endpoint);
        }
 internal ReadOnlyPowerUpDataCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _requestType = requestType;
 }
Example #12
0
 internal ReadOnlyActionCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType = RequestTypes[type];
 }
 internal ReadOnlyMemberCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType             = requestType;
     AdditionalParameters["fields"] = "all";
 }
 internal MemberCollection(EntityRequestType requestType, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(requestType, getOwnerId, auth)
 {
 }
Example #15
0
 public EntityRequest(Entity ent, EntityRequestType type)
 {
     this.Target = ent;
     this.Type = type;
 }
Example #16
0
 public static Endpoint Build(EntityRequestType requestType, IDictionary <string, object> parameters = null)
 {
     return(BuildUrl(requestType, parameters));
 }
Example #17
0
 internal ReadOnlyActionCollection(Type type, Func <string> getOwnerId, TrelloAuthorization auth)
     : base(getOwnerId, auth)
 {
     _updateRequestType    = _requestTypes[type];
     _additionalParameters = new Dictionary <string, object>();
 }