From f4fb2409e86851e028eb4bb87ca252bd2708a226 Mon Sep 17 00:00:00 2001 From: Jules Raffoux <25800503+julesrx@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:52:49 +0200 Subject: [PATCH 1/2] Update _endpoints to a IReadOnlyDictionary --- csharp-ovh/Client/Client.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/csharp-ovh/Client/Client.cs b/csharp-ovh/Client/Client.cs index 29f2226..7dba2a2 100644 --- a/csharp-ovh/Client/Client.cs +++ b/csharp-ovh/Client/Client.cs @@ -61,8 +61,7 @@ public partial class Client public const string OVH_SIGNATURE_HEADER = "X-Ovh-Signature"; public const string OVH_BATCH_HEADER = "X-Ovh-Batch"; - private readonly Dictionary _endpoints = - new Dictionary(); + private readonly IReadOnlyDictionary _endpoints; private TimeSpan _defaultTimeout = TimeSpan.FromSeconds(180); @@ -102,14 +101,17 @@ public partial class Client private Client() { - _endpoints.Add("ovh-eu", "https://eu.api.ovh.com/1.0/"); - _endpoints.Add("ovh-us", "https://api.us.ovhcloud.com/1.0/"); - _endpoints.Add("ovh-ca", "https://ca.api.ovh.com/1.0/"); - _endpoints.Add("kimsufi-eu", "https://eu.api.kimsufi.com/1.0/"); - _endpoints.Add("kimsufi-ca", "https://ca.api.kimsufi.com/1.0/"); - _endpoints.Add("soyoustart-eu", "https://eu.api.soyoustart.com/1.0/"); - _endpoints.Add("soyoustart-ca", "https://ca.api.soyoustart.com/1.0/"); - _endpoints.Add("runabove-ca", "https://api.runabove.com/1.0/"); + _endpoints = new ReadOnlyDictionary(new Dictionary + { + { "ovh-eu", "https://eu.api.ovh.com/1.0/" }, + { "ovh-us", "https://api.us.ovhcloud.com/1.0/" }, + { "ovh-ca", "https://ca.api.ovh.com/1.0/" }, + { "kimsufi-eu", "https://eu.api.kimsufi.com/1.0/" }, + { "kimsufi-ca", "https://ca.api.kimsufi.com/1.0/" }, + { "soyoustart-eu", "https://eu.api.soyoustart.com/1.0/" }, + { "soyoustart-ca", "https://ca.api.soyoustart.com/1.0/" }, + { "runabove-ca", "https://api.runabove.com/1.0/" } + }); } private void LoadConfiguration(string endpoint, string applicationKey, From 65003bef1db7576dcd37d261f50b2eafc4dc4794 Mon Sep 17 00:00:00 2001 From: Jules Raffoux <25800503+julesrx@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:56:39 +0200 Subject: [PATCH 2/2] Update Client.cs --- csharp-ovh/Client/Client.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp-ovh/Client/Client.cs b/csharp-ovh/Client/Client.cs index 7dba2a2..93adfc6 100644 --- a/csharp-ovh/Client/Client.cs +++ b/csharp-ovh/Client/Client.cs @@ -101,7 +101,7 @@ public partial class Client private Client() { - _endpoints = new ReadOnlyDictionary(new Dictionary + _endpoints = new Dictionary { { "ovh-eu", "https://eu.api.ovh.com/1.0/" }, { "ovh-us", "https://api.us.ovhcloud.com/1.0/" }, @@ -111,7 +111,7 @@ private Client() { "soyoustart-eu", "https://eu.api.soyoustart.com/1.0/" }, { "soyoustart-ca", "https://ca.api.soyoustart.com/1.0/" }, { "runabove-ca", "https://api.runabove.com/1.0/" } - }); + }; } private void LoadConfiguration(string endpoint, string applicationKey,