Exemplo n.º 1
0
        private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCommentRequest knowledgebaseCommentRequest, RequestTypes requestType)
        {
            knowledgebaseCommentRequest.EnsureValidData(requestType);

            RequestBodyBuilder parameters = new RequestBodyBuilder();

            parameters.AppendRequestDataNonNegativeInt("knowledgebasearticleid", knowledgebaseCommentRequest.KnowledgebaseArticleId);
            parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseCommentRequest.Contents);
            parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(knowledgebaseCommentRequest.CreatorType));

            if (knowledgebaseCommentRequest.CreatorId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseCommentRequest.CreatorId.Value);
            }
            else
            {
                parameters.AppendRequestDataNonEmptyString("fullname", knowledgebaseCommentRequest.FullName);
            }

            parameters.AppendRequestDataNonEmptyString("email", knowledgebaseCommentRequest.Email);

            if (knowledgebaseCommentRequest.ParentCommentId.HasValue)
            {
                parameters.AppendRequestDataNonNegativeInt("parentcommentid", knowledgebaseCommentRequest.ParentCommentId.Value);
            }

            return(parameters);
        }