From 6fe1b9aaa007c49d249965cb62a1eff090abea74 Mon Sep 17 00:00:00 2001 From: Klaas Vandeweerdt Date: Sat, 28 Jan 2023 00:54:38 +0100 Subject: [PATCH] Added EffortClassChargeID and StandardServiceRequestActivityID --- .../Sdk4me.Tests/ServiceLevelAgreementTest.cs | 9 ++ Source/Sdk4me.Tests/TimeEntryTest.cs | 20 ++++ Source/Sdk4me/Entities/EffortClassChargeID.cs | 73 ++++++++++++ .../Sdk4me/Entities/ServiceLevelAgreement.cs | 105 ++++++++++++++++++ .../StandardServiceRequestActivityID.cs | 73 ++++++++++++ Source/Sdk4me/Entities/TimeEntry.cs | 45 ++++++++ .../Sdk4me/Extensions/To4meStringExtension.cs | 5 +- .../Handlers/ServiceLevelAgreementHandler.cs | 96 ++++++++++++++++ 8 files changed, 425 insertions(+), 1 deletion(-) create mode 100644 Source/Sdk4me.Tests/TimeEntryTest.cs create mode 100644 Source/Sdk4me/Entities/EffortClassChargeID.cs create mode 100644 Source/Sdk4me/Entities/StandardServiceRequestActivityID.cs diff --git a/Source/Sdk4me.Tests/ServiceLevelAgreementTest.cs b/Source/Sdk4me.Tests/ServiceLevelAgreementTest.cs index ba8977a..be5308e 100644 --- a/Source/Sdk4me.Tests/ServiceLevelAgreementTest.cs +++ b/Source/Sdk4me.Tests/ServiceLevelAgreementTest.cs @@ -18,9 +18,18 @@ public void Get() if (serviceLevelAgreements.Count == 0) return; + ServiceLevelAgreement serviceLevelAgreement = serviceLevelAgreements[Random.Shared.Next(serviceLevelAgreements.Count)]; Trace.WriteLine($"Continue relation tests on service level agreement: {serviceLevelAgreement.Name}"); + List effortClassChargeID = client.ServiceLevelAgreements.GetEffortClassChargeIDs(serviceLevelAgreement, "*"); + Assert.IsNotNull(effortClassChargeID); + Assert.IsInstanceOfType(effortClassChargeID, typeof(List)); + + List standardServiceRequestActivityIDs = client.ServiceLevelAgreements.GetStandardServiceRequestActivityIDs(serviceLevelAgreement, "*"); + Assert.IsNotNull(standardServiceRequestActivityIDs); + Assert.IsInstanceOfType(standardServiceRequestActivityIDs, typeof(List)); + List people = client.ServiceLevelAgreements.GetCustomerRepresentatives(serviceLevelAgreement, "*"); Assert.IsNotNull(people); Assert.IsInstanceOfType(people, typeof(List)); diff --git a/Source/Sdk4me.Tests/TimeEntryTest.cs b/Source/Sdk4me.Tests/TimeEntryTest.cs new file mode 100644 index 0000000..13d308a --- /dev/null +++ b/Source/Sdk4me.Tests/TimeEntryTest.cs @@ -0,0 +1,20 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; + +namespace Sdk4me.Tests +{ + [TestClass] + public class TimeEntryTest + { + [TestMethod] + public void Get() + { + Sdk4meClient client = Client.Get(); + List timeEntries = client.TimeEntries.Get("*"); + Console.WriteLine($"Count: {timeEntries.Count}"); + Assert.IsNotNull(timeEntries); + Assert.IsInstanceOfType(timeEntries, typeof(List)); + } + } +} diff --git a/Source/Sdk4me/Entities/EffortClassChargeID.cs b/Source/Sdk4me/Entities/EffortClassChargeID.cs new file mode 100644 index 0000000..d409298 --- /dev/null +++ b/Source/Sdk4me/Entities/EffortClassChargeID.cs @@ -0,0 +1,73 @@ +using Newtonsoft.Json; +using System; + +namespace Sdk4me +{ + /// + /// A 4me Service Level Agreements - Effort Class Charge ID object. + /// + public class EffortClassChargeID : BaseItem + { + private string chargeID; + private EffortClass effortClass; + + #region Created at (override) + + /// + /// The creation date and time; which is obsolete for this object. + /// + [JsonProperty("created_at"), Sdk4meIgnoreInFieldSelection()] + public override DateTime? CreatedAt + { + get => base.CreatedAt; + internal set => base.CreatedAt = null; + } + + #endregion + + #region Updated at (override) + + /// + /// The updated date and time; which is obsolete for this object. + /// + [JsonProperty("updated_at"), Sdk4meIgnoreInFieldSelection()] + public override DateTime? UpdatedAt + { + get => base.UpdatedAt; + internal set => base.UpdatedAt = null; + } + + #endregion + + #region ChargeID + + /// + /// The Charge ID is the unique identifier by which an effort class that is linked to a time entry when an activity was performed through the coverage of the SLA is known in the billing system of the service provider. + /// + [JsonProperty("chargeID")] + public string ChargeID + { + get => chargeID; + set => chargeID = SetValue("chargeID", chargeID, value); + } + + #endregion + + #region Effort class ID + + /// + /// The effort class related to the effort class charge ID. + /// + [JsonProperty("effort_class")] + public EffortClass EffortClass + { + get => effortClass; + set => effortClass = SetValue("effort_class_id", effortClass, value); + } + + [JsonProperty("effort_class_id"), Sdk4meIgnoreInFieldSelection()] + internal long? EffortClassID => effortClass?.ID; + + #endregion + } +} \ No newline at end of file diff --git a/Source/Sdk4me/Entities/ServiceLevelAgreement.cs b/Source/Sdk4me/Entities/ServiceLevelAgreement.cs index 6f35a92..b993671 100644 --- a/Source/Sdk4me/Entities/ServiceLevelAgreement.cs +++ b/Source/Sdk4me/Entities/ServiceLevelAgreement.cs @@ -9,7 +9,14 @@ namespace Sdk4me /// public class ServiceLevelAgreement : BaseItem { + private string activityidLow; + private string activityidMedium; + private string activityidHigh; + private string activityidTop; + private string activityidRfc; + private string activityidRfi; private List attachments; + private string billingID; private ServiceLevelCoverage? coverage; private Organization customer; private AccountReference customerAccount; @@ -27,6 +34,90 @@ public class ServiceLevelAgreement : BaseItem private ServiceLevelAgreementStatus? status; private bool useKnowledgeFromServiceProvider; + #region Activityid low + + /// + /// Represents the activityID for low incidents. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_low")] + public string ActivityidLow + { + get => activityidLow; + set => activityidLow = SetValue("activityID_low", activityidLow, value); + } + + #endregion + + #region Activityid medium + + /// + /// Represents the activityID for medium incidents. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_medium")] + public string ActivityidMedium + { + get => activityidMedium; + set => activityidMedium = SetValue("activityID_medium", activityidMedium, value); + } + + #endregion + + #region Activityid high + + /// + /// Represents the activityID for high incidents. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_high")] + public string ActivityidHigh + { + get => activityidHigh; + set => activityidHigh = SetValue("activityID_high", activityidHigh, value); + } + + #endregion + + #region Activityid top + + /// + /// Represents the activityID for top incidents. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_top")] + public string ActivityidTop + { + get => activityidTop; + set => activityidTop = SetValue("activityID_top", activityidTop, value); + } + + #endregion + + #region Activityid rfc + + /// + /// Represents the activityID for RFCs. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_rfc")] + public string ActivityidRfc + { + get => activityidRfc; + set => activityidRfc = SetValue("activityID_rfc", activityidRfc, value); + } + + #endregion + + #region Activityid rfi + + /// + /// Represents the activityID for RFIs. The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID_rfi")] + public string ActivityidRfi + { + get => activityidRfi; + set => activityidRfi = SetValue("activityID_rfi", activityidRfi, value); + } + + #endregion + #region Attachments /// @@ -41,6 +132,20 @@ public List Attachments #endregion + #region BillingID + + /// + /// The Billing ID is the unique identifier by which all the activities that are performed through the coverage of the SLA are known in the billing system of the service provider. + /// + [JsonProperty("billingID")] + public string BillingID + { + get => billingID; + set => billingID = SetValue("billingID", billingID, value); + } + + #endregion + #region Coverage /// diff --git a/Source/Sdk4me/Entities/StandardServiceRequestActivityID.cs b/Source/Sdk4me/Entities/StandardServiceRequestActivityID.cs new file mode 100644 index 0000000..4c5b1b6 --- /dev/null +++ b/Source/Sdk4me/Entities/StandardServiceRequestActivityID.cs @@ -0,0 +1,73 @@ +using Newtonsoft.Json; +using System; + +namespace Sdk4me +{ + /// + /// A 4me Service Level Agreements - Standard Service Request Activity ID object. + /// + public class StandardServiceRequestActivityID : BaseItem + { + private string activityID; + private StandardServiceRequest standardServiceRequest; + + #region Created at (override) + + /// + /// The creation date and time; which is obsolete for this object. + /// + [JsonProperty("created_at"), Sdk4meIgnoreInFieldSelection()] + public override DateTime? CreatedAt + { + get => base.CreatedAt; + internal set => base.CreatedAt = null; + } + + #endregion + + #region Updated at (override) + + /// + /// The updated date and time; which is obsolete for this object. + /// + [JsonProperty("updated_at"), Sdk4meIgnoreInFieldSelection()] + public override DateTime? UpdatedAt + { + get => base.UpdatedAt; + internal set => base.UpdatedAt = null; + } + + #endregion + + #region ActivityID + + /// + /// The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. + /// + [JsonProperty("activityID")] + public string ActivityID + { + get => activityID; + set => activityID = SetValue("activityID", activityID, value); + } + + #endregion + + #region Standard service request + + /// + /// The standard service request related to the standard service request activity ID. + /// + [JsonProperty("standard_service_request")] + public StandardServiceRequest StandardServiceRequest + { + get => standardServiceRequest; + set => standardServiceRequest = SetValue("standard_service_request_id", standardServiceRequest, value); + } + + [JsonProperty("standard_service_request_id"), Sdk4meIgnoreInFieldSelection()] + internal long? StandardServiceRequestID => standardServiceRequest?.ID; + + #endregion + } +} \ No newline at end of file diff --git a/Source/Sdk4me/Entities/TimeEntry.cs b/Source/Sdk4me/Entities/TimeEntry.cs index 73ba4e5..fcb3e3c 100644 --- a/Source/Sdk4me/Entities/TimeEntry.cs +++ b/Source/Sdk4me/Entities/TimeEntry.cs @@ -8,6 +8,9 @@ namespace Sdk4me /// public class TimeEntry : BaseItem { + private string activityID; + private string billingID; + private string chargeID; private bool correction; private float? cost; private string costCurrency; @@ -30,6 +33,48 @@ public class TimeEntry : BaseItem private TimeAllocation timeAllocation; private int timeSpent; + #region ActivityID + + /// + /// The Activity ID is the unique identifier by which an activity that is performed in the context of a service offering is known in the billing system of the service provider. Some examples of activities are standard requests, a high impact incident or a request for information. The Activity ID can be used to support integrations between the billing system of the service provider and the 4me account in which the activities are performed. + /// + [JsonProperty("activityID")] + public string ActivityID + { + get => activityID; + internal set => activityID = value; + } + + #endregion + + #region BillingID + + /// + /// The Billing ID is the unique identifier by which all the activities that are performed through the coverage of the SLA are known in the billing system of the service provider. The billing ID can be used to support integrations between the billing system of the service provider and the 4me account in which the activities are performed. + /// + [JsonProperty("billingID")] + public string BillingID + { + get => billingID; + internal set => billingID = value; + } + + #endregion + + #region ChargeID + + /// + /// The Charge ID is the unique identifier by which an effort class that is linked to a time entry when an activity was performed through the coverage of the SLA is known in the billing system of the service provider. The effort class represents the type of effort that was performed when working on an activity. Some examples of effort classes are ‘Billable - Normal Hours’, ‘Billable overtime’, ‘Non Billable’ or ‘Senior System Engineer’. The Charge ID can be used to support integrations between the billing system of the service provider and the 4me account in which the activities are performed. In the billing system the Charge IDs will be linked to the rates that have been agreed on in the service contract. + /// + [JsonProperty("chargeID")] + public string ChargeID + { + get => chargeID; + internal set => chargeID = value; + } + + #endregion + #region Correction /// diff --git a/Source/Sdk4me/Extensions/To4meStringExtension.cs b/Source/Sdk4me/Extensions/To4meStringExtension.cs index 1711deb..e63560b 100644 --- a/Source/Sdk4me/Extensions/To4meStringExtension.cs +++ b/Source/Sdk4me/Extensions/To4meStringExtension.cs @@ -21,7 +21,10 @@ internal static class To4meStringExtension "supplierRequestID", "supportID", "systemID", - "supplier_requestID" + "supplier_requestID", + "billingID", + "activityID", + "chargeID" }; /// diff --git a/Source/Sdk4me/Handlers/ServiceLevelAgreementHandler.cs b/Source/Sdk4me/Handlers/ServiceLevelAgreementHandler.cs index 5f3d43e..b88af5f 100644 --- a/Source/Sdk4me/Handlers/ServiceLevelAgreementHandler.cs +++ b/Source/Sdk4me/Handlers/ServiceLevelAgreementHandler.cs @@ -83,6 +83,54 @@ public bool RemoveAllCustomerRepresentatives(ServiceLevelAgreement serviceLevelA #endregion + #region Effort class charge ID + + /// + /// Get all related effort class charge IDs. + /// + /// The service level agreement. + /// The field names to return. + /// A collection of effort class charge IDs. + public List GetEffortClassChargeIDs(ServiceLevelAgreement serviceLevelAgreement, params string[] fieldNames) + { + return GetChildHandler(serviceLevelAgreement, "effort_class_chargeIDs", SortOrder.None).Get(fieldNames); + } + + /// + /// Add an effort class charge ID. + /// + /// The service level agreement. + /// The effort class charge ID to add. + /// The updated effort class charge ID. + public EffortClassChargeID AddEffortClassChargeID(ServiceLevelAgreement serviceLevelAgreement, EffortClassChargeID effortClassChargeID) + { + return GetChildHandler(serviceLevelAgreement, "effort_class_chargeIDs").Insert(effortClassChargeID); + } + + /// + /// Update an effort class charge ID. + /// + /// The service level agreement. + /// The effort class charge ID to update. + /// The updated effort class charge ID. + public EffortClassChargeID UpdateEffortClassChargeID(ServiceLevelAgreement serviceLevelAgreement, EffortClassChargeID effortClassChargeID) + { + return GetChildHandler(serviceLevelAgreement, "effort_class_chargeIDs").Update(effortClassChargeID); + } + + /// + /// Delete an effort class charge ID. + /// + /// The person. + /// The effort class charge ID to delete. + /// True in case of success; otherwise false. + public bool DeleteEffortClassChargeID(ServiceLevelAgreement serviceLevelAgreement, EffortClassChargeID effortClassChargeID) + { + return GetChildHandler(serviceLevelAgreement, "effort_class_chargeIDs").Delete(effortClassChargeID); + } + + #endregion + #region Organizations /// @@ -376,5 +424,53 @@ public bool RemoveAllSkillPools(ServiceLevelAgreement serviceLevelAgreement) } #endregion + + #region Standard service request activity ID + + /// + /// Get all related standard service request activity IDs. + /// + /// The service level agreement. + /// The field names to return. + /// A collection of standard service request activity ID. + public List GetStandardServiceRequestActivityIDs(ServiceLevelAgreement serviceLevelAgreement, params string[] fieldNames) + { + return GetChildHandler(serviceLevelAgreement, "standard_service_request_activityIDs", SortOrder.None).Get(fieldNames); + } + + /// + /// Add a standard service request activity ID. + /// + /// The service level agreement. + /// The standard service request activity ID to add. + /// The updated standard service request activity ID. + public StandardServiceRequestActivityID AddStandardServiceRequestActivityID(ServiceLevelAgreement serviceLevelAgreement, StandardServiceRequestActivityID standardServiceRequestActivityID) + { + return GetChildHandler(serviceLevelAgreement, "standard_service_request_activityIDs").Insert(standardServiceRequestActivityID); + } + + /// + /// Update a standard service request activity ID. + /// + /// The service level agreement. + /// The standard service request activity ID to update. + /// The updated standard service request activity ID. + public StandardServiceRequestActivityID UpdateStandardServiceRequestActivityID(ServiceLevelAgreement serviceLevelAgreement, StandardServiceRequestActivityID standardServiceRequestActivityID) + { + return GetChildHandler(serviceLevelAgreement, "standard_service_request_activityIDs").Update(standardServiceRequestActivityID); + } + + /// + /// Delete a standard service request activity ID. + /// + /// The service level agreement. + /// The standard service request activity ID to delete. + /// True in case of success; otherwise false. + public bool DeleteStandardServiceRequestActivityID(ServiceLevelAgreement serviceLevelAgreement, StandardServiceRequestActivityID standardServiceRequestActivityID) + { + return GetChildHandler(serviceLevelAgreement, "standard_service_request_activityIDs").Delete(standardServiceRequestActivityID); + } + + #endregion } }