From 015109f763bcd29189c093d5a2e7cb1e64e42e15 Mon Sep 17 00:00:00 2001 From: GoldenBIOS Date: Mon, 6 Apr 2026 23:33:56 +0200 Subject: [PATCH] Initial C# SDK structure and interfaces --- .gitignore | 5 +++++ Chtn.CSharp.SDK.csproj | 7 +++++++ Core/ChateniumClient.cs | 26 ++++++++++++++++++++++++++ Interfaces/IDatabaseAPI.cs | 10 ++++++++++ Interfaces/IKeyringAPI.cs | 10 ++++++++++ 5 files changed, 58 insertions(+) create mode 100644 .gitignore create mode 100644 Chtn.CSharp.SDK.csproj create mode 100644 Core/ChateniumClient.cs create mode 100644 Interfaces/IDatabaseAPI.cs create mode 100644 Interfaces/IKeyringAPI.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6a84733 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.vs/ +[Bb]in/ +[Oo]bj/ +*.user +*.suo \ No newline at end of file diff --git a/Chtn.CSharp.SDK.csproj b/Chtn.CSharp.SDK.csproj new file mode 100644 index 0000000..dbdcea4 --- /dev/null +++ b/Chtn.CSharp.SDK.csproj @@ -0,0 +1,7 @@ + + + + netstandard2.0 + + + diff --git a/Core/ChateniumClient.cs b/Core/ChateniumClient.cs new file mode 100644 index 0000000..0d60ea3 --- /dev/null +++ b/Core/ChateniumClient.cs @@ -0,0 +1,26 @@ +using Chtn.CSharpSDK.Interfaces; +using System.Net.Http; +using System; + +namespace Chtn.CSharpSDK.Core +{ + public class ChateniumClient + { + private readonly IKeyringAPI _keyring; + private readonly IDatabaseAPI _database; + private readonly HttpClient _httpClient; + + public ChateniumClient(IKeyringAPI keyring, IDatabaseAPI database) + { + _keyring = keyring ?? throw new ArgumentNullException(nameof(keyring)); + _database = database ?? throw new ArgumentNullException(nameof(database)); + + _httpClient = new HttpClient(); + _httpClient.BaseAddress = new Uri("https://api.chatenium.hu"); + } + public void initialize() + { + _keyring.Set("keyring", "anyad"); + } + } +} \ No newline at end of file diff --git a/Interfaces/IDatabaseAPI.cs b/Interfaces/IDatabaseAPI.cs new file mode 100644 index 0000000..3ecf96e --- /dev/null +++ b/Interfaces/IDatabaseAPI.cs @@ -0,0 +1,10 @@ +namespace Chtn.CSharpSDK.Interfaces +{ + public interface IDatabaseAPI + { + void Set(string collection, string key, object value); + string Get(string collection, string key); + void Delete(string collection, string key); + void Flush(); + } +} \ No newline at end of file diff --git a/Interfaces/IKeyringAPI.cs b/Interfaces/IKeyringAPI.cs new file mode 100644 index 0000000..782197a --- /dev/null +++ b/Interfaces/IKeyringAPI.cs @@ -0,0 +1,10 @@ +namespace Chtn.CSharpSDK.Interfaces +{ + public interface IKeyringAPI + { + void Set(string key, object value); + string Get(string key); + void Delete(string key); + void Flush(); + } +} \ No newline at end of file