Example #1
0
        public Task AddTag(AsanaTag proj, Asana host)
        {
            Dictionary <string, object> Tag = new Dictionary <string, object>();

            Tag.Add("tag", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                if (Tags == null)
                {
                    Tags = new AsanaTag[1];
                }
                else
                {
                    AsanaTag[] lTags = Tags;
                    Array.Resize(ref lTags, Tags.Length + 1);
                    Tags = lTags;
                }

                Tags[Tags.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.AddTagToTask), Tag));
        }
Example #2
0
        public Task Get <AsanaT>(AsanaWorkspace arg1, AsanaCollectionResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaUser))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUsersInWorkspace), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaUser>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaProject))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectsInWorkspace), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaProject>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaTag))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTagsInWorkspace), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTag>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaTeam))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTeamsInWorkspace), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTeam>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
Example #3
0
        public Task AddProject(AsanaProject proj, Asana host)
        {
            Dictionary <string, object> project = new Dictionary <string, object>();

            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                if (Projects == null)
                {
                    Projects = new AsanaProject[1];
                }
                else
                {
                    AsanaProject[] lProjects = Projects;
                    Array.Resize(ref lProjects, Projects.Length + 1);
                    Projects = lProjects;
                }

                Projects[Projects.Length - 1] = proj;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.AddProjectToTask), project));
        }
Example #4
0
        public Task DuplicateProjectById(Int64 int64, AsanaDuplicateProjectSettings settings, AsanaResponseEventHandler callback)
        {
            var data    = Parsing.Serialize(settings, true, false);
            var request = GetBaseRequestWithParams(AsanaFunction.GetFunction(Function.DuplicateProject), data, int64);

            return(request.Go((o, h) => PackAndSendResponse <AsanaDuplicateProjectJob>(o, callback), ErrorCallback));
        }
Example #5
0
        public Task Get <AsanaT>(AsanaTask arg1, String arg2, AsanaResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaEvent))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInTask), arg1, arg2);
                return(request.Go((o, h) => PackAndSendResponse <AsanaEvent>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
Example #6
0
        public Task Get <AsanaT>(Int64 arg1, AsanaResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaUser))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUserById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaUser>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaWorkspace))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetWorkspaceById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaWorkspace>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaTask))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTaskById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaTask>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaStory))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetStoryById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaStory>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaProject))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaProject>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaTag))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTagById), arg1);
                return(request.Go((o, h) => PackAndSendResponse <AsanaTag>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
Example #7
0
        public Task Get <AsanaT>(AsanaTask arg1, AsanaCollectionResponseEventHandler callback) where AsanaT : AsanaObject
        {
            AsanaRequest request = default(AsanaRequest);

            if (typeof(AsanaT) == typeof(AsanaStory))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetStoriesInTask), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaStory>(o, callback), ErrorCallback));
            }


            if (typeof(AsanaT) == typeof(AsanaProject))
            {
                request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectsOnATask), arg1);
                return(request.Go((o, h) => PackAndSendResponseCollection <AsanaProject>(o, callback), ErrorCallback));
            }


            throw new TypeAccessException("Unknown type for this request: " + typeof(AsanaT).Name);
        }
Example #8
0
        public Task RemoveProject(AsanaProject proj, Asana host)
        {
            Dictionary <string, object> project = new Dictionary <string, object>();

            project.Add("project", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                int            index     = Array.IndexOf(Projects, proj);
                AsanaProject[] lProjects = new AsanaProject[Projects.Length - 1];
                if (index != 0)
                {
                    Array.Copy(Projects, lProjects, index);
                }
                Array.Copy(Projects, index + 1, lProjects, index, lProjects.Length - index);

                Projects = lProjects;
                Saving  -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.RemoveProjectFromTask), project));
        }
Example #9
0
        public Task RemoveTag(AsanaTag proj, Asana host)
        {
            Dictionary <string, object> Tag = new Dictionary <string, object>();

            Tag.Add("tag", proj.ID);
            AsanaResponseEventHandler savedCallback = null;

            savedCallback = (s) =>
            {
                // add it manually
                int        index = Array.IndexOf(Tags, proj);
                AsanaTag[] lTags = new AsanaTag[Tags.Length - 1];
                if (index != 0)
                {
                    Array.Copy(Tags, lTags, index);
                }
                Array.Copy(Tags, index + 1, lTags, index, lTags.Length - index);

                Tags    = lTags;
                Saving -= savedCallback;
            };
            Saving += savedCallback;
            return(host.Save(this, AsanaFunction.GetFunction(Function.RemoveTagFromTask), Tag));
        }
Example #10
0
        public Task GetTeamsInWorkspace(AsanaWorkspace asanaWorkspace, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTeamsInWorkspace), asanaWorkspace);

            return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTeam>(o, callback), ErrorCallback));
        }
Example #11
0
        public void GetWorkspaces(AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetWorkspaces));

            request.Go((o, h) => PackAndSendResponseCollection <AsanaWorkspace>(o, callback), ErrorCallback);
        }
Example #12
0
        public void GetTasksInAProject(AsanaProject arg1, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksInAProject), arg1);

            request.Go((o, h) => PackAndSendResponseCollection <AsanaTask>(o, callback), ErrorCallback);
        }
Example #13
0
        public Task <AsanaUser> GetUserByIdAsync(Int64 int64)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUserById), int64);

            return(request.GoAsync <AsanaUser>());
        }
Example #14
0
        public Task <AsanaUser> GetMeAsync()
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetMe));

            return(request.GoAsync <AsanaUser>());
        }
Example #15
0
        public Task <IAsanaObjectCollection <AsanaTask> > GetTasksInAProjectAsync(AsanaProject asanaProject)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksInAProject), asanaProject);

            return(request.GoCollectionAsync <AsanaTask>());
        }
Example #16
0
        public Task <AsanaProject> GetProjectByIdAsync(Int64 int64)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectById), int64);

            return(request.GoAsync <AsanaProject>());
        }
Example #17
0
        public Task <IAsanaObjectCollection <AsanaTask> > GetTasksByTagAsync(AsanaTag asanaTag)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), asanaTag);

            return(request.GoCollectionAsync <AsanaTask>());
        }
Example #18
0
        public Task GetTasksByTag(AsanaTag asanaTag, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTasksByTag), asanaTag);

            return(request.Go((o, h) => PackAndSendResponseCollection <AsanaTask>(o, callback), ErrorCallback));
        }
Example #19
0
        public Task GetUsers(AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUsers));

            return(request.Go((o, h) => PackAndSendResponseCollection <AsanaUser>(o, callback), ErrorCallback));
        }
Example #20
0
        public Task <IAsanaObjectCollection <AsanaTeam> > GetTeamsInWorkspaceAsync(AsanaWorkspace asanaWorkspace)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTeamsInWorkspace), asanaWorkspace);

            return(request.GoCollectionAsync <AsanaTeam>());
        }
Example #21
0
        public Task <IAsanaObjectCollection <AsanaUser> > GetUsersAsync()
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUsers));

            return(request.GoCollectionAsync <AsanaUser>());
        }
Example #22
0
        public Task GetProjectsInTeam(AsanaTeam asanaTeam, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectsInTeam), asanaTeam);

            return(request.Go((o, h) => PackAndSendResponseCollection <AsanaProject>(o, callback), ErrorCallback));
        }
Example #23
0
        public Task GetUserById(Int64 int64, AsanaResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUserById), int64);

            return(request.Go((o, h) => PackAndSendResponse <AsanaUser>(o, callback), ErrorCallback));
        }
Example #24
0
        public Task <IAsanaObjectCollection <AsanaProject> > GetProjectsInTeamAsync(AsanaTeam asanaTeam)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetProjectsInTeam), asanaTeam);

            return(request.GoCollectionAsync <AsanaProject>());
        }
Example #25
0
        public void GetStoriesInTask(AsanaTask arg1, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetStoriesInTask), arg1);

            request.Go((o, h) => PackAndSendResponseCollection <AsanaStory>(o, callback), ErrorCallback);
        }
Example #26
0
        public Task <AsanaEvent> GetEventsInAProjectAsync(AsanaProject asanaProject, String string1)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInAProject), asanaProject, string1);

            return(request.GoAsync <AsanaEvent>(true));
        }
Example #27
0
        public void GetUserById(Int64 arg1, AsanaResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetUserById), arg1);

            request.Go((o, h) => PackAndSendResponse <AsanaUser>(o, callback), ErrorCallback);
        }
Example #28
0
        public Task GetEventsInTask(AsanaTask asanaTask, String string1, AsanaResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInTask), asanaTask, string1);

            return(request.Go((o, h) => PackAndSendResponse <AsanaEvent>(o, callback), ErrorCallback));
        }
Example #29
0
        public void GetTagsInWorkspace(AsanaWorkspace arg1, AsanaCollectionResponseEventHandler callback)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetTagsInWorkspace), arg1);

            request.Go((o, h) => PackAndSendResponseCollection <AsanaTag>(o, callback), ErrorCallback);
        }
Example #30
0
        public Task <AsanaEvent> GetEventsInTaskAsync(AsanaTask asanaTask, String string1)
        {
            var request = GetBaseRequest(AsanaFunction.GetFunction(Function.GetEventsInTask), asanaTask, string1);

            return(request.GoAsync <AsanaEvent>(true));
        }