Exemplo n.º 1
0
 public static NewEntity Create(this IMessagesContract contract, Int64 projectId, PostNewRequest request)
 {
     return contract.Create(projectId.ToString(), request);
 }
Exemplo n.º 2
0
        public void Messages()
        {
            Console.WriteLine();
            Console.WriteLine("Messages Contract Tests");
            Console.WriteLine("***********************");

            var projectService = this.Client.Projects;
            var categoryService = this.Client.Categories;

            var project = projectService.GetList().FirstOrDefault();

            if (project == null)
            {
                Console.WriteLine("No projects exists under this account");
                return;
            }

            Console.WriteLine("Project Name: {0}", project.Name);

            var category = categoryService.GetListByType(project.Id, CategoryType.Post).FirstOrDefault();

            var service = this.Client.Messages;

            var messages = service.GetList(project.Id);

            Console.WriteLine("Messages Count: {0}", messages.Count());

            var messages2 = service.GetListByCategory(project.Id, category.Id);

            Console.WriteLine("Messages By Category Name: {1}; Count: {0}", messages2.Count(), category.Name);

            var messages3 = service.GetArchivedList(project.Id);

            Console.WriteLine("Archived Messages Count: {0}", messages3.Count());

            var messages4 = service.GetArchivedListByCategory(project.Id, category.Id);

            Console.WriteLine("Archived Messages By Category Name: {1}; Count: {0}", messages4.Count(), category.Name);

            var message = messages.First();

            message = service.Get(message.Id);

            Console.WriteLine("Message: {0}", message.Title);

            var request = new PostNewRequest { Post = new PostNew { Title = "Test", Body = "Testing Body", CategoryId = category.Id, NotifyAboutChanges = false } };
            var id = service.Create(project.Id, request);
            var newPost = service.Get(id.Id);

            Console.WriteLine("New Message: {0}", newPost.Title);

            request.Post.Title = "Test2";
            service.Update(id.Id, request);
            var updateMessage = service.Get(id.Id);

            Console.WriteLine("Update Message: {0}", updateMessage.Title);

            service.Delete(id.Id);

            Console.WriteLine("Message Deleted");
        }
Exemplo n.º 3
0
 public static void Update(this IMessagesContract contract, Int64 postId, PostNewRequest request)
 {
     contract.Update(postId.ToString(), request);
 }