public async Task <CommentResult> CommentAnswerAsync(String access, Int32 answerId, String content)
        {
            var api    = new CommentApi();
            var result = await api.CommentAnswerAsync(access, answerId, content);

            return(result);
        }
Beispiel #2
0
        public StreamComment UpdateComment(String text, StreamComment comment)
        {
            try
            {
                CommentApi      commentApi    = new CommentApi(session.GetApiClient());
                CommentV2Record commentRecord = comment.Record;
                commentRecord.Text = text;

                UpdateCommentInput  updateCommentInput  = new UpdateCommentInput(comment.ContentKey, commentRecord);
                UpdateCommentResult updateCommentResult = commentApi.UpdateComment(updateCommentInput);
                if (updateCommentResult.Hdr.Rc == 0)
                {
                    CommentV2Record updatedCommentRecord = updateCommentResult.Comment;
                    StreamComment   updatedComment       = new StreamComment(updatedCommentRecord, comment.ContentRecordType);
                    return(updatedComment);
                }
                else
                {
                    throw new Exception("Error creating comment. Rc=" + updateCommentResult.Hdr.Rc);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error creating comment", ex);
            }
        }
        public void OnCreateWithConfiguration()
        {
            configuration = GetClientConfig();
            CommentApi commentApi = new CommentApi(configuration);

            Assert.NotNull(commentApi.Configuration);
        }
        public async Task <CommentResult> ReplyAnswerComment(String access, Int32 answerId, Int32 commentId, String content)
        {
            var api    = new CommentApi();
            var result = await api.ReplyAnswerComment(access, answerId, commentId, content);

            return(result);
        }
        public async Task <OperationResult> ReportComment(String access, Int32 commentId, ReasonMode reason)
        {
            var api    = new CommentApi();
            var result = await api.ReportComment(access, commentId, reason);

            return(result);
        }
        public async Task <VotedResult> CancelVoteUp(String access, Int32 commentId, String loginId)
        {
            var api    = new CommentApi();
            var result = await api.CancelVoteUp(access, commentId, loginId);

            return(result);
        }
        public async Task <CommentResult> CommentQuestionAsync(String access, Int32 questionId, String content)
        {
            var api    = new CommentApi();
            var result = await api.CommentQuestionAsync(access, questionId, content);

            return(result);
        }
Beispiel #8
0
 public ClientApi()
 {
     _commentApi   = new CommentApi();
     _dbUpdatesApi = new DbUpdatesApi();
     _tasksApi     = new TasksApi(_commentApi);
     _usersApi     = new UsersApi();
 }
        public async Task <CommentResult> ReplyQuestionComment(String access, Int32 questionId, Int32 commentId,
                                                               String content)
        {
            var api    = new CommentApi();
            var result = await api.ReplyQuestionComment(access, questionId, commentId, content);

            return(result);
        }
Beispiel #10
0
 public SendCommentDialog(string oid, CommentType commentType)
 {
     this.InitializeComponent();
     commentApi       = new CommentApi();
     emoteVM          = new EmoteVM();
     this.oid         = oid;
     this.commentType = commentType;
 }
Beispiel #11
0
        public CommentViewModel(PostModel postSelected)
        {
            commentDatabase = App.Container.Resolve <CommentDatabase>();
            commentApi      = App.Container.Resolve <CommentApi>();

            PostVM = postSelected;

            GetDatabase();
        }
        public void ApiV1ItemByAgencyByIdByVersionCommentPostAsyncWithHttpInfo()
        {
            configuration = GetClientConfig();
            CommentApi           commentApiTest       = new CommentApi(configuration);
            CreateCommentRequest createcommentRequest = new CreateCommentRequest
            {
                Comment = "test of commments"
            };

            ApiResponse <object> response = commentApiTest.ApiV1ItemByAgencyByIdByVersionCommentPostWithHttpInfo(agencyTest, new Guid("52c5dd34-1b5f-460b-8904-6f0f2897f6a1"), 1L, createcommentRequest);

            Assert.Equal(200, response.StatusCode);
        }
        public void ApiV1ItemByAgencyByIdCommentGetWithHttpInfo()
        {
            configuration = GetClientConfig();
            CommentApi commentApiTest = new CommentApi(configuration);

            ApiResponse <List <UserComment> > response = commentApiTest.ApiV1ItemByAgencyByIdCommentGetWithHttpInfo(agencyTest, new Guid("52c5dd34-1b5f-460b-8904-6f0f2897f6a1"));

            Assert.Equal(200, response.StatusCode);
            DateTime    dt = DateTime.Parse("2017-08-21 20:07:30.023");
            UserComment userCommentToCheck = new UserComment("test of commments", dt, "API_User", new Guid("52c5dd34-1b5f-460b-8904-6f0f2897f6a1"), 1L, "int.example");

            Assert.Contains(userCommentToCheck, response.Data);
        }
Beispiel #14
0
 public void DeleteComment(String contentKey, String commentListKey, int commentId)
 {
     try
     {
         CommentApi          commentApi          = new CommentApi(session.GetApiClient());
         DeleteCommentInput  deleteCommentInput  = new DeleteCommentInput(contentKey, commentListKey, commentId);
         DeleteCommentResult deleteCommentResult = commentApi.DeleteComment(deleteCommentInput);
         if (deleteCommentResult.Hdr.Rc != 0)
         {
             throw new Exception("Error deleting comment. Rc=" + deleteCommentResult.Hdr.Rc);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error deleting comment", ex);
     }
 }
        public BaseResponse Deactivate(int id)
        {
            var comments = CommentApi.Deactivate(id);

            if (comments != null)
            {
                return new BaseResponse()
                       {
                           Data       = comments,
                           StatusCode = (int)HttpStatusCode.OK
                       }
            }
            ;

            return(new BaseResponse()
            {
                Message = CommentMsg.NotFound,
                StatusCode = (int)HttpStatusCode.NotFound
            });
        }
        public BaseResponse GetAllCommentsOfPostId(int id)
        {
            var comments = CommentApi.GetAllCommentsOfPostId(id);

            if (comments != null)
            {
                return new BaseResponse()
                       {
                           Data       = comments,
                           StatusCode = (int)HttpStatusCode.OK
                       }
            }
            ;

            return(new BaseResponse()
            {
                Message = GlobalMsg.InternalError,
                StatusCode = (int)HttpStatusCode.InternalServerError
            });
        }
        public BaseResponse GetCommentById(int id)
        {
            var comment = CommentApi.GetCommentById(id);

            if (comment != null)
            {
                return new BaseResponse()
                       {
                           Data       = comment,
                           StatusCode = (int)HttpStatusCode.OK
                       }
            }
            ;

            return(new BaseResponse()
            {
                Message = CommentMsg.NotFound,
                StatusCode = (int)HttpStatusCode.NotFound
            });
        }
Beispiel #18
0
        public List <StreamComment> GetComments(StreamItem streamItem, PaginationRecord pg)
        {
            CommentApi commentApi = new CommentApi(session.GetApiClient());

            try
            {
                CommentListV2OptionsRecord options = new CommentListV2OptionsRecord();
                options.SortDir       = "DESC";
                options.HighlightTag  = "mark";
                options.CreatorFilter = "all";
                options.ReadFilter    = "all";
                options.SortFilter    = "updateTime";

                AdditionalDataRecord additionalData = new AdditionalDataRecord();
                additionalData.SubType         = "general";
                additionalData.FirstLevelCount = true;

                GetCommentsResult getCommentsResult = commentApi.GetComments(streamItem.Key, options.ToJson(), pg.ToJson(), streamItem.CommentListKey, additionalData.ToJson());
                if (getCommentsResult.Hdr.Rc == 0)
                {
                    commentsPager = getCommentsResult.Pager;
                    List <StreamComment>   comments       = new List <StreamComment>();
                    List <CommentV2Record> commentRecords = getCommentsResult.Comments;
                    foreach (CommentV2Record commentRecord in commentRecords)
                    {
                        StreamComment comment = new StreamComment(commentRecord, streamItem.RecordType);
                        comments.Add(comment);
                    }

                    return(comments);
                }
                else
                {
                    throw new Exception("Error getting comments for contentKey " + streamItem.Key);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error getting comments for contentKey " + streamItem.Key, ex);
            }
        }
Beispiel #19
0
        public void MarkCommentsRead(StreamItem streamItem)
        {
            CommentApi commentApi = new CommentApi(session.GetApiClient());

            try
            {
                MarkAllReadInput  input  = new MarkAllReadInput(streamItem.CommentListKey, streamItem.Key);
                MarkAllReadResult result = commentApi.MarkAllRead(input);
                if (result.Hdr.Rc == 0)
                {
                }
                else
                {
                    throw new Exception("Error marking as read info for contentKey " + streamItem.Key);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error updating read info for contentKey " + streamItem.Key, ex);
            }
        }
        public BaseResponse CreateComment(ClientCommentViewModel newComment)
        {
            newComment.PostedTime = DateTime.Now;
            var comment = CommentApi.CreateComment(newComment);

            try
            {
                return(new BaseResponse()
                {
                    Data = comment,
                    StatusCode = (int)HttpStatusCode.OK
                });
            }
            catch (Exception e)
            {
                return(new BaseResponse()
                {
                    Message = e.Message,
                    StatusCode = (int)HttpStatusCode.InternalServerError
                });
            }
        }
Beispiel #21
0
        private StreamComment CreateComment(String text, String contentKey, String contentRecordType, String commentListKey, int principalCommentId)
        {
            try
            {
                CommentApi      commentApi    = new CommentApi(session.GetApiClient());
                CommentV2Record commentRecord = new CommentV2Record();
                commentRecord.ContentKey = contentKey;

                if (principalCommentId > 0)
                {
                    commentRecord.CommentPID = principalCommentId;
                }
                if (commentListKey != null)
                {
                    commentRecord.CommentListKey = commentListKey;
                }

                commentRecord.Text = text;

                CreateCommentInput  createCommentInput  = new CreateCommentInput(contentKey, commentRecord);
                CreateCommentResult createCommentResult = commentApi.CreateComment(createCommentInput);
                if (createCommentResult.Hdr.Rc == 0)
                {
                    CommentV2Record createdComment = createCommentResult.Comment;
                    StreamComment   comment        = new StreamComment(createdComment, contentRecordType);
                    return(comment);
                }
                else
                {
                    throw new Exception("Error creating comment. Rc=" + createCommentResult.Hdr.Rc);
                }
            } catch (Exception ex)
            {
                throw new Exception("Error creating comment", ex);
            }
        }
Beispiel #22
0
 public CommentControl()
 {
     this.InitializeComponent();
     commentApi = new CommentApi();
     emoteVM    = new EmoteVM();
 }
 public CommentViewModel(IMvxNavigationService navigationService, IUserDialogs userDialogs)
 {
     _userDialogs       = userDialogs;
     _navigationService = navigationService;
     _api = new CommentApi <CommentModel>("comment");
 }
        public void OnCreateWithoutBasePath()
        {
            CommentApi commentApi = new CommentApi(this.basePathTest);

            Assert.NotNull(commentApi.Configuration);
        }