Пример #1
0
        /// <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)}"));
        }
Пример #2
0
        /// <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)}"));
        }
Пример #3
0
        /// <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)}"));
        }
Пример #4
0
        /// <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)}"));
        }
Пример #5
0
        /// <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}"));
        }
Пример #6
0
        /// <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}"));
        }
Пример #7
0
        /// <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}"));
        }
Пример #8
0
        /// <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}"));
        }
Пример #9
0
        /// <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));
        }
Пример #10
0
        /// <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)));
        }
Пример #11
0
        /// <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));
        }
Пример #12
0
        /// <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}"));
        }
Пример #13
0
        /// <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}"));
        }
Пример #14
0
 /// <summary>
 /// This endpoint does not support a COUNT request.
 /// </summary>
 /// <returns>NULL</returns>
 public override CWRequest CountRequest(int id, CWRequestConditions conditions = null)
 {
     return(null);
 }
Пример #15
0
 /// <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));
 }
Пример #16
0
 /// <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));
 }
Пример #17
0
        /// <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));
        }
Пример #18
0
        /// <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}"));
        }
Пример #19
0
 /// <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));
 }
Пример #20
0
        /// <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}"));
        }
Пример #21
0
        /// <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()));
        }
Пример #22
0
        /// <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}"));
        }
Пример #23
0
        /// <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}"));
        }
Пример #24
0
        /// <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}"));
        }
Пример #25
0
        /// <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}"));
        }
Пример #26
0
        /// <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}"));
        }