Beispiel #1
0
        public async Task <DictModel> CreateTask(DictModel taskDict)
        {
            DictModel dict = new DictModel("task");

            dict.Add("title", taskDict.s("title"));
            dict.Add("description", taskDict.s("description"));
            dict.Add("list", taskDict.s("list"));

            string uri = Globals.PROJECTS_URI + "/" + taskDict.i("project_id") + "/" + Globals.TASKS_URI;

            return(await MakeRequestAsync(uri, dict, RequestMethod.POST));
        }
Beispiel #2
0
        public async Task <DictModel> Login(string email, string password)
        {
            DictModel dict = new DictModel("user");

            dict.Add("email", email);
            dict.Add("password", password);

            DictModel response = await MakeRequestAsync(Globals.SESSIONS_URI, dict, RequestMethod.POST);

            response.EnsureValid();
            string authentication_token = response.d("user").s("authentication_token", true);

            RegisterAuthenticationToken(authentication_token);
            return(response);
        }
Beispiel #3
0
        public override async Task <DictModel> GetResponse()
        {
            int success = await Success();

            if (success == 0)
            {
                return(null);
            }

            DictModel dict = new DictModel();

            dict.Add("email", emailEntry.Text);
            dict.Add("password", passwordEntry.Text);

            return(dict);
        }
Beispiel #4
0
        public override async Task <DictModel> GetResponse()
        {
            int success = await Success();

            if (success == 0)
            {
                return(null);
            }

            DictModel dict = new DictModel();

            dict.Add("title", titleEntry.Text);
            dict.Add("description", descriptionEntry.Text);

            return(dict);
        }
Beispiel #5
0
        public async Task <DictModel> InviteUserToProject(string email, int projectId)
        {
            DictModel dict = new DictModel("invitation");

            dict.Add("email", email);

            return(await MakeRequestAsync(Globals.PROJECTS_URI + "/" + projectId + "/" + Globals.INVITATIONS_URI, dict, RequestMethod.POST));
        }
Beispiel #6
0
        public async Task <DictModel> CreateProject(string projectName)
        {
            DictModel dict = new DictModel("project");

            dict.Add("name", projectName);

            return(await MakeRequestAsync(Globals.PROJECTS_URI, dict, RequestMethod.POST));
        }
Beispiel #7
0
        public static async Task <TaskModel> CreateTask(DictModel taskDict, ProjectModel project)
        {
            taskDict.Add("project_id", project.Id);
            DictModel response = await Instance.ApiManager.CreateTask(taskDict);

            var task = project.AddTask(response.s("task"), taskDict.s("list"));

            return(task);
        }
Beispiel #8
0
        public async Task <DictModel> UpdateTask(TaskModel task)
        {
            //TODO: is there a way to bake this in?
            if (task.ProjectId == default(int))
            {
                throw new Exception("Task doesn't belong to a project: aborting save.");
            }

            DictModel dict = new DictModel("task");

            dict.Add("title", task.Title);
            dict.Add("description", task.Description);

            //TODO: use dynamic uri's like _path's in Ruby
            string uri = Globals.PROJECTS_URI + "/" + task.ProjectId + "/" + Globals.TASKS_URI + "/" + task.Id;

            return(await MakeRequestAsync(uri, dict, RequestMethod.PUT));
        }
Beispiel #9
0
        public async Task <DictModel> AddUserToTask(int projectId, int taskId, int userId)
        {
            DictModel dict = new DictModel("user");

            dict.Add("id", userId);

            string uri = Globals.PROJECTS_URI + "/" + projectId + "/" + Globals.TASKS_URI + "/" + taskId + "/" + Globals.ASSIGNMENTS_URI;

            return(await MakeRequestAsync(uri, dict, RequestMethod.POST));
        }
Beispiel #10
0
        private async Task AddTask()
        {
            DictModel dict = await OverlayForm(taskForm);

            if (dict != null)
            {
                dict.Add("list", listName);

                await App.CreateTask(dict, project);

                list.BeginRefresh();
            }
        }
Beispiel #11
0
        public override async Task <DictModel> GetResponse()
        {
            int success = await Success();

            if (success == 0)
            {
                return(null);
            }

            DictModel dict = new DictModel();

            dict.Add("id", selectedUser.Id);

            return(dict);
        }