Initial C# SDK structure and interfaces
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.vs/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
*.user
|
||||||
|
*.suo
|
||||||
7
Chtn.CSharp.SDK.csproj
Normal file
7
Chtn.CSharp.SDK.csproj
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
26
Core/ChateniumClient.cs
Normal file
26
Core/ChateniumClient.cs
Normal file
@@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Interfaces/IDatabaseAPI.cs
Normal file
10
Interfaces/IDatabaseAPI.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
10
Interfaces/IKeyringAPI.cs
Normal file
10
Interfaces/IKeyringAPI.cs
Normal file
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user