From af14e6e3e18e9d6f93c5e43bbf7d3a53df4fd892 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 Oct 2023 16:11:14 +0100 Subject: [PATCH 1/2] Ensure related services are side-loaded in Incident API reponse --- .../Models/Status/Included/Attributes.cs | 37 +++++++++++++++++++ .../Models/Status/Included/Included.cs | 18 +++++++++ .../Status/Included/IncludedReference.cs | 13 +++++++ .../Models/Status/Included/Relationships.cs | 9 +++++ .../Models/Status/Included/Service.cs | 5 +++ .../Models/Status/Included/Type.cs | 15 ++++++++ .../Status/Response/ListIncidentsResponse.cs | 3 ++ 7 files changed, 100 insertions(+) create mode 100644 src/ZendeskApi.Client/Models/Status/Included/Attributes.cs create mode 100644 src/ZendeskApi.Client/Models/Status/Included/Included.cs create mode 100644 src/ZendeskApi.Client/Models/Status/Included/IncludedReference.cs create mode 100644 src/ZendeskApi.Client/Models/Status/Included/Relationships.cs create mode 100644 src/ZendeskApi.Client/Models/Status/Included/Service.cs create mode 100644 src/ZendeskApi.Client/Models/Status/Included/Type.cs diff --git a/src/ZendeskApi.Client/Models/Status/Included/Attributes.cs b/src/ZendeskApi.Client/Models/Status/Included/Attributes.cs new file mode 100644 index 00000000..abf2f032 --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/Attributes.cs @@ -0,0 +1,37 @@ +using System; +using Newtonsoft.Json; + +namespace ZendeskApi.Client.Models.Status.Included; + +public class Attributes +{ + [JsonProperty("created_at")] + public DateTime? CreatedAt { get; set; } + + [JsonProperty("description")] + public string Description { get; set; } + + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("slug")] + public string Slug { get; set; } + + [JsonProperty("degradation")] + public bool? Degradation { get; set; } + + [JsonProperty("incident_id")] + public string IncidentId { get; set; } + + [JsonProperty("outage")] + public bool? Outage { get; set; } + + [JsonProperty("resolved_at")] + public DateTime? ResolvedAt { get; set; } + + [JsonProperty("service_id")] + public string ServiceId { get; set; } + + [JsonProperty("started_at")] + public DateTime? StartedAt { get; set; } +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Included/Included.cs b/src/ZendeskApi.Client/Models/Status/Included/Included.cs new file mode 100644 index 00000000..960edd2a --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/Included.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; + +namespace ZendeskApi.Client.Models.Status.Included; + +public class Included +{ + [JsonProperty("attributes")] + public Attributes Attributes { get; set; } + + [JsonProperty("id")] + public string Id { get; set; } + + [JsonProperty("type")] + public Type Type { get; set; } + + [JsonProperty("relationships")] + public Relationships Relationships { get; set; } +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Included/IncludedReference.cs b/src/ZendeskApi.Client/Models/Status/Included/IncludedReference.cs new file mode 100644 index 00000000..f7bec77f --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/IncludedReference.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace ZendeskApi.Client.Models.Status.Included; + +public class IncludedReference +{ + [JsonProperty("id")] + public string Id { get; set; } + + [JsonProperty("type")] + public Type Type { get; set; } +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Included/Relationships.cs b/src/ZendeskApi.Client/Models/Status/Included/Relationships.cs new file mode 100644 index 00000000..a4a29e4d --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/Relationships.cs @@ -0,0 +1,9 @@ +using Newtonsoft.Json; + +namespace ZendeskApi.Client.Models.Status.Included; + +public class Relationships +{ + [JsonProperty("service")] + public Service Service { get; set; } +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Included/Service.cs b/src/ZendeskApi.Client/Models/Status/Included/Service.cs new file mode 100644 index 00000000..086fdd1e --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/Service.cs @@ -0,0 +1,5 @@ +namespace ZendeskApi.Client.Models.Status.Included; + +public class Service : DataContainer +{ +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Included/Type.cs b/src/ZendeskApi.Client/Models/Status/Included/Type.cs new file mode 100644 index 00000000..a3b46ab7 --- /dev/null +++ b/src/ZendeskApi.Client/Models/Status/Included/Type.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace ZendeskApi.Client.Models.Status.Included; + +public enum Type +{ + [EnumMember(Value = "service")] + Service, + [EnumMember(Value = "incident_service")] + IncidentService, + [EnumMember(Value = "incident_update")] + IncidentUpdate, + [EnumMember(Value = "incident")] + Incident +} \ No newline at end of file diff --git a/src/ZendeskApi.Client/Models/Status/Response/ListIncidentsResponse.cs b/src/ZendeskApi.Client/Models/Status/Response/ListIncidentsResponse.cs index a58125b2..06329758 100644 --- a/src/ZendeskApi.Client/Models/Status/Response/ListIncidentsResponse.cs +++ b/src/ZendeskApi.Client/Models/Status/Response/ListIncidentsResponse.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; +using Newtonsoft.Json; namespace ZendeskApi.Client.Models.Status.Response; public class ListIncidentsResponse : DataContainer> { + [JsonProperty("included")] + public IReadOnlyList Included { get; set; } } \ No newline at end of file From 2b908e09d1c95590df21237e8c49e40ecae5fff1 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 20 Oct 2023 16:14:03 +0100 Subject: [PATCH 2/2] Bump version --- src/ZendeskApi.Build/ZendeskApi.Commons.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZendeskApi.Build/ZendeskApi.Commons.props b/src/ZendeskApi.Build/ZendeskApi.Commons.props index 6ef28625..b07502a1 100644 --- a/src/ZendeskApi.Build/ZendeskApi.Commons.props +++ b/src/ZendeskApi.Build/ZendeskApi.Commons.props @@ -23,7 +23,7 @@ 7 0 - 1 + 2 $(Major).$(Minor).$(Revision)