Skip to content

Commit

Permalink
Merge pull request #207 from kevbite/#206
Browse files Browse the repository at this point in the history
#206 Add TotalResults to Officers response
  • Loading branch information
kevbite authored Oct 1, 2023
2 parents 48ad528 + aa15647 commit 95bc2f6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/CompaniesHouse/Response/Officers/Officers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using CompaniesHouse.Response.CompanyProfile;
using Newtonsoft.Json;
using Newtonsoft.Json;

namespace CompaniesHouse.Response.Officers
{
Expand All @@ -13,5 +12,11 @@ public class Officers

[JsonProperty(PropertyName = "resigned_count")]
public int? ResignedCount { get; set; }

[JsonProperty(PropertyName = "total_results")]
public int TotalResults { get; set; }

[JsonProperty(PropertyName = "start_index")]
public int StartIndex { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public Officers Build()
.With(x => x.Items, officerSummary.Items)
.With(x => x.ActiveCount, officerSummary.ActiveCount)
.With(x => x.ResignedCount, officerSummary.ResignedCount)
.With(x => x.TotalResults, officerSummary.Items.Length)
.With(x => x.StartIndex, 1)
.Create();

return result;
Expand Down
4 changes: 4 additions & 0 deletions tests/CompaniesHouse.Tests/ResourceBuilders/Officers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ public class Officers
public Officer[] Items { get; set; }

public int ResignedCount { get; set; }

public int TotalResults { get; set; }

public int StartIndex { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public string Create()
""items"" : [
{string.Join(",", _officers.Items.Select(CreateSingle).ToArray())}
],
""resigned_count"" : {_officers.ResignedCount}
""resigned_count"" : {_officers.ResignedCount},
""total_results"" : {_officers.TotalResults},
""start_index"" : {_officers.StartIndex},
}}";
}

Expand Down

0 comments on commit 95bc2f6

Please sign in to comment.