Skip to content

Commit

Permalink
Update example application and README to use simpler mechanisms
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTTY committed May 17, 2024
1 parent 323abbd commit 6cc5154
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ API [here](https://developer.gocardless.com/bank-account-data/endpoints).
3. You can now use the different endpoints through the client:

```cs
var response = await client.InstitutionsEndpoint.GetInstitutions(country: "GB");
var response = await client.InstitutionsEndpoint.GetInstitutions(SupportedCountry.UnitedKingdom);
```

The responses that are returned always have the same structure:
Expand All @@ -59,7 +59,7 @@ example [here](src/RobinTTY.NordigenApiClient.ExampleApplication)):
1. Get a list of institutions in your country (e.g. Great Britain):

```cs
var institutionsResponse = await client.InstitutionsEndpoint.GetInstitutions(country: "GB");
var institutionsResponse = await client.InstitutionsEndpoint.GetInstitutions(SupportedCountry.UnitedKingdom);
if (institutionsResponse.IsSuccess)
institutionsResponse.Result.ForEach(institution =>
{
Expand All @@ -73,11 +73,8 @@ example [here](src/RobinTTY.NordigenApiClient.ExampleApplication)):

```cs
var institution = "BANK_OF_SCOTLAND_BOFSGBS1";
var userLanguage = "EN";
var reference = "your-internal-reference";
var redirect = new Uri("https://where-nordigen-will-redirect-after-authentication.com");
var requisitionRequest = new CreateRequisitionRequest(redirect, institution, reference, userLanguage);
var requisitionResponse = await client.RequisitionsEndpoint.CreateRequisition(requisitionRequest);
var requisitionResponse = await client.RequisitionsEndpoint.CreateRequisition(institution, redirect);

if (requisitionResponse.IsSuccess)
{
Expand Down Expand Up @@ -184,8 +181,8 @@ void OnTokenPairUpdated(object? sender, TokenPairUpdatedEventArgs e)
{
// The event args contain the updated token
Console.WriteLine("Updated token pair:");
Console.WriteLine($"Access Token: {e.JsonWebTokenPair!.AccessToken.EncodedToken}");
Console.WriteLine($"Refresh Token: {e.JsonWebTokenPair!.RefreshToken.EncodedToken}");
Console.WriteLine($"Access Token: {e.JsonWebTokenPair.AccessToken.EncodedToken}");
Console.WriteLine($"Refresh Token: {e.JsonWebTokenPair.RefreshToken.EncodedToken}");
}
```

Expand Down
3 changes: 2 additions & 1 deletion src/RobinTTY.NordigenApiClient.ExampleApplication/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using RobinTTY.NordigenApiClient;
using RobinTTY.NordigenApiClient.Models;
using RobinTTY.NordigenApiClient.Models.Requests;

// Create the client used to access the API
using var httpClient = new HttpClient();
Expand All @@ -8,7 +9,7 @@

////* Getting balances and transactions for a bank account */////
// 1. Get a list of institutions in your country (e.g. Great Britain):
var institutionsResponse = await client.InstitutionsEndpoint.GetInstitutions("GB");
var institutionsResponse = await client.InstitutionsEndpoint.GetInstitutions(SupportedCountry.UnitedKingdom);
if (institutionsResponse.IsSuccess)
institutionsResponse.Result.ForEach(institution =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 6cc5154

Please sign in to comment.