Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure related services are side-loaded in Incident API response #318

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ZendeskApi.Build/ZendeskApi.Commons.props
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PropertyGroup>
<Major>7</Major>
<Minor>0</Minor>
<Revision>1</Revision>
<Revision>2</Revision>
<PackageVersion>$(Major).$(Minor).$(Revision)</PackageVersion>
</PropertyGroup>
<ItemGroup>
Expand Down
37 changes: 37 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/Attributes.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
18 changes: 18 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/Included.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
13 changes: 13 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/IncludedReference.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
9 changes: 9 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/Relationships.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Newtonsoft.Json;

namespace ZendeskApi.Client.Models.Status.Included;

public class Relationships
{
[JsonProperty("service")]
public Service Service { get; set; }
}
5 changes: 5 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/Service.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace ZendeskApi.Client.Models.Status.Included;

public class Service : DataContainer<IncludedReference>
{
}
15 changes: 15 additions & 0 deletions src/ZendeskApi.Client/Models/Status/Included/Type.cs
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Collections.Generic;
using Newtonsoft.Json;

namespace ZendeskApi.Client.Models.Status.Response;

public class ListIncidentsResponse : DataContainer<IReadOnlyList<Incident>>
{
[JsonProperty("included")]
public IReadOnlyList<Included.Included> Included { get; set; }
}