/// <summary> /// Gets count of activities associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ActivitiesCountRequest(int ticketId) { var conditions = new CWRequestConditions { Conditions = new string[] { $"ticket/id={ticketId}" } }; return(new CWRequest(CWHttpMethod.Get, $"sales/activities/count{conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging)}")); }
/// <summary> /// Gets count of schedule entries associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ScheduleEntriesCountRequest(int ticketId) { var conditions = new CWRequestConditions { Conditions = new string[] { "type/id=4", $"objectId={ticketId}" } }; return(new CWRequest(CWHttpMethod.Get, $"schedule/entries/count{conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging)}")); }
/// <summary> /// Gets count of products associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ProductsCountRequest(int ticketId) { var conditions = new CWRequestConditions { Conditions = new string[] { "chargeToType=\"Ticket\"", $"chargeToId={ticketId}" } }; return(new CWRequest(CWHttpMethod.Get, $"procurement/products/count{conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging)}")); }
/// <summary> /// Gets count of time entries associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest TimeEntriesCountRequest(int ticketId) { var conditions = new CWRequestConditions { Conditions = new string[] { "(chargeToType=\"ServiceTicket\" OR chargeToType=\"ProjectTicket\")", $"chargeToId={ticketId}" } }; return(new CWRequest(CWHttpMethod.Get, $"time/entries/count{conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging)}")); }
/// <summary> /// Gets products associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ProductsRequest(int ticketId, CWRequestConditions conditions = null) { if (conditions == null) { conditions = new CWRequestConditions(); } conditions.Conditions = new string[] { "chargeToType=\"Ticket\"", $"chargeToId={ticketId}" }; var conditionStr = conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging); return(new CWRequest(CWHttpMethod.Get, $"procurement/products{conditionStr}")); }
/// <summary> /// Gets schedule entries associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ScheduleEntriesRequest(int ticketId, CWRequestConditions conditions = null) { if (conditions == null) { conditions = new CWRequestConditions(); } conditions.Conditions = new string[] { "type/id=4", $"objectId={ticketId}" }; var conditionStr = conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging); return(new CWRequest(CWHttpMethod.Get, $"schedule/entries{conditionStr}")); }
/// <summary> /// Gets time entries associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest TimeEntriesRequest(int ticketId, CWRequestConditions conditions = null) { if (conditions == null) { conditions = new CWRequestConditions(); } conditions.Conditions = new string[] { "(chargeToType=\"ServiceTicket\" OR chargeToType=\"ProjectTicket\")", $"chargeToId={ticketId}" }; var conditionStr = conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging); return(new CWRequest(CWHttpMethod.Get, $"time/entries{conditionStr}")); }
/// <summary> /// Gets activities associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ActivitiesRequest(int ticketId, CWRequestConditions conditions = null) { if (conditions == null) { conditions = new CWRequestConditions(); } conditions.Conditions = new string[] { $"ticket/id={ticketId}" }; var conditionStr = conditions.ToUriConditions(CWConditionOptions.ConditionsAndPaging); return(new CWRequest(CWHttpMethod.Get, $"sales/activities{conditionStr}")); }
/// <summary> /// Generic CREATE request for the specified entity's grandchild type. /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="serializedContent">The serialized data to be sent in the body of the request.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest CreateRequest(int id, int childId, string serializedContent, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.CountConditions) : string.Empty; return(new CWRequest(CWHttpMethod.Post, $"{getPrefix(id, childId)}{conditionStr}", serializedContent)); }
/// <summary> /// Generic PATCH request updating specific fields on the specified entity's grandchild matching the provided GrandChildID with the operations supplied in 'updates.' /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="grandChildId">The specified entity's grandchild ID.</param> /// <param name="updates">The list of Patch operations to be applied to the specified entity.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest UpdateRequest(int id, int childId, int grandChildId, IEnumerable <CWPatch> updates, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; var patches = updates.Any() ? updates.ToList() : new List <CWPatch>(); return(new CWRequest(CWHttpMethod.Patch, $"{getPrefix(id, childId)}/{grandChildId}{conditionStr}", JsonConvert.SerializeObject(patches))); }
/// <summary> /// Generic PUT request replacing all fields on the specified entity's grandchild matching the provided GrandChildID with the serialized fields supplied in 'content.' /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="grandChildId">The specified entity's grandchild ID.</param> /// <param name="serializedContent">The serialized data to be sent in the body of the request.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest ReplaceRequest(int id, int childId, int grandChildId, string serializedContent, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; return(new CWRequest(CWHttpMethod.Put, $"{getPrefix(id, childId)}/{grandChildId}{conditionStr}", serializedContent)); }
/// <summary> /// Convert Opportunity to Agreement /// </summary> /// <param name="opportunityId">Specified Opportunity ID.</param> /// <param name="serializedBody">Serialized OpportunityToAgreementConversion object.</param> /// <param name="conditions">This endpoint only accepts the Fields condition.</param> /// <returns></returns> public CWRequest ConvertToAgreementRequest(int opportunityId, string serializedBody, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; return(new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/{opportunityId}/convertToAgreement{conditionStr}")); }
/// <summary> /// Generic GET request across the specified entity's child collection using the conditions provided. /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="conditions">Standard CW Manage API conditions to be appended to the end of the request URL.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest GetRequest(int id, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.StandardConditions) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix(id)}{conditionStr}")); }
/// <summary> /// This endpoint does not support a COUNT request. /// </summary> /// <returns>NULL</returns> public override CWRequest CountRequest(int id, CWRequestConditions conditions = null) { return(null); }
/// <summary> /// Generic CREATE request for the specified entity's type. /// </summary> /// <param name="content">The object to be serialized & sent in the body of the request.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest CreateRequest(object content, CWRequestConditions conditions = null) { return(CreateRequest(JsonConvert.SerializeObject(content), conditions)); }
/// <summary> /// Generic PUT request replacing all fields on the entity matching the provided ID with the serialized fields supplied in 'content.' /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="content">The object to be serialized & sent in the body of the request.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest ReplaceRequest(int id, object content, CWRequestConditions conditions = null) { return(ReplaceRequest(id, JsonConvert.SerializeObject(content), conditions)); }
/// <summary> /// Copies the board that is specified in the content body. /// </summary> /// <param name="content">The serialized content to be sent in the request body.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest CopyRequest(string content, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; return(new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/copy{conditionStr}", content)); }
/// <summary> /// Generic GET request for the specified entity's grandchild matching the provided GrandChildID. /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="grandChildId">The specified entity's grandchild ID.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest GetRequest(int id, int childId, int grandChildId, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix(id, childId)}/{grandChildId}{conditionStr}")); }
/// <summary> /// Generic CREATE request for the specified entity's grandchild type. /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="content">The object to be serialized & sent in the body of the request.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest CreateRequest(int id, int childId, object content, CWRequestConditions conditions = null) { return(CreateRequest(id, childId, JsonConvert.SerializeObject(content), conditions)); }
/// <summary> /// Gets documents associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest DocumentsRequest(int ticketId, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.Pagination, appendToExisting : true) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"system/documents?recordType=Ticket&recordId={ticketId}{conditionStr}")); }
/// <summary> /// Searches the ticket endpoint. Allows you to POST request conditions in the body if your condition string will be greater than 10,000 characters. /// </summary> /// <param name="conditions">This endpoint will accept Paging conditions in the URL; however Conditions, ChildConditions, CustomFieldConditions, & OrderBy will be in the body.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest SearchRequest(CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.Pagination) : string.Empty; return(new CWRequest(CWHttpMethod.Post, $"search{conditionStr}", conditions.ToBodyConditions())); }
/// <summary> /// Gets configurations associated to the ticket. /// </summary> /// <param name="ticketId">Specified Ticket ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest ConfigurationsRequest(int ticketId, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.Pagination) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix()}/{ticketId}/configurations{conditionStr}")); }
/// <summary> /// Generic GET request across the specified entity's grandchild collection using the conditions provided. /// </summary> /// <param name="id">The specified entity ID.</param> /// <param name="childId">The specified entity's child ID.</param> /// <param name="conditions">This endpoint only accepts 'Conditions' and 'CustomFieldConditions.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public virtual CWRequest CountRequest(int id, int childId, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.CountConditions) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix(id, childId)}/count{conditionStr}")); }
/// <summary> /// Get Campaign Opportunities /// </summary> /// <param name="campaignId">Specified Campaign ID.</param> /// <param name="conditions">This endpoint only accepts Paging conditions.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest GetOpportunitiesRequest(int campaignId, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.Pagination) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix()}/{campaignId}/opportunities{conditionStr}")); }
/// <summary> /// Get Member By Member Identifier /// </summary> /// <param name="memberIdentifier">The specified member's identifier.</param> /// <param name="conditions">This endpoint only accepts 'Fields.'</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest GetRequest(string memberIdentifier, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.OnlyFields) : string.Empty; return(new CWRequest(CWHttpMethod.Get, $"{getPrefix()}/{memberIdentifier}{conditionStr}")); }
/// <summary> /// Execute Managed IT Sync /// </summary> /// <param name="id">CompanyID.</param> /// <param name="conditions">Standard CW Manage API conditions to be appended to the end of the request URL.</param> /// <returns>CWRequest to be sent using CWHttpClient.</returns> public CWRequest CreateRequest(int id, CWRequestConditions conditions = null) { var conditionStr = conditions != null?conditions.ToUriConditions(CWConditionOptions.StandardConditions) : string.Empty; return(new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/{id}/executeManagedItSync{conditionStr}")); }