private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCategoryRequest troubleshooterCategoryRequest, RequestTypes requestType) { troubleshooterCategoryRequest.EnsureValidData(requestType); var parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("title", troubleshooterCategoryRequest.Title); parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(troubleshooterCategoryRequest.CategoryType)); if (requestType == RequestTypes.Create) { parameters.AppendRequestDataNonNegativeInt("staffid", troubleshooterCategoryRequest.StaffId); } if (troubleshooterCategoryRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterCategoryRequest.DisplayOrder.Value); } parameters.AppendRequestDataNonEmptyString("description", troubleshooterCategoryRequest.Description); parameters.AppendRequestDataBool("uservisibilitycustom", troubleshooterCategoryRequest.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", troubleshooterCategoryRequest.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", troubleshooterCategoryRequest.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", troubleshooterCategoryRequest.StaffGroupIdList); return(parameters); }
private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseArticleRequest knowledgebaseArticleRequest, RequestTypes requestType) { knowledgebaseArticleRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("subject", knowledgebaseArticleRequest.Subject); parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseArticleRequest.Contents); if (requestType == RequestTypes.Create && knowledgebaseArticleRequest.CreatorId.HasValue) { parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseArticleRequest.CreatorId.Value); } if (knowledgebaseArticleRequest.ArticleStatus.HasValue) { parameters.AppendRequestData("articlestatus", EnumUtility.ToApiString(knowledgebaseArticleRequest.ArticleStatus.Value)); } parameters.AppendRequestDataBool("isfeatured", knowledgebaseArticleRequest.IsFeatured); parameters.AppendRequestDataBool("allowcomments", knowledgebaseArticleRequest.AllowComments); parameters.AppendRequestDataArrayCommaSeparated("categoryid", knowledgebaseArticleRequest.CategoryIds); if (requestType == RequestTypes.Update && knowledgebaseArticleRequest.EditedStaffId.HasValue) { parameters.AppendRequestDataNonNegativeInt("editedstaffid", knowledgebaseArticleRequest.EditedStaffId.Value); } return(parameters); }
private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCategoryRequest knowledgebaseCategoryRequest, RequestTypes requestType) { knowledgebaseCategoryRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("title", knowledgebaseCategoryRequest.Title); if (knowledgebaseCategoryRequest.CategoryType.HasValue) { parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(knowledgebaseCategoryRequest.CategoryType.Value)); } if (knowledgebaseCategoryRequest.ParentCategoryId.HasValue) { parameters.AppendRequestData("parentcategoryid", knowledgebaseCategoryRequest.ParentCategoryId.Value); } if (knowledgebaseCategoryRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", knowledgebaseCategoryRequest.DisplayOrder.Value); } if (knowledgebaseCategoryRequest.ArticleSortOrder.HasValue) { parameters.AppendRequestData("articlesortorder", EnumUtility.ToApiString(knowledgebaseCategoryRequest.ArticleSortOrder.Value)); } parameters.AppendRequestDataBool("allowcomments", knowledgebaseCategoryRequest.AllowComments); parameters.AppendRequestDataBool("allowrating", knowledgebaseCategoryRequest.AllowRating); parameters.AppendRequestDataBool("ispublished", knowledgebaseCategoryRequest.IsPublished); parameters.AppendRequestDataBool("uservisibilitycustom", knowledgebaseCategoryRequest.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", knowledgebaseCategoryRequest.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", knowledgebaseCategoryRequest.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", knowledgebaseCategoryRequest.StaffGroupIdList); if (requestType == RequestTypes.Create && knowledgebaseCategoryRequest.StaffId.HasValue) { parameters.AppendRequestDataNonNegativeInt("staffid", knowledgebaseCategoryRequest.StaffId.Value); } return(parameters); }
private static RequestBodyBuilder PopulateRequestParameters(NewsItemRequest newsItem, RequestTypes requestType) { newsItem.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("subject", newsItem.Subject); parameters.AppendRequestDataNonEmptyString("contents", newsItem.Contents); if (requestType == RequestTypes.Create) { parameters.AppendRequestDataNonNegativeInt("staffid", newsItem.StaffId); } else { parameters.AppendRequestDataNonNegativeInt("editedstaffid", newsItem.StaffId); } if (requestType == RequestTypes.Create && newsItem.NewsItemType.HasValue) { parameters.AppendRequestData("newstype", EnumUtility.ToApiString(newsItem.NewsItemType)); } if (newsItem.NewsItemStatus.HasValue) { parameters.AppendRequestData("newsstatus", EnumUtility.ToApiString(newsItem.NewsItemStatus)); } parameters.AppendRequestDataNonEmptyString("fromname", newsItem.FromName); parameters.AppendRequestDataNonEmptyString("email", newsItem.Email); parameters.AppendRequestDataNonEmptyString("customemailsubject", newsItem.CustomEmailSubject); parameters.AppendRequestDataBool("sendemail", newsItem.SendEmail); parameters.AppendRequestDataBool("allowcomments", newsItem.AllowComments); parameters.AppendRequestDataBool("uservisibilitycustom", newsItem.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", newsItem.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", newsItem.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", newsItem.StaffGroupIdList); parameters.AppendRequestData("expiry", newsItem.Expiry.DateTime.ToString("M/d/yyyy")); parameters.AppendRequestDataArrayCommaSeparated("newscategoryidlist", newsItem.Categories); return(parameters); }
private RequestBodyBuilder PopulateRequestParameters(TroubleshooterStepRequest troubleshooterStepRequest, RequestTypes requestType) { troubleshooterStepRequest.EnsureValidData(requestType); var parameters = new RequestBodyBuilder(); if (requestType == RequestTypes.Create) { parameters.AppendRequestData("categoryid", troubleshooterStepRequest.CategoryId); } parameters.AppendRequestDataNonEmptyString("subject", troubleshooterStepRequest.Subject); parameters.AppendRequestDataNonEmptyString("contents", troubleshooterStepRequest.Contents); parameters.AppendRequestDataNonNegativeInt(requestType == RequestTypes.Create ? "staffid" : "editedstaffid", troubleshooterStepRequest.StaffId); if (troubleshooterStepRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterStepRequest.DisplayOrder.Value); } parameters.AppendRequestDataBool("allowcomments", troubleshooterStepRequest.AllowComments); parameters.AppendRequestDataBool("enableticketredirection", troubleshooterStepRequest.EnableTicketRedirection); if (troubleshooterStepRequest.RedirectDepartmentId.HasValue) { parameters.AppendRequestDataNonNegativeInt("redirectdepartmentid", troubleshooterStepRequest.RedirectDepartmentId.Value); } if (troubleshooterStepRequest.TicketTypeId.HasValue) { parameters.AppendRequestDataNonNegativeInt("tickettypeid", troubleshooterStepRequest.TicketTypeId.Value); } if (troubleshooterStepRequest.TicketPriorityId.HasValue) { parameters.AppendRequestDataNonNegativeInt("ticketpriorityid", troubleshooterStepRequest.TicketPriorityId.Value); } parameters.AppendRequestDataNonEmptyString("ticketsubject", troubleshooterStepRequest.TicketSubject); if (troubleshooterStepRequest.StepStatus.HasValue) { parameters.AppendRequestData("stepstatus", EnumUtility.ToApiString(troubleshooterStepRequest.StepStatus.Value)); } parameters.AppendRequestDataArrayCommaSeparated("parentstepidlist", troubleshooterStepRequest.ParentStepIdList); return(parameters); }
private RequestBodyBuilder PopulateRequestParameters(TroubleshooterStepRequest troubleshooterStepRequest, RequestTypes requestType) { troubleshooterStepRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); if (requestType == RequestTypes.Create) { parameters.AppendRequestData("categoryid", troubleshooterStepRequest.CategoryId); } parameters.AppendRequestDataNonEmptyString("subject", troubleshooterStepRequest.Subject); parameters.AppendRequestDataNonEmptyString("contents", troubleshooterStepRequest.Contents); parameters.AppendRequestDataNonNegativeInt(requestType == RequestTypes.Create ? "staffid" : "editedstaffid", troubleshooterStepRequest.StaffId); if (troubleshooterStepRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterStepRequest.DisplayOrder.Value); } parameters.AppendRequestDataBool("allowcomments", troubleshooterStepRequest.AllowComments); parameters.AppendRequestDataBool("enableticketredirection", troubleshooterStepRequest.EnableTicketRedirection); if (troubleshooterStepRequest.RedirectDepartmentId.HasValue) { parameters.AppendRequestDataNonNegativeInt("redirectdepartmentid", troubleshooterStepRequest.RedirectDepartmentId.Value); } if (troubleshooterStepRequest.TicketTypeId.HasValue) { parameters.AppendRequestDataNonNegativeInt("tickettypeid", troubleshooterStepRequest.TicketTypeId.Value); } if(troubleshooterStepRequest.TicketPriorityId.HasValue) { parameters.AppendRequestDataNonNegativeInt("ticketpriorityid", troubleshooterStepRequest.TicketPriorityId.Value); } parameters.AppendRequestDataNonEmptyString("ticketsubject", troubleshooterStepRequest.TicketSubject); if (troubleshooterStepRequest.StepStatus.HasValue) { parameters.AppendRequestData("stepstatus", EnumUtility.ToApiString(troubleshooterStepRequest.StepStatus.Value)); } parameters.AppendRequestDataArrayCommaSeparated("parentstepidlist", troubleshooterStepRequest.ParentStepIdList); return parameters; }
private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCategoryRequest troubleshooterCategoryRequest, RequestTypes requestType) { troubleshooterCategoryRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("title", troubleshooterCategoryRequest.Title); parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(troubleshooterCategoryRequest.CategoryType)); if (requestType == RequestTypes.Create) { parameters.AppendRequestDataNonNegativeInt("staffid", troubleshooterCategoryRequest.StaffId); } if (troubleshooterCategoryRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", troubleshooterCategoryRequest.DisplayOrder.Value); } parameters.AppendRequestDataNonEmptyString("description", troubleshooterCategoryRequest.Description); parameters.AppendRequestDataBool("uservisibilitycustom", troubleshooterCategoryRequest.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", troubleshooterCategoryRequest.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", troubleshooterCategoryRequest.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", troubleshooterCategoryRequest.StaffGroupIdList); return parameters; }
private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseArticleRequest knowledgebaseArticleRequest, RequestTypes requestType) { knowledgebaseArticleRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("subject", knowledgebaseArticleRequest.Subject); parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseArticleRequest.Contents); if (requestType == RequestTypes.Create && knowledgebaseArticleRequest.CreatorId.HasValue) { parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseArticleRequest.CreatorId.Value); } if (knowledgebaseArticleRequest.ArticleStatus.HasValue) { parameters.AppendRequestData("articlestatus", EnumUtility.ToApiString(knowledgebaseArticleRequest.ArticleStatus.Value)); } parameters.AppendRequestDataBool("isfeatured", knowledgebaseArticleRequest.IsFeatured); parameters.AppendRequestDataBool("allowcomments", knowledgebaseArticleRequest.AllowComments); parameters.AppendRequestDataArrayCommaSeparated("categoryid", knowledgebaseArticleRequest.CategoryIds); if (requestType == RequestTypes.Update && knowledgebaseArticleRequest.EditedStaffId.HasValue) { parameters.AppendRequestDataNonNegativeInt("editedstaffid", knowledgebaseArticleRequest.EditedStaffId.Value); } return parameters; }
private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCategoryRequest knowledgebaseCategoryRequest, RequestTypes requestType) { knowledgebaseCategoryRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("title", knowledgebaseCategoryRequest.Title); if (knowledgebaseCategoryRequest.CategoryType.HasValue) { parameters.AppendRequestData("categorytype", EnumUtility.ToApiString(knowledgebaseCategoryRequest.CategoryType.Value)); } if (knowledgebaseCategoryRequest.ParentCategoryId.HasValue) { parameters.AppendRequestData("parentcategoryid", knowledgebaseCategoryRequest.ParentCategoryId.Value); } if (knowledgebaseCategoryRequest.DisplayOrder.HasValue) { parameters.AppendRequestDataNonNegativeInt("displayorder", knowledgebaseCategoryRequest.DisplayOrder.Value); } if (knowledgebaseCategoryRequest.ArticleSortOrder.HasValue) { parameters.AppendRequestData("articlesortorder", EnumUtility.ToApiString(knowledgebaseCategoryRequest.ArticleSortOrder.Value)); } parameters.AppendRequestDataBool("allowcomments", knowledgebaseCategoryRequest.AllowComments); parameters.AppendRequestDataBool("allowrating", knowledgebaseCategoryRequest.AllowRating); parameters.AppendRequestDataBool("ispublished", knowledgebaseCategoryRequest.IsPublished); parameters.AppendRequestDataBool("uservisibilitycustom", knowledgebaseCategoryRequest.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", knowledgebaseCategoryRequest.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", knowledgebaseCategoryRequest.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", knowledgebaseCategoryRequest.StaffGroupIdList); if (requestType == RequestTypes.Create && knowledgebaseCategoryRequest.StaffId.HasValue) { parameters.AppendRequestDataNonNegativeInt("staffid", knowledgebaseCategoryRequest.StaffId.Value); } return parameters; }
private static RequestBodyBuilder PopulateRequestParameters(NewsItemRequest newsItem, RequestTypes requestType) { newsItem.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonEmptyString("subject", newsItem.Subject); parameters.AppendRequestDataNonEmptyString("contents", newsItem.Contents); if (requestType == RequestTypes.Create) { parameters.AppendRequestDataNonNegativeInt("staffid", newsItem.StaffId); } else { parameters.AppendRequestDataNonNegativeInt("editedstaffid", newsItem.StaffId); } if (requestType == RequestTypes.Create && newsItem.NewsItemType.HasValue) { parameters.AppendRequestData("newstype", EnumUtility.ToApiString(newsItem.NewsItemType)); } if (newsItem.NewsItemStatus.HasValue) { parameters.AppendRequestData("newsstatus", EnumUtility.ToApiString(newsItem.NewsItemStatus)); } parameters.AppendRequestDataNonEmptyString("fromname", newsItem.FromName); parameters.AppendRequestDataNonEmptyString("email", newsItem.Email); parameters.AppendRequestDataNonEmptyString("customemailsubject", newsItem.CustomEmailSubject); parameters.AppendRequestDataBool("sendemail", newsItem.SendEmail); parameters.AppendRequestDataBool("allowcomments", newsItem.AllowComments); parameters.AppendRequestDataBool("uservisibilitycustom", newsItem.UserVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("usergroupidlist", newsItem.UserGroupIdList); parameters.AppendRequestDataBool("staffvisibilitycustom", newsItem.StaffVisibilityCustom); parameters.AppendRequestDataArrayCommaSeparated("staffgroupidlist", newsItem.StaffGroupIdList); parameters.AppendRequestData("expiry", newsItem.Expiry.DateTime.ToString("M/d/yyyy")); parameters.AppendRequestDataArrayCommaSeparated("newscategoryidlist", newsItem.Categories); return parameters; }