-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Align error representation of the institutions error
- Loading branch information
Showing
4 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/RobinTTY.NordigenApiClient/JsonConverters/InstitutionsErrorConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using RobinTTY.NordigenApiClient.Models.Errors; | ||
|
||
namespace RobinTTY.NordigenApiClient.JsonConverters; | ||
internal class InstitutionsErrorConverter : JsonConverter<InstitutionsError> | ||
{ | ||
public override InstitutionsError Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions? options) | ||
{ | ||
var error = JsonSerializer.Deserialize<InstitutionsErrorInternal>(ref reader, options); | ||
return new InstitutionsError(error!.Country); | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, InstitutionsError value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value.ToString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters