44 Commits
1.0.0 ... 1.2.1

Author SHA1 Message Date
87334bb28c Update Directory.Build.props 2025-12-22 09:59:50 -03:00
d26c3bd11a Add support to dotnet standard and framework 2025-12-22 09:51:08 -03:00
e3c42a9911 Update README.md 2025-12-16 19:23:47 -03:00
93301110b7 Update projects 2025-12-16 15:58:29 -03:00
44dc36430a Move flake generator to platform project 2025-12-11 10:16:30 -03:00
765b6319bb Add snowflake generator 2025-12-11 10:14:38 -03:00
1c570ce666 Delete DatabaseSeeder.cs 2025-12-05 11:30:50 -03:00
6238191512 Update database seeder 2025-12-05 10:34:11 -03:00
b6c7166b8e Add repository seeder 2025-12-05 10:17:08 -03:00
92a7bb3252 Update DatabaseConfiguration.cs 2025-12-04 18:31:35 -03:00
32a2a20fb1 Update BaseClassFirstContractResolver.cs 2025-07-08 20:29:51 -03:00
3edec858a8 Update BaseClassFirstContractResolver.cs 2025-07-08 20:26:06 -03:00
936f7f0f5e Update ConfigurationLoader.cs 2025-07-08 20:24:18 -03:00
0a88bf2ac6 Update CustomSerializerSettings.cs 2025-07-07 11:55:42 -03:00
817d89a57a Update CustomSerializerSettings.cs 2025-07-07 11:35:57 -03:00
2b6270264b Update Program.cs 2025-07-07 11:34:37 -03:00
e8d842bf34 Update CustomSerializerSettings 2025-07-07 11:34:36 -03:00
672fe601f7 Add json serialization configs 2025-07-07 11:06:41 -03:00
eda5b1894b Add logger with context object 2025-06-10 11:53:30 -03:00
e4986367e7 Disable ImplicitUsings 2025-06-04 16:55:16 -03:00
58f300e39b Update Program.cs 2025-06-04 07:45:04 -03:00
479f719816 Update Logger.cs 2025-06-03 20:03:23 -03:00
eb9e939fc8 Update log levels 2025-06-03 20:01:16 -03:00
c8bb2d95b5 Update TribufuApi.cs 2025-06-03 19:37:55 -03:00
e63812204d Rename Tribufu.Runtime to Tribufu.Platform 2025-06-02 10:06:03 -03:00
4b694a4031 Update Tribufu.Runtime.csproj 2025-06-02 09:24:13 -03:00
5fdd52265b Revert "Remove net standard support"
This reverts commit f45e827ba4.
2025-06-02 09:23:54 -03:00
f45e827ba4 Remove net standard support 2025-06-02 09:19:21 -03:00
ffc4079881 Update Tribufu.Runtime.csproj 2025-06-02 09:15:38 -03:00
374a634949 Add IsPublishable to all projects 2025-06-02 09:15:00 -03:00
13c5d6a71c Rename ConfigurationLoader 2025-06-02 09:06:21 -03:00
f6c296d9b6 Update READMEs 2025-06-02 09:00:15 -03:00
5b2588b47f Add shared packages 2025-06-02 08:58:34 -03:00
6ebfde013a Update TribufuApi.cs 2025-06-01 21:45:51 -03:00
9ff743097b Update TribufuApi.cs 2025-05-27 18:55:32 -03:00
42e14fc07b Update README.md 2025-05-27 08:39:35 -03:00
ed2dfa2b8f Update README.md 2025-05-27 08:39:00 -03:00
1815ca6bcd Update README.md 2025-05-27 08:35:17 -03:00
8994fc13d6 Update Directory.Build.props 2025-05-27 08:35:16 -03:00
549e7bcbe3 Update projects deps 2025-05-26 21:43:58 -03:00
aede8c7ac2 Update README.md 2025-05-26 21:41:40 -03:00
d791408793 Generate client with open-api-generator (#1)
* Generate project with open-api-generator

* Add example project

* Create wrapper class
2025-05-26 21:40:46 -03:00
311678cfd6 Remove submodules 2025-05-26 20:03:10 -03:00
269b07ee4e Add dotnet-utils submodule 2025-01-22 09:00:05 -03:00
136 changed files with 32771 additions and 6256 deletions

2
.env.example Normal file
View File

@@ -0,0 +1,2 @@
TRIBUFU_API_KEY=""
TRIBUFU_API_URL="https://api.tribufu.com"

6
.gitignore vendored
View File

@@ -1,7 +1,11 @@
.vs/ .vs/
bin/ bin/
obj/ obj/
releases/*
!releases/.gitkeep
.DS_Store
.env
*.filters *.filters
*.user *.user
.DS_Store desktop.ini

View File

@@ -0,0 +1,9 @@
docs/
.gitignore
*.sln
**.csproj
api/openapi.yaml
appveyor.yml
git_push.sh
README.md

66
.openapi-generator/FILES Normal file
View File

@@ -0,0 +1,66 @@
src/Tribufu/Api/TribufuGeneratedApi.cs
src/Tribufu/Client/ApiClient.cs
src/Tribufu/Client/ApiException.cs
src/Tribufu/Client/ApiResponse.cs
src/Tribufu/Client/ClientUtils.cs
src/Tribufu/Client/Configuration.cs
src/Tribufu/Client/ExceptionFactory.cs
src/Tribufu/Client/GlobalConfiguration.cs
src/Tribufu/Client/HttpMethod.cs
src/Tribufu/Client/IApiAccessor.cs
src/Tribufu/Client/IAsynchronousClient.cs
src/Tribufu/Client/IReadableConfiguration.cs
src/Tribufu/Client/ISynchronousClient.cs
src/Tribufu/Client/Multimap.cs
src/Tribufu/Client/OpenAPIDateConverter.cs
src/Tribufu/Client/RequestOptions.cs
src/Tribufu/Client/RetryConfiguration.cs
src/Tribufu/Model/AbstractOpenAPISchema.cs
src/Tribufu/Model/Account.cs
src/Tribufu/Model/Application.cs
src/Tribufu/Model/ApplicationType.cs
src/Tribufu/Model/AuthorizeRequest.cs
src/Tribufu/Model/ClientInfo.cs
src/Tribufu/Model/ClientType.cs
src/Tribufu/Model/CodeChallengeMethod.cs
src/Tribufu/Model/CodeResponse.cs
src/Tribufu/Model/CreateUser.cs
src/Tribufu/Model/CryptoViewModel.cs
src/Tribufu/Model/File.cs
src/Tribufu/Model/Game.cs
src/Tribufu/Model/GameServer.cs
src/Tribufu/Model/GameServerCluster.cs
src/Tribufu/Model/GameServerQuery.cs
src/Tribufu/Model/GameServerStatus.cs
src/Tribufu/Model/GrantType.cs
src/Tribufu/Model/Group.cs
src/Tribufu/Model/GroupGame.cs
src/Tribufu/Model/GroupMember.cs
src/Tribufu/Model/GroupRank.cs
src/Tribufu/Model/HashViewModel.cs
src/Tribufu/Model/IntrospectRequest.cs
src/Tribufu/Model/IntrospectResponse.cs
src/Tribufu/Model/IpAddress.cs
src/Tribufu/Model/LeaderboardItem.cs
src/Tribufu/Model/LeaderboardOrder.cs
src/Tribufu/Model/LoginProvider.cs
src/Tribufu/Model/ModelClient.cs
src/Tribufu/Model/Package.cs
src/Tribufu/Model/PackageRelease.cs
src/Tribufu/Model/Profile.cs
src/Tribufu/Model/ProfileGame.cs
src/Tribufu/Model/ProfileGroup.cs
src/Tribufu/Model/ResponseType.cs
src/Tribufu/Model/RevokeRequest.cs
src/Tribufu/Model/Search.cs
src/Tribufu/Model/SearchType.cs
src/Tribufu/Model/ServerMetrics.cs
src/Tribufu/Model/Subscription.cs
src/Tribufu/Model/SubscriptionPrice.cs
src/Tribufu/Model/TokenHintType.cs
src/Tribufu/Model/TokenRequest.cs
src/Tribufu/Model/TokenResponse.cs
src/Tribufu/Model/TokenType.cs
src/Tribufu/Model/UpdateProfile.cs
src/Tribufu/Model/UserInfo.cs
src/Tribufu/Model/UserType.cs

View File

@@ -0,0 +1 @@
7.12.0

View File

@@ -1,13 +1,13 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Authors>Tribufu</Authors> <Authors>Tribufu</Authors>
<Company>Tribufu</Company> <Company>Tribufu</Company>
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright> <Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
<FileVersion>1.0.0.0</FileVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl> <RepositoryUrl>https://github.com/tribufu/tribufu-dotnet</RepositoryUrl>
<Version>1.0.0</Version> <Version>1.2.1</Version>
<AssemblyVersion>$(Version).0</AssemblyVersion>
<NoWarn>$(NoWarn);0618;1591;1998;2002;8767</NoWarn>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@@ -3,8 +3,22 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally> <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageVersion Include="CppAst.CodeGen" Version="0.4.1" />
<PackageVersion Include="dotenv.net" Version="3.2.0" />
<PackageVersion Include="IdGen" Version="3.0.7" />
<PackageVersion Include="JsonSubTypes" Version="2.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.16" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Ini" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" /> <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="Polly" Version="8.1.0" />
<PackageVersion Include="RestSharp" Version="112.1.0" />
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageVersion Include="System.Net.Http" Version="4.3.4" /> <PackageVersion Include="Tomlyn.Extensions.Configuration" Version="1.0.6" />
<PackageVersion Include="Tomlyn" Version="0.17.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -2,11 +2,14 @@
.NET SDK to access Tribufu APIs and services. .NET SDK to access Tribufu APIs and services.
[![nuget][nuget-badge]][nuget-url]
[![MIT License][mit-badge]][mit-url] [![MIT License][mit-badge]][mit-url]
[![Discord Chat][discord-badge]][discord-url] [![Discord Chat][discord-badge]][discord-url]
[nuget-badge]: https://img.shields.io/nuget/v/Tribufu.svg
[nuget-url]: https://www.nuget.org/packages/Tribufu
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg [mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[mit-url]: https://github.com/tribufu/sdk-dotnet/blob/main/LICENSE.txt [mit-url]: https://github.com/tribufu/tribufu-dotnet/blob/main/LICENSE.txt
[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square [discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square
[discord-url]: https://www.tribufu.com/discord [discord-url]: https://www.tribufu.com/discord
@@ -17,4 +20,4 @@
This project is licensed under the [MIT License]. This project is licensed under the [MIT License].
[MIT License]: https://github.com/tribufu/sdk-dotnet/blob/main/LICENSE.txt [MIT License]: https://github.com/tribufu/tribufu-dotnet/blob/main/LICENSE.txt

View File

@@ -1,48 +1,142 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Native", "src\Tribufu.Native\Tribufu.Native.csproj", "{C66D6B57-324D-EAF2-3B65-75C9A7C35054}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Serialization", "src\Tribufu.Serialization\Tribufu.Serialization.csproj", "{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Serialization.Newtonsoft", "src\Tribufu.Serialization.Newtonsoft\Tribufu.Serialization.Newtonsoft.csproj", "{B7019B7B-A352-86BD-CCB6-747FB8661927}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu", "src\Tribufu\Tribufu.csproj", "{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu", "src\Tribufu\Tribufu.csproj", "{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Utils", "src\Tribufu.Utils\Tribufu.Utils.csproj", "{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Example", "src\Tribufu.Example\Tribufu.Example.csproj", "{D6392A29-E2DC-4050-B4C1-B279DD2D226D}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.ComponentModel", "src\Tribufu.ComponentModel\Tribufu.ComponentModel.csproj", "{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Logging", "src\Tribufu.Logging\Tribufu.Logging.csproj", "{CFD80847-9B98-4991-BADF-8714E7D8D81C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Configuration", "src\Tribufu.Configuration\Tribufu.Configuration.csproj", "{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Platform", "src\Tribufu.Platform\Tribufu.Platform.csproj", "{26EEB407-733C-4383-9211-B083CD5F593B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.EntityFrameworkCore", "src\Tribufu.EntityFrameworkCore\Tribufu.EntityFrameworkCore.csproj", "{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Serialization", "src\Tribufu.Serialization\Tribufu.Serialization.csproj", "{D6DAE078-2F80-49DD-97A3-B1223FE04F91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.ComponentModel", "src\Tribufu.ComponentModel\Tribufu.ComponentModel.csproj", "{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.AspNetCore", "src\Tribufu.AspNetCore\Tribufu.AspNetCore.csproj", "{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C66D6B57-324D-EAF2-3B65-75C9A7C35054}.Release|Any CPU.Build.0 = Release|Any CPU
{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{322FE36B-9E9B-9E66-678F-36C4D3BAC0CE}.Release|Any CPU.Build.0 = Release|Any CPU
{B7019B7B-A352-86BD-CCB6-747FB8661927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B7019B7B-A352-86BD-CCB6-747FB8661927}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7019B7B-A352-86BD-CCB6-747FB8661927}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7019B7B-A352-86BD-CCB6-747FB8661927}.Release|Any CPU.Build.0 = Release|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|x64.ActiveCfg = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|x64.Build.0 = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|x86.ActiveCfg = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Debug|x86.Build.0 = Debug|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|Any CPU.Build.0 = Release|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|Any CPU.Build.0 = Release|Any CPU
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|x64.ActiveCfg = Release|Any CPU
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|x64.Build.0 = Release|Any CPU
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Release|Any CPU.ActiveCfg = Release|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|x86.ActiveCfg = Release|Any CPU
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Release|Any CPU.Build.0 = Release|Any CPU {7B7890D8-863A-4F1D-98C0-4B7D8C46CB52}.Release|x86.Build.0 = Release|Any CPU
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Release|Any CPU.ActiveCfg = Release|Any CPU {D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|x64.ActiveCfg = Debug|Any CPU
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Release|Any CPU.Build.0 = Release|Any CPU {D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|x64.Build.0 = Debug|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|x86.ActiveCfg = Debug|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Debug|x86.Build.0 = Debug|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|Any CPU.Build.0 = Release|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|x64.ActiveCfg = Release|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|x64.Build.0 = Release|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|x86.ActiveCfg = Release|Any CPU
{D6392A29-E2DC-4050-B4C1-B279DD2D226D}.Release|x86.Build.0 = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|x64.ActiveCfg = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|x64.Build.0 = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|x86.ActiveCfg = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Debug|x86.Build.0 = Debug|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|Any CPU.Build.0 = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|x64.ActiveCfg = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|x64.Build.0 = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|x86.ActiveCfg = Release|Any CPU
{CFD80847-9B98-4991-BADF-8714E7D8D81C}.Release|x86.Build.0 = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|x64.ActiveCfg = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|x64.Build.0 = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|x86.ActiveCfg = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Debug|x86.Build.0 = Debug|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|Any CPU.Build.0 = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|x64.ActiveCfg = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|x64.Build.0 = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|x86.ActiveCfg = Release|Any CPU
{C0A841C8-9FC5-4AC0-B9AD-6BBFCEDCBE5F}.Release|x86.Build.0 = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|x64.ActiveCfg = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|x64.Build.0 = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|x86.ActiveCfg = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Debug|x86.Build.0 = Debug|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|Any CPU.Build.0 = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|x64.ActiveCfg = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|x64.Build.0 = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|x86.ActiveCfg = Release|Any CPU
{26EEB407-733C-4383-9211-B083CD5F593B}.Release|x86.Build.0 = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|x64.ActiveCfg = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|x64.Build.0 = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|x86.ActiveCfg = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Debug|x86.Build.0 = Debug|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|Any CPU.Build.0 = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|x64.ActiveCfg = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|x64.Build.0 = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|x86.ActiveCfg = Release|Any CPU
{E7F9A76F-C087-410B-B4B5-A928A6CDC2BA}.Release|x86.Build.0 = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|x64.ActiveCfg = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|x64.Build.0 = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|x86.ActiveCfg = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Debug|x86.Build.0 = Debug|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|Any CPU.Build.0 = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|x64.ActiveCfg = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|x64.Build.0 = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|x86.ActiveCfg = Release|Any CPU
{D6DAE078-2F80-49DD-97A3-B1223FE04F91}.Release|x86.Build.0 = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|x64.ActiveCfg = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|x64.Build.0 = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|x86.ActiveCfg = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Debug|x86.Build.0 = Debug|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|Any CPU.Build.0 = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|x64.ActiveCfg = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|x64.Build.0 = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|x86.ActiveCfg = Release|Any CPU
{7CB04FFD-8F4B-4B40-BB4B-2BAA19D783E1}.Release|x86.Build.0 = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|x64.ActiveCfg = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|x64.Build.0 = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|x86.ActiveCfg = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Debug|x86.Build.0 = Debug|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|Any CPU.Build.0 = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|x64.ActiveCfg = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|x64.Build.0 = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|x86.ActiveCfg = Release|Any CPU
{B6C47A6C-E389-4132-8E1C-0CBB6C96C205}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

0
releases/.gitkeep Normal file
View File

12
scripts/generate.ps1 Normal file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env pwsh
$env:CSHARP_POST_PROCESS_FILE = ""
java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate `
-i https://api.tribufu.com/openapi.json `
-g csharp `
-o . `
--global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false `
--additional-properties=packageName=Tribufu,library=restsharp,targetFramework=net47,zeroBasedEnums=true `
--openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated `
--skip-validate-spec

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env sh
nswag run ./src/Tribufu/api.nswag

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env sh
dotnet pack

7
scripts/package.ps1 Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env pwsh
Get-ChildItem ./releases -Filter *.nupkg -Recurse -Force | Remove-Item -Force
dotnet clean
dotnet build -c Release
dotnet pack -c Release -o ./releases

View File

@@ -0,0 +1,33 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: UNLICENSED
using Microsoft.AspNetCore.Http;
using System;
using System.Linq;
namespace Tribufu.AspNetCore.Extensions
{
public static class HttpContextExtensions
{
public static string GetIpAddress(this HttpContext context)
{
var headers = context.Request.Headers;
if (headers.TryGetValue("CF-Connecting-IP", out var cfConnectingIp))
{
return cfConnectingIp.FirstOrDefault() ?? "127.0.0.1";
}
if (headers.TryGetValue("X-Forwarded-For", out var xForwardedFor))
{
var forwardedIps = xForwardedFor.ToString().Split(',', StringSplitOptions.RemoveEmptyEntries);
if (forwardedIps.Length > 0)
{
return forwardedIps[0].Trim();
}
}
return context.Connection.RemoteIpAddress?.ToString() ?? "127.0.0.1";
}
}
}

View File

@@ -0,0 +1 @@
# Tribufu AspNetCore

View File

@@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.AspNetCore</PackageId>
<Description>Tribufu AspNetCore</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tribufu.Configuration\Tribufu.Configuration.csproj" />
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
<ProjectReference Include="..\Tribufu.Platform\Tribufu.Platform.csproj" />
</ItemGroup>
</Project>

View File

@@ -1 +1 @@
# Tribufu # Tribufu ComponentModel

View File

@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<PackageId>Tribufu.ComponentModel</PackageId> <PackageId>Tribufu.ComponentModel</PackageId>
<Description>Tribufu Component Model Helpers</Description> <Description>Tribufu ComponentModel</Description>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" /> <None Include="README.md" Pack="true" PackagePath="\" />

View File

@@ -0,0 +1,50 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Microsoft.Extensions.Configuration;
using System.IO;
using Tomlyn.Extensions.Configuration;
using Tribufu.Logging;
using Tribufu.Platform;
namespace Tribufu.Configuration
{
public static class ConfigurationLoader
{
public static IConfiguration Load(string[] fileNames)
{
var configDirectory = Paths.GetApplicationConfigDirectory();
var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddEnvironmentVariables();
foreach (var fileName in fileNames)
{
var fullPath = Path.Combine(configDirectory, fileName);
if (!File.Exists(fullPath))
{
Logger.Debug($"Config file '{fullPath}' not found, skipping.");
continue;
}
var extension = Path.GetExtension(fullPath).ToLowerInvariant();
switch (extension)
{
case ".ini":
configurationBuilder.AddIniFile(fullPath, true, false);
break;
case ".json":
configurationBuilder.AddJsonFile(fullPath, true, false);
break;
case ".toml":
configurationBuilder.AddTomlFile(fullPath, true, false);
break;
default:
Logger.Warn($"Unsupported config file extension: {extension}");
break;
}
}
return configurationBuilder.Build();
}
}
}

View File

@@ -0,0 +1,16 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Microsoft.Extensions.Configuration;
namespace Tribufu.Configuration.Extensions
{
public static class IConfigurationExtensions
{
public static string? Get(this IConfiguration configuration, string prefix, string key)
{
var section = configuration.GetSection(prefix);
return !section.Exists() ? configuration[$"{prefix}_{key}"] : section[key];
}
}
}

View File

@@ -0,0 +1 @@
# Tribufu Configuration

View File

@@ -0,0 +1,32 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.Configuration</PackageId>
<Description>Tribufu Configuration</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" />
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" />
<PackageReference Include="Microsoft.Extensions.Configuration" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="Tomlyn.Extensions.Configuration" />
<PackageReference Include="Tomlyn" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
<ProjectReference Include="..\Tribufu.Platform\Tribufu.Platform.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,105 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Microsoft.Extensions.Configuration;
using System;
namespace Tribufu.EntityFrameworkCore
{
public class DatabaseConfiguration
{
public DatabaseDriver Driver { get; set; }
public string? Version { get; set; }
public string? Host { get; set; }
public string? Port { get; set; }
public string? User { get; set; }
public string? Password { get; set; }
public string? Schema { get; set; }
/// <summary>
/// Loads the <see cref="DatabaseConfiguration"/> from the "database" section or from root-level keys prefixed with "database_".
/// </summary>
/// <param name="configuration">The configuration source.</param>
/// <returns>The populated <see cref="DatabaseConfiguration"/> instance.</returns>
public static DatabaseConfiguration Load(IConfiguration configuration)
{
var section = configuration.GetSection("database");
var useRootFallback = !section.Exists();
string? GetConfig(string key) => useRootFallback ? configuration[$"database_{key}"] : section[key];
var driverString = GetConfig("driver") ?? throw new Exception("Missing database driver");
if (!Enum.TryParse<DatabaseDriver>(driverString, true, out var driver))
{
throw new Exception($"Unsupported database driver: {driverString}");
}
return new DatabaseConfiguration
{
Driver = driver,
Version = GetConfig("version"),
Host = GetConfig("host"),
Port = GetConfig("port"),
User = GetConfig("user"),
Password = GetConfig("password"),
Schema = GetConfig("schema")
};
}
/*
services.AddDbContext<DbContext>(options =>
{
switch (dbConfig.Driver)
{
case DatabaseDriver.MySql:
var mysqlConnection = $"Server={dbConfig.Host};Port={dbConfig.Port};Uid={dbConfig.User};Pwd={dbConfig.Password};Database={dbConfig.Schema};ConvertZeroDateTime=True;";
options.UseMySql(mysqlConnection, ServerVersion.Parse(dbConfig.Version ?? "8.0"), mySqlOptions => { });
break;
case DatabaseDriver.Postgres:
var pgsqlConnection = $"Host={dbConfig.Host};Port={dbConfig.Port};Database={dbConfig.Schema};Username={dbConfig.User};Password={dbConfig.Password};";
options.UseNpgsql(pgsqlConnection, npgsqlOptions => { });
break;
case DatabaseDriver.SqlServer:
var sqlServerConnection = $"Server={dbConfig.Host},{dbConfig.Port};Database={dbConfig.Schema};User Id={dbConfig.User};Password={dbConfig.Password};Encrypt=True;TrustServerCertificate=True;";
options.UseSqlServer(sqlServerConnection, sqlOptions => { });
break;
case DatabaseDriver.Oracle:
var oracleConnection = $"User Id={dbConfig.User};Password={dbConfig.Password};Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={dbConfig.Host})(PORT={dbConfig.Port})))(CONNECT_DATA=(SERVICE_NAME={dbConfig.Schema})));";
options.UseOracle(oracleConnection, oracleOptions => { });
break;
case DatabaseDriver.Firebird:
var firebirdConnection = $"User={dbConfig.User};Password={dbConfig.Password};Database={dbConfig.Host}:{dbConfig.Port}/{dbConfig.Schema};Dialect=3;";
options.UseFirebird(firebirdConnection, firebirdOptions => { });
break;
case DatabaseDriver.Sqlite:
var savedDirectory = Paths.GetApplicationSavedDirectory();
if (!Directory.Exists(savedDirectory)) Directory.CreateDirectory(savedDirectory);
var sqliteDatabaseFile = string.IsNullOrEmpty(dbConfig.Schema) ? "default.db" : $"{dbConfig.Schema}.db";
var sqliteDatabasePath = Path.Combine(savedDirectory, sqliteDatabaseFile);
options.UseSqlite($"Data Source={sqliteDatabasePath}", sqliteOptions => { });
break;
case DatabaseDriver.MongoDb:
var mongoUriBuilder = new MongoUrlBuilder
{
Server = new MongoServerAddress(dbConfig.Host, int.Parse(dbConfig.Port ?? "27017")),
Username = dbConfig.User,
Password = dbConfig.Password,
DatabaseName = dbConfig.Schema
};
var mongoClient = new MongoClient(mongoUriBuilder.ToMongoUrl());
var mongoDatabase = mongoClient.GetDatabase(dbConfig.Schema ?? "default");
options.UseMongoDB(mongoDatabase.Client, mongoDatabase.DatabaseNamespace.DatabaseName);
break;
default:
throw new NotSupportedException($"Unsupported database driver: {dbConfig.Driver}");
}
});
*/
}
}

View File

@@ -0,0 +1,12 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
namespace Tribufu.EntityFrameworkCore
{
public static class DatabaseConstants
{
public const uint DEFAULT_PAGINATION = 20;
public const uint MAX_PAGINATION = 100;
}
}

View File

@@ -0,0 +1,22 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
namespace Tribufu.EntityFrameworkCore
{
public enum DatabaseDriver : byte
{
MySql = 0,
Postgres = 1,
SqlServer = 2,
Oracle = 3,
Firebird = 4,
Sqlite = 5,
MongoDb = 6,
}
}

View File

@@ -0,0 +1 @@
# Tribufu EntityFrameworkCore

View File

@@ -0,0 +1,41 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Tribufu.EntityFrameworkCore.Repositories
{
public interface IRepository<T, K> where T : class
{
Task SeedAsync();
IList<T> GetAll();
Task<IList<T>> GetAllAsync();
IList<T> GetPage(uint page, uint limit);
Task<IList<T>> GetPageAsync(uint page, uint limit);
T? GetOne(K key);
Task<T?> GetOneAsync(K key);
T? Create(T entity);
Task<T?> CreateAsync(T entity);
T? Update(T entity);
Task<T?> UpdateAsync(T entity);
void Delete(K key);
Task DeleteAsync(K key);
void Delete(T entity);
Task DeleteAsync(T entity);
}
}

View File

@@ -0,0 +1,117 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Tribufu.EntityFrameworkCore.Repositories
{
public class Repository<C, T, K> : IRepository<T, K> where C : DbContext where T : class
{
protected readonly C _context;
protected readonly DbSet<T> _dbSet;
public Repository(C context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
_dbSet = context.Set<T>();
}
public virtual async Task SeedAsync()
{
}
public virtual IList<T> GetAll()
{
return [.. _dbSet];
}
public virtual async Task<IList<T>> GetAllAsync()
{
return await _dbSet.ToListAsync();
}
public virtual IList<T> GetPage(uint page, uint limit)
{
return _dbSet.Skip((int)((page < 1 ? 0 : page - 1) * limit)).Take((int)limit).ToList();
}
public virtual async Task<IList<T>> GetPageAsync(uint page, uint limit)
{
return await _dbSet.Skip((int)((page < 1 ? 0 : page - 1) * limit)).Take((int)limit).ToListAsync();
}
public virtual T? GetOne(K key)
{
return _dbSet.Find(key);
}
public virtual async Task<T?> GetOneAsync(K key)
{
return await _dbSet.FindAsync(key);
}
public virtual T? Create(T entity)
{
_dbSet.Add(entity);
var result = _context.SaveChanges();
return result > 0 ? entity : null;
}
public virtual async Task<T?> CreateAsync(T entity)
{
await _dbSet.AddAsync(entity);
var result = await _context.SaveChangesAsync();
return result > 0 ? entity : null;
}
public virtual T? Update(T entity)
{
_dbSet.Update(entity);
var result = _context.SaveChanges();
return result > 0 ? entity : null;
}
public virtual async Task<T?> UpdateAsync(T entity)
{
_dbSet.Update(entity);
var result = await _context.SaveChangesAsync();
return result > 0 ? entity : null;
}
public virtual void Delete(K key)
{
var entity = _dbSet.Find(key);
if (entity != null)
{
Delete(entity);
}
}
public virtual async Task DeleteAsync(K key)
{
var entity = await _dbSet.FindAsync(key);
if (entity != null)
{
await DeleteAsync(entity);
}
}
public virtual void Delete(T entity)
{
_dbSet.Remove(entity);
_context.SaveChanges();
}
public virtual async Task DeleteAsync(T entity)
{
_dbSet.Remove(entity);
await _context.SaveChangesAsync();
}
}
}

View File

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.EntityFrameworkCore</PackageId>
<Description>Tribufu EntityFrameworkCore</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<AppDesignerFolder>Properties</AppDesignerFolder>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<Nullable>enable</Nullable>
<OutputType>Library</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tribufu.Configuration\Tribufu.Configuration.csproj" />
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
<ProjectReference Include="..\Tribufu.Platform\Tribufu.Platform.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,36 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using dotenv.net;
using System;
using System.Threading.Tasks;
using Tribufu.Client;
using Tribufu.Logging;
namespace Tribufu.Test
{
public static class Program
{
public static async Task Main(string[] args)
{
Logger.Initialize(LogLevel.Trace);
DotEnv.Load(new DotEnvOptions(ignoreExceptions: true, envFilePaths: [".env", "../../.env"]));
var apiKey = Environment.GetEnvironmentVariable("TRIBUFU_API_KEY");
var tribufu = new TribufuApi(apiKey ?? "");
Logger.Debug(TribufuApi.GetUserAgent());
try
{
var result = await tribufu.GetUserInfoAsync();
Logger.Debug(result.ToString());
}
catch (ApiException e)
{
Logger.Debug(e.Message);
}
}
}
}

View File

@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="dotenv.net" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
<ProjectReference Include="..\Tribufu\Tribufu.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,20 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
namespace Tribufu.Logging
{
public enum LogLevel : byte
{
Off = 0,
Error = 1,
Warn = 2,
Info = 3,
Debug = 4,
Trace = 5,
}
}

View File

@@ -0,0 +1,79 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
namespace Tribufu.Logging
{
public static class Logger
{
private static LogLevel _level = LogLevel.Off;
public static void Initialize(LogLevel level = LogLevel.Off)
{
_level = level;
}
public static void Info(object context, string message)
{
Info($"({context.GetType().Name}) {message}");
}
public static void Warn(object context, string message)
{
Warn($"({context.GetType().Name}) {message}");
}
public static void Error(object context, string message)
{
Error($"({context.GetType().Name}) {message}");
}
public static void Debug(object context, string message)
{
Debug($"({context.GetType().Name}) {message}");
}
public static void Trace(object context, string message)
{
Trace($"({context.GetType().Name}) {message}");
}
public static void Info(string message)
{
Log(LogLevel.Info, message, ConsoleColor.Green);
}
public static void Warn(string message)
{
Log(LogLevel.Warn, message, ConsoleColor.Yellow);
}
public static void Error(string message)
{
Log(LogLevel.Error, message, ConsoleColor.Red);
}
public static void Debug(string message)
{
Log(LogLevel.Debug, message, ConsoleColor.White);
}
public static void Trace(string message)
{
Log(LogLevel.Trace, message, ConsoleColor.DarkGray);
}
private static void Log(LogLevel level, string message, ConsoleColor color)
{
if (level <= _level)
{
var defaultColor = Console.ForegroundColor;
Console.ForegroundColor = color;
var timestamp = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss");
Console.WriteLine($"[{timestamp}] [{level.ToString().ToUpper()}]: {message}");
Console.ForegroundColor = defaultColor;
}
}
}
}

View File

@@ -0,0 +1 @@
# Tribufu Logging

View File

@@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<PackageId>Tribufu.Serialization.Newtonsoft</PackageId> <PackageId>Tribufu.Logging</PackageId>
<Description>Tribufu Serialization Helpers for Newtonsoft.Json</Description> <Description>Tribufu Logging</Description>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" /> <None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1 +0,0 @@
# Tribufu

View File

@@ -1,21 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>Tribufu.Native</PackageId>
<Description>Tribufu Native Interop</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\vendor\win-arm64\tribufu_sdk.dll" Pack="true" PackagePath="runtimes\win-arm64\native\" />
<None Include="..\..\vendor\win-x64\tribufu_sdk.dll" Pack="true" PackagePath="runtimes\win-x64\native\" />
<None Include="..\..\vendor\win-x86\tribufu_sdk.dll" Pack="true" PackagePath="runtimes\win-x86\native\" />
</ItemGroup>
</Project>

View File

@@ -1,13 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System.Runtime.InteropServices;
namespace Tribufu.Native
{
public class TribufuNative
{
[DllImport("tribufu_sdk")]
public static extern void tribufu_sdk_shutdown();
}
}

View File

@@ -0,0 +1,45 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: UNLICENSED
using IdGen;
using System;
namespace Tribufu.Platform
{
public static class FlakeGenerator
{
public static readonly DateTime EPOCH = new(2016, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static readonly IdStructure _structure = new(41, 10, 12);
private static readonly IdGeneratorOptions _options = new(_structure, new DefaultTimeSource(EPOCH));
private static readonly IdGenerator _generator = new(0, _options);
public static ulong New()
{
//Console.WriteLine("Max. generators : {0}", _structure.MaxGenerators);
//Console.WriteLine("Id's/ms per generator : {0}", _structure.MaxSequenceIds);
//Console.WriteLine("Id's/ms total : {0}", _structure.MaxGenerators * _structure.MaxSequenceIds);
//Console.WriteLine("Wraparound interval : {0}", _structure.WraparoundInterval(_generator.Options.TimeSource));
//Console.WriteLine("Wraparound date : {0}", _structure.WraparoundDate(_generator.Options.TimeSource.Epoch, _generator.Options.TimeSource).ToString("O"));
return (ulong)_generator.CreateId();
}
public static ulong FromTimestamp(DateTime timestamp, ushort sequence = 0)
{
var diff = (long)(timestamp - EPOCH).TotalMilliseconds;
if (diff < 0 || diff > (1L << 41) - 1)
{
throw new ArgumentOutOfRangeException(nameof(timestamp), "Timestamp out of range for flake.");
}
ulong timestampPart = (ulong)diff << 22; // 41 bits << (10+12)
ulong generatorPart = 0ul << 12; // Always 0
ulong sequencePart = (ulong)(sequence & 0xFFF); // 12 bits
return timestampPart | generatorPart | sequencePart;
}
}
}

View File

@@ -0,0 +1,122 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using System.IO;
using System.Runtime.InteropServices;
using Tribufu.Logging;
namespace Tribufu.Platform
{
/// <summary>
/// Provides standardized access to important directories, such as config, saved data, logs, and platform-specific binaries.
/// This is especially useful for abstracting file path logic across environments (development, production, etc).
/// </summary>
public static class Paths
{
/// <summary>
/// Gets the root base directory of the application.
/// </summary>
/// <remarks>
/// - In development, this resolves to the root of the repository (five levels above bin/Debug or bin/Release).
/// - In production, it resolves to two levels above the binary location.
/// - It uses case-insensitive checks and runtime heuristics to improve accuracy.
/// </remarks>
/// <returns>The absolute path to the base directory.</returns>
public static string GetApplicationDirectory()
{
try
{
string baseDirectory;
string defaultBaseDirectory = AppContext.BaseDirectory;
bool isDevelopment = defaultBaseDirectory.ToLowerInvariant().Contains("debug");
if (isDevelopment)
{
// Go 5 levels up to simulate project root
baseDirectory = Path.Combine(defaultBaseDirectory, "..", "..", "..", "..", "..");
}
else
{
baseDirectory = Path.Combine(defaultBaseDirectory, "..", "..");
}
return Path.GetFullPath(baseDirectory);
}
catch (Exception ex)
{
Logger.Warn($"(Paths) Failed to resolve base directory: {ex.Message}");
return AppContext.BaseDirectory;
}
}
/// <summary>
/// Gets the path to the platform-specific binary directory.
/// </summary>
/// <returns>
/// The absolute path to <c>bin/&lt;runtime-identifier&gt;</c> if available,
/// otherwise falls back to <c>bin/dotnet</c>.
/// </returns>
public static string GetApplicationBinDirectory()
{
var binDirectory = Path.Combine(GetApplicationDirectory(), "bin");
if (!string.IsNullOrEmpty(RuntimeInformation.RuntimeIdentifier))
{
binDirectory = Path.Combine(binDirectory, RuntimeInformation.RuntimeIdentifier);
}
else
{
binDirectory = Path.Combine(binDirectory, "dotnet");
}
return binDirectory;
}
/// <summary>
/// Gets the path to the configuration directory.
/// </summary>
/// <returns>The absolute path to the <c>config</c> directory.</returns>
public static string GetApplicationConfigDirectory()
{
return Path.Combine(GetApplicationDirectory(), "config");
}
/// <summary>
/// Gets the path to the assets directory.
/// </summary>
/// <returns>The absolute path to the <c>assets</c> directory.</returns>
public static string GetApplicationAssetsDirectory()
{
return Path.Combine(GetApplicationDirectory(), "assets");
}
/// <summary>
/// Gets the path to the saved data directory.
/// </summary>
/// <returns>The absolute path to the <c>saved</c> directory.</returns>
public static string GetApplicationSavedDirectory()
{
return Path.Combine(GetApplicationDirectory(), "saved");
}
/// <summary>
/// Gets the path to the cache directory inside <c>saved</c>.
/// </summary>
/// <returns>The absolute path to the <c>saved/cache</c> directory.</returns>
public static string GetApplicationCacheDirectory()
{
return Path.Combine(GetApplicationSavedDirectory(), "cache");
}
/// <summary>
/// Gets the path to the logs directory inside <c>saved</c>.
/// </summary>
/// <returns>The absolute path to the <c>saved/logs</c> directory.</returns>
public static string GetApplicationLogsDirectory()
{
return Path.Combine(GetApplicationSavedDirectory(), "logs");
}
}
}

View File

@@ -0,0 +1 @@
# Tribufu Runtime

View File

@@ -1,18 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<PackageId>Tribufu.Utils</PackageId> <PackageId>Tribufu.Platform</PackageId>
<Description>Tribufu Utils</Description> <Description>Tribufu Platform</Description>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<OutputType>Library</OutputType>
<TargetFrameworks>net5.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" /> <None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="IdGen" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tribufu.ComponentModel\Tribufu.ComponentModel.csproj" />
<ProjectReference Include="..\Tribufu.Logging\Tribufu.Logging.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,21 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using Newtonsoft.Json;
namespace Tribufu.Serialization.Newtonsoft
{
public class DecimalStringConverter : JsonConverter<decimal>
{
public override decimal ReadJson(JsonReader reader, Type objectType, decimal existingValue, bool hasExistingValue, JsonSerializer serializer)
{
return decimal.Parse(reader.ToString());
}
public override void WriteJson(JsonWriter writer, decimal value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}

View File

@@ -1,21 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using Newtonsoft.Json;
namespace Tribufu.Serialization.Newtonsoft
{
public class LongStringConverter : JsonConverter<ulong>
{
public override ulong ReadJson(JsonReader reader, Type objectType, ulong existingValue, bool hasExistingValue, JsonSerializer serializer)
{
return ulong.Parse(reader.ToString());
}
public override void WriteJson(JsonWriter writer, ulong value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}

View File

@@ -1 +0,0 @@
# Tribufu

View File

@@ -0,0 +1,20 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: UNLICENSED
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Tribufu.Serialization
{
public class BaseClassFirstContractResolver : DefaultContractResolver
{
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
{
var props = base.CreateProperties(type, memberSerialization);
return props.OrderBy(p => { return p.DeclaringType == type ? 1 : 0; }).ToList();
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
namespace Tribufu.Serialization
{
public static class CustomSerializerSettings
{
public static JsonSerializerSettings GetNewtonsoftJson()
{
var settings = new JsonSerializerSettings();
SetNewtonsoftJson(settings);
return settings;
}
public static void SetNewtonsoftJson(JsonSerializerSettings settings)
{
settings.ContractResolver = new BaseClassFirstContractResolver
{
NamingStrategy = new SnakeCaseNamingStrategy()
};
settings.Converters.Add(new DecimalNullableStringConverter());
settings.Converters.Add(new DecimalStringConverter());
settings.Converters.Add(new ULongNullableStringConverter());
settings.Converters.Add(new ULongStringConverter());
settings.Converters.Add(new StringEnumConverter(new SnakeCaseNamingStrategy(), false));
settings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
}
}
}

View File

@@ -0,0 +1,46 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using System;
using System.Globalization;
namespace Tribufu.Serialization
{
public class DecimalNullableStringConverter : JsonConverter<decimal?>
{
public override decimal? ReadJson(JsonReader reader, Type objectType, decimal? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer)
{
string value = reader.Value?.ToString();
if (string.IsNullOrWhiteSpace(value))
{
return null;
}
return decimal.Parse(value);
}
throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing decimal?.");
}
public override void WriteJson(JsonWriter writer, decimal? value, JsonSerializer serializer)
{
if (value.HasValue)
{
writer.WriteValue(value.Value.ToString(CultureInfo.InvariantCulture));
}
else
{
writer.WriteNull();
}
}
}
}

View File

@@ -1,22 +1,32 @@
// Copyright (c) Tribufu. All Rights Reserved. // Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using System; using System;
using System.Text.Json; using System.Globalization;
using System.Text.Json.Serialization;
namespace Tribufu.Serialization namespace Tribufu.Serialization
{ {
public class DecimalStringConverter : JsonConverter<decimal> public class DecimalStringConverter : JsonConverter<decimal>
{ {
public override decimal Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) public override decimal ReadJson(JsonReader reader, Type objectType, decimal existingValue, bool hasExistingValue, JsonSerializer serializer)
{ {
return Convert.ToUInt64(reader.GetString()); if (reader.TokenType == JsonToken.String && decimal.TryParse(reader.Value?.ToString(), out var result))
{
return result;
}
if (reader.TokenType == JsonToken.Integer)
{
return Convert.ToUInt64(reader.Value);
}
throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing decimal.");
} }
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options) public override void WriteJson(JsonWriter writer, decimal value, JsonSerializer serializer)
{ {
writer.WriteStringValue(value.ToString()); writer.WriteValue(value.ToString(CultureInfo.InvariantCulture));
} }
} }
} }

View File

@@ -1,22 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Tribufu.Serialization
{
public class LongStringConverter : JsonConverter<ulong>
{
public override ulong Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return Convert.ToUInt64(reader.GetString());
}
public override void Write(Utf8JsonWriter writer, ulong value, JsonSerializerOptions options)
{
writer.WriteStringValue(value.ToString());
}
}
}

View File

@@ -0,0 +1,35 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json.Serialization;
using System.Text.RegularExpressions;
namespace Tribufu.Serialization
{
public class NetworkAwareSnakeCaseNamingStrategy : SnakeCaseNamingStrategy
{
private static readonly string[] KnownAcronyms = new string[] { "IPv4", "IPv6" };
protected override string ResolvePropertyName(string name)
{
if (string.IsNullOrEmpty(name))
{
return name;
}
foreach (var acr in KnownAcronyms)
{
name = Regex.Replace(name, acr, acr.ToLower());
}
var snake = base.ResolvePropertyName(name);
foreach (var acr in KnownAcronyms)
{
var lower = acr.ToLower();
snake = snake.Replace(lower.Replace("_", ""), lower);
}
return snake;
}
}
}

View File

@@ -1 +1 @@
# Tribufu # Tribufu Serialization

View File

@@ -1,16 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<PackageId>Tribufu.Serialization</PackageId> <PackageId>Tribufu.Serialization</PackageId>
<Description>Tribufu Serialization Helpers</Description> <Description>Tribufu Serialization</Description>
<PackageReadmeFile>README.md</PackageReadmeFile> <PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworks>net5.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<IsPublishable>false</IsPublishable>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\" /> <None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,45 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using System;
namespace Tribufu.Serialization
{
public class ULongNullableStringConverter : JsonConverter<ulong?>
{
public override ulong? ReadJson(JsonReader reader, Type objectType, ulong? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.Null)
{
return null;
}
if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer)
{
string value = reader.Value?.ToString();
if (string.IsNullOrWhiteSpace(value))
{
return null;
}
return ulong.Parse(value);
}
throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing ulong?.");
}
public override void WriteJson(JsonWriter writer, ulong? value, JsonSerializer serializer)
{
if (value.HasValue)
{
writer.WriteValue(value.Value.ToString());
}
else
{
writer.WriteNull();
}
}
}
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using Newtonsoft.Json;
using System;
namespace Tribufu.Serialization
{
public class ULongStringConverter : JsonConverter<ulong>
{
public override ulong ReadJson(JsonReader reader, Type objectType, ulong existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.String && ulong.TryParse(reader.Value?.ToString(), out var result))
{
return result;
}
if (reader.TokenType == JsonToken.Integer)
{
return Convert.ToUInt64(reader.Value);
}
throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing ulong.");
}
public override void WriteJson(JsonWriter writer, ulong value, JsonSerializer serializer)
{
writer.WriteValue(value.ToString());
}
}
}

View File

@@ -1 +0,0 @@
# Tribufu

View File

@@ -1,72 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
using System;
using System.IO;
using System.Runtime.InteropServices;
namespace Tribufu.Utils
{
public static class TribufuAppContext
{
public static string GetBaseDirectory()
{
string defaultBaseDirectory = AppContext.BaseDirectory;
string baseDirectory;
if (defaultBaseDirectory.Contains("Debug") || defaultBaseDirectory.Contains("Release"))
{
baseDirectory = Path.Combine(defaultBaseDirectory, "..", "..", "..", "..", "..");
}
else
{
baseDirectory = Path.Combine(defaultBaseDirectory, "..", "..");
}
baseDirectory = Path.GetFullPath(baseDirectory);
return baseDirectory;
}
public static string GetBinDirectory()
{
var binDirectory = Path.Combine(GetBaseDirectory(), "bin");
if (!string.IsNullOrEmpty(RuntimeInformation.RuntimeIdentifier))
{
binDirectory = Path.Combine(binDirectory, RuntimeInformation.RuntimeIdentifier);
}
else
{
binDirectory = Path.Combine(binDirectory, "dotnet");
}
return binDirectory;
}
public static string GetConfigDirectory()
{
return Path.Combine(GetBaseDirectory(), "config");
}
public static string GetAssetsDirectory()
{
return Path.Combine(GetBaseDirectory(), "assets");
}
public static string GetSavedDirectory()
{
return Path.Combine(GetBaseDirectory(), "saved");
}
public static string GetCacheDirectory()
{
return Path.Combine(GetSavedDirectory(), "cache");
}
public static string GetLogsDirectory()
{
return Path.Combine(GetSavedDirectory(), "logs");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,824 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Text;
using System.Threading;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using RestSharp;
using RestSharp.Serializers;
using RestSharpMethod = RestSharp.Method;
using FileIO = System.IO.File;
using Polly;
using Tribufu.Model;
namespace Tribufu.Client
{
/// <summary>
/// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON.
/// </summary>
internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer
{
private readonly IReadableConfiguration _configuration;
private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
public CustomJsonCodec(IReadableConfiguration configuration)
{
_configuration = configuration;
}
public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration)
{
_serializerSettings = serializerSettings;
_configuration = configuration;
}
/// <summary>
/// Serialize the object into a JSON string.
/// </summary>
/// <param name="obj">Object to be serialized.</param>
/// <returns>A JSON string.</returns>
public string Serialize(object obj)
{
if (obj != null && obj is AbstractOpenAPISchema)
{
// the object to be serialized is an oneOf/anyOf schema
return ((AbstractOpenAPISchema)obj).ToJson();
}
else
{
return JsonConvert.SerializeObject(obj, _serializerSettings);
}
}
public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value);
public T Deserialize<T>(RestResponse response)
{
var result = (T)Deserialize(response, typeof(T));
return result;
}
/// <summary>
/// Deserialize the JSON string into a proper object.
/// </summary>
/// <param name="response">The HTTP response.</param>
/// <param name="type">Object type.</param>
/// <returns>Object representation of the JSON string.</returns>
internal object Deserialize(RestResponse response, Type type)
{
if (type == typeof(byte[])) // return byte array
{
return response.RawBytes;
}
// TODO: ? if (type.IsAssignableFrom(typeof(Stream)))
if (type == typeof(Stream))
{
var bytes = response.RawBytes;
if (response.Headers != null)
{
var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath)
? global::System.IO.Path.GetTempPath()
: _configuration.TempFolderPath;
var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$");
foreach (var header in response.Headers)
{
var match = regex.Match(header.ToString());
if (match.Success)
{
string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", ""));
FileIO.WriteAllBytes(fileName, bytes);
return new FileStream(fileName, FileMode.Open);
}
}
}
var stream = new MemoryStream(bytes);
return stream;
}
if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object
{
return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind);
}
if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type
{
return Convert.ChangeType(response.Content, type);
}
// at this point, it must be a model (json)
try
{
return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings);
}
catch (Exception e)
{
throw new ApiException(500, e.Message);
}
}
public ISerializer Serializer => this;
public IDeserializer Deserializer => this;
public string[] AcceptedContentTypes => ContentType.JsonAccept;
public SupportsContentType SupportsContentType => contentType =>
contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) ||
contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase);
public ContentType ContentType { get; set; } = ContentType.Json;
public DataFormat DataFormat => DataFormat.Json;
}
/// <summary>
/// Provides a default implementation of an Api client (both synchronous and asynchronous implementations),
/// encapsulating general REST accessor use cases.
/// </summary>
public partial class ApiClient : ISynchronousClient, IAsynchronousClient
{
private readonly string _baseUrl;
/// <summary>
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
/// These settings can be adjusted to accommodate custom serialization rules.
/// </summary>
public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Allows for extending request processing for <see cref="ApiClient"/> generated code.
/// </summary>
/// <param name="request">The RestSharp request object</param>
partial void InterceptRequest(RestRequest request);
/// <summary>
/// Allows for extending response processing for <see cref="ApiClient"/> generated code.
/// </summary>
/// <param name="request">The RestSharp request object</param>
/// <param name="response">The RestSharp response object</param>
partial void InterceptResponse(RestRequest request, RestResponse response);
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />, defaulting to the global configurations' base url.
/// </summary>
public ApiClient()
{
_baseUrl = GlobalConfiguration.Instance.BasePath;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiClient" />
/// </summary>
/// <param name="basePath">The target service's base path in URL format.</param>
/// <exception cref="ArgumentException"></exception>
public ApiClient(string basePath)
{
if (string.IsNullOrEmpty(basePath))
throw new ArgumentException("basePath cannot be empty");
_baseUrl = basePath;
}
/// <summary>
/// Constructs the RestSharp version of an http method
/// </summary>
/// <param name="method">Swagger Client Custom HttpMethod</param>
/// <returns>RestSharp's HttpMethod instance.</returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
private RestSharpMethod Method(HttpMethod method)
{
RestSharpMethod other;
switch (method)
{
case HttpMethod.Get:
other = RestSharpMethod.Get;
break;
case HttpMethod.Post:
other = RestSharpMethod.Post;
break;
case HttpMethod.Put:
other = RestSharpMethod.Put;
break;
case HttpMethod.Delete:
other = RestSharpMethod.Delete;
break;
case HttpMethod.Head:
other = RestSharpMethod.Head;
break;
case HttpMethod.Options:
other = RestSharpMethod.Options;
break;
case HttpMethod.Patch:
other = RestSharpMethod.Patch;
break;
default:
throw new ArgumentOutOfRangeException("method", method, null);
}
return other;
}
/// <summary>
/// Provides all logic for constructing a new RestSharp <see cref="RestRequest"/>.
/// At this point, all information for querying the service is known.
/// Here, it is simply mapped into the RestSharp request.
/// </summary>
/// <param name="method">The http verb.</param>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object.
/// It is assumed that any merge with GlobalConfiguration has been done before calling this method.</param>
/// <returns>[private] A new RestRequest instance.</returns>
/// <exception cref="ArgumentNullException"></exception>
private RestRequest NewRequest(
HttpMethod method,
string path,
RequestOptions options,
IReadableConfiguration configuration)
{
if (path == null) throw new ArgumentNullException("path");
if (options == null) throw new ArgumentNullException("options");
if (configuration == null) throw new ArgumentNullException("configuration");
RestRequest request = new RestRequest(path, Method(method));
if (options.PathParameters != null)
{
foreach (var pathParam in options.PathParameters)
{
request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment);
}
}
if (options.QueryParameters != null)
{
foreach (var queryParam in options.QueryParameters)
{
foreach (var value in queryParam.Value)
{
request.AddQueryParameter(queryParam.Key, value);
}
}
}
if (configuration.DefaultHeaders != null)
{
foreach (var headerParam in configuration.DefaultHeaders)
{
request.AddHeader(headerParam.Key, headerParam.Value);
}
}
if (options.HeaderParameters != null)
{
foreach (var headerParam in options.HeaderParameters)
{
foreach (var value in headerParam.Value)
{
request.AddOrUpdateHeader(headerParam.Key, value);
}
}
}
if (options.FormParameters != null)
{
foreach (var formParam in options.FormParameters)
{
request.AddParameter(formParam.Key, formParam.Value);
}
}
if (options.Data != null)
{
if (options.Data is Stream stream)
{
var contentType = "application/octet-stream";
if (options.HeaderParameters != null)
{
var contentTypes = options.HeaderParameters["Content-Type"];
contentType = contentTypes[0];
}
var bytes = ClientUtils.ReadAsBytes(stream);
request.AddParameter(contentType, bytes, ParameterType.RequestBody);
}
else
{
if (options.HeaderParameters != null)
{
var contentTypes = options.HeaderParameters["Content-Type"];
if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json")))
{
request.RequestFormat = DataFormat.Json;
}
else
{
// TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default.
}
}
else
{
// Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly.
request.RequestFormat = DataFormat.Json;
}
request.AddJsonBody(options.Data);
}
}
if (options.FileParameters != null)
{
foreach (var fileParam in options.FileParameters)
{
foreach (var file in fileParam.Value)
{
var bytes = ClientUtils.ReadAsBytes(file);
var fileStream = file as FileStream;
if (fileStream != null)
request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name));
else
request.AddFile(fileParam.Key, bytes, "no_file_name_provided");
}
}
}
if (options.HeaderParameters != null)
{
if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data")))
{
request.AlwaysMultipartFormData = true;
}
}
return request;
}
/// <summary>
/// Transforms a RestResponse instance into a new ApiResponse instance.
/// At this point, we have a concrete http response from the service.
/// Here, it is simply mapped into the [public] ApiResponse object.
/// </summary>
/// <param name="response">The RestSharp response object</param>
/// <returns>A new ApiResponse instance.</returns>
private ApiResponse<T> ToApiResponse<T>(RestResponse<T> response)
{
T result = response.Data;
string rawContent = response.Content;
var transformed = new ApiResponse<T>(response.StatusCode, new Multimap<string, string>(), result, rawContent)
{
ErrorText = response.ErrorMessage,
Cookies = new List<Cookie>()
};
if (response.Headers != null)
{
foreach (var responseHeader in response.Headers)
{
transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value));
}
}
if (response.ContentHeaders != null)
{
foreach (var responseHeader in response.ContentHeaders)
{
transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value));
}
}
if (response.Cookies != null)
{
foreach (var responseCookies in response.Cookies.Cast<Cookie>())
{
transformed.Cookies.Add(
new Cookie(
responseCookies.Name,
responseCookies.Value,
responseCookies.Path,
responseCookies.Domain)
);
}
}
return transformed;
}
/// <summary>
/// Executes the HTTP request for the current service.
/// Based on functions received it can be async or sync.
/// </summary>
/// <param name="getResponse">Local function that executes http request and returns http response.</param>
/// <param name="setOptions">Local function to specify options for the service.</param>
/// <param name="request">The RestSharp request object</param>
/// <param name="options">The RestSharp options object</param>
/// <param name="configuration">A per-request configuration object.
/// It is assumed that any merge with GlobalConfiguration has been done before calling this method.</param>
/// <returns>A new ApiResponse instance.</returns>
private async Task<ApiResponse<T>> ExecClientAsync<T>(Func<RestClient, Task<RestResponse<T>>> getResponse, Action<RestClientOptions> setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration)
{
var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl;
var clientOptions = new RestClientOptions(baseUrl)
{
ClientCertificates = configuration.ClientCertificates,
Timeout = configuration.Timeout,
Proxy = configuration.Proxy,
UserAgent = configuration.UserAgent,
UseDefaultCredentials = configuration.UseDefaultCredentials,
RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback
};
setOptions(clientOptions);
using (RestClient client = new RestClient(clientOptions,
configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration))))
{
InterceptRequest(request);
RestResponse<T> response = await getResponse(client);
// if the response type is oneOf/anyOf, call FromJSON to deserialize the data
if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T)))
{
try
{
response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content });
}
catch (Exception ex)
{
throw ex.InnerException != null ? ex.InnerException : ex;
}
}
else if (typeof(T).Name == "Stream") // for binary response
{
response.Data = (T)(object)new MemoryStream(response.RawBytes);
}
else if (typeof(T).Name == "Byte[]") // for byte response
{
response.Data = (T)(object)response.RawBytes;
}
else if (typeof(T).Name == "String") // for string response
{
response.Data = (T)(object)response.Content;
}
InterceptResponse(request, response);
var result = ToApiResponse(response);
if (response.ErrorMessage != null)
{
result.ErrorText = response.ErrorMessage;
}
if (response.Cookies != null && response.Cookies.Count > 0)
{
if (result.Cookies == null) result.Cookies = new List<Cookie>();
foreach (var restResponseCookie in response.Cookies.Cast<Cookie>())
{
var cookie = new Cookie(
restResponseCookie.Name,
restResponseCookie.Value,
restResponseCookie.Path,
restResponseCookie.Domain
)
{
Comment = restResponseCookie.Comment,
CommentUri = restResponseCookie.CommentUri,
Discard = restResponseCookie.Discard,
Expired = restResponseCookie.Expired,
Expires = restResponseCookie.Expires,
HttpOnly = restResponseCookie.HttpOnly,
Port = restResponseCookie.Port,
Secure = restResponseCookie.Secure,
Version = restResponseCookie.Version
};
result.Cookies.Add(cookie);
}
}
return result;
}
}
private async Task<RestResponse<T>> DeserializeRestResponseFromPolicyAsync<T>(RestClient client, RestRequest request, PolicyResult<RestResponse> policyResult, CancellationToken cancellationToken = default)
{
if (policyResult.Outcome == OutcomeType.Successful)
{
return await client.Deserialize<T>(policyResult.Result, cancellationToken);
}
else
{
return new RestResponse<T>(request)
{
ErrorException = policyResult.FinalException
};
}
}
private ApiResponse<T> Exec<T>(RestRequest request, RequestOptions options, IReadableConfiguration configuration)
{
Action<RestClientOptions> setOptions = (clientOptions) =>
{
var cookies = new CookieContainer();
if (options.Cookies != null && options.Cookies.Count > 0)
{
foreach (var cookie in options.Cookies)
{
cookies.Add(new Cookie(cookie.Name, cookie.Value));
}
}
clientOptions.CookieContainer = cookies;
};
Func<RestClient, Task<RestResponse<T>>> getResponse = (client) =>
{
if (RetryConfiguration.RetryPolicy != null)
{
var policy = RetryConfiguration.RetryPolicy;
var policyResult = policy.ExecuteAndCapture(() => client.Execute(request));
return DeserializeRestResponseFromPolicyAsync<T>(client, request, policyResult);
}
else
{
return Task.FromResult(client.Execute<T>(request));
}
};
return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult();
}
private Task<ApiResponse<T>> ExecAsync<T>(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken))
{
Action<RestClientOptions> setOptions = (clientOptions) =>
{
//no extra options
};
Func<RestClient, Task<RestResponse<T>>> getResponse = async (client) =>
{
if (RetryConfiguration.AsyncRetryPolicy != null)
{
var policy = RetryConfiguration.AsyncRetryPolicy;
var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false);
return await DeserializeRestResponseFromPolicyAsync<T>(client, request, policyResult, cancellationToken);
}
else
{
return await client.ExecuteAsync<T>(request, cancellationToken).ConfigureAwait(false);
}
};
return ExecClientAsync(getResponse, setOptions, request, options, configuration);
}
#region IAsynchronousClient
/// <summary>
/// Make a HTTP GET request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP POST request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP PUT request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP DELETE request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP HEAD request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP OPTION request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken);
}
/// <summary>
/// Make a HTTP PATCH request (async).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <param name="cancellationToken">Token that enables callers to cancel the request.</param>
/// <returns>A Task containing ApiResponse</returns>
public Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default)
{
var config = configuration ?? GlobalConfiguration.Instance;
return ExecAsync<T>(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken);
}
#endregion IAsynchronousClient
#region ISynchronousClient
/// <summary>
/// Make a HTTP GET request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Get<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Get, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP POST request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Post<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Post, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP PUT request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Put<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Put, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP DELETE request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Delete<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Delete, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP HEAD request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Head<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Head, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP OPTION request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Options<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Options, path, options, config), options, config);
}
/// <summary>
/// Make a HTTP PATCH request (synchronous).
/// </summary>
/// <param name="path">The target path (or resource).</param>
/// <param name="options">The additional request options.</param>
/// <param name="configuration">A per-request configuration object. It is assumed that any merge with
/// GlobalConfiguration has been done before calling this method.</param>
/// <returns>A Task containing ApiResponse</returns>
public ApiResponse<T> Patch<T>(string path, RequestOptions options, IReadableConfiguration configuration = null)
{
var config = configuration ?? GlobalConfiguration.Instance;
return Exec<T>(NewRequest(HttpMethod.Patch, path, options, config), options, config);
}
#endregion ISynchronousClient
}
}

View File

@@ -0,0 +1,69 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
namespace Tribufu.Client
{
/// <summary>
/// API Exception
/// </summary>
public class ApiException : Exception
{
/// <summary>
/// Gets or sets the error code (HTTP status code)
/// </summary>
/// <value>The error code (HTTP status code).</value>
public int ErrorCode { get; set; }
/// <summary>
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
public object ErrorContent { get; private set; }
/// <summary>
/// Gets or sets the HTTP headers
/// </summary>
/// <value>HTTP headers</value>
public Multimap<string, string> Headers { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
public ApiException() { }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
public ApiException(int errorCode, string message) : base(message)
{
this.ErrorCode = errorCode;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
/// <param name="headers">HTTP Headers.</param>
public ApiException(int errorCode, string message, object errorContent = null, Multimap<string, string> headers = null) : base(message)
{
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
this.Headers = headers;
}
}
}

View File

@@ -0,0 +1,167 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
namespace Tribufu.Client
{
/// <summary>
/// Provides a non-generic contract for the ApiResponse wrapper.
/// </summary>
public interface IApiResponse
{
/// <summary>
/// The data type of <see cref="Content"/>
/// </summary>
Type ResponseType { get; }
/// <summary>
/// The content of this response
/// </summary>
Object Content { get; }
/// <summary>
/// Gets or sets the status code (HTTP status code)
/// </summary>
/// <value>The status code.</value>
HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets or sets the HTTP headers
/// </summary>
/// <value>HTTP headers</value>
Multimap<string, string> Headers { get; }
/// <summary>
/// Gets or sets any error text defined by the calling client.
/// </summary>
string ErrorText { get; set; }
/// <summary>
/// Gets or sets any cookies passed along on the response.
/// </summary>
List<Cookie> Cookies { get; set; }
/// <summary>
/// The raw content of this response
/// </summary>
string RawContent { get; }
}
/// <summary>
/// API Response
/// </summary>
public class ApiResponse<T> : IApiResponse
{
#region Properties
/// <summary>
/// Gets or sets the status code (HTTP status code)
/// </summary>
/// <value>The status code.</value>
public HttpStatusCode StatusCode { get; }
/// <summary>
/// Gets or sets the HTTP headers
/// </summary>
/// <value>HTTP headers</value>
public Multimap<string, string> Headers { get; }
/// <summary>
/// Gets or sets the data (parsed HTTP body)
/// </summary>
/// <value>The data.</value>
public T Data { get; }
/// <summary>
/// Gets or sets any error text defined by the calling client.
/// </summary>
public string ErrorText { get; set; }
/// <summary>
/// Gets or sets any cookies passed along on the response.
/// </summary>
public List<Cookie> Cookies { get; set; }
/// <summary>
/// The content of this response
/// </summary>
public Type ResponseType
{
get { return typeof(T); }
}
/// <summary>
/// The data type of <see cref="Content"/>
/// </summary>
public object Content
{
get { return Data; }
}
/// <summary>
/// The raw content
/// </summary>
public string RawContent { get; }
#endregion Properties
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse{T}" /> class.
/// </summary>
/// <param name="statusCode">HTTP status code.</param>
/// <param name="headers">HTTP headers.</param>
/// <param name="data">Data (parsed HTTP body)</param>
/// <param name="rawContent">Raw content.</param>
public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data, string rawContent)
{
StatusCode = statusCode;
Headers = headers;
Data = data;
RawContent = rawContent;
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse{T}" /> class.
/// </summary>
/// <param name="statusCode">HTTP status code.</param>
/// <param name="headers">HTTP headers.</param>
/// <param name="data">Data (parsed HTTP body)</param>
public ApiResponse(HttpStatusCode statusCode, Multimap<string, string> headers, T data) : this(statusCode, headers, data, null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse{T}" /> class.
/// </summary>
/// <param name="statusCode">HTTP status code.</param>
/// <param name="data">Data (parsed HTTP body)</param>
/// <param name="rawContent">Raw content.</param>
public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ApiResponse{T}" /> class.
/// </summary>
/// <param name="statusCode">HTTP status code.</param>
/// <param name="data">Data (parsed HTTP body)</param>
public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null)
{
}
#endregion Constructors
}
}

View File

@@ -0,0 +1,248 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
namespace Tribufu.Client
{
/// <summary>
/// Utility functions providing some benefit to API client consumers.
/// </summary>
public static class ClientUtils
{
/// <summary>
/// Sanitize filename by removing the path
/// </summary>
/// <param name="filename">Filename</param>
/// <returns>Filename</returns>
public static string SanitizeFilename(string filename)
{
Match match = Regex.Match(filename, @".*[/\\](.*)$");
return match.Success ? match.Groups[1].Value : filename;
}
/// <summary>
/// Convert params to key/value pairs.
/// Use collectionFormat to properly format lists and collections.
/// </summary>
/// <param name="collectionFormat">The swagger-supported collection format, one of: csv, tsv, ssv, pipes, multi</param>
/// <param name="name">Key name.</param>
/// <param name="value">Value object.</param>
/// <returns>A multimap of keys with 1..n associated values.</returns>
public static Multimap<string, string> ParameterToMultiMap(string collectionFormat, string name, object value)
{
var parameters = new Multimap<string, string>();
if (value is ICollection collection && collectionFormat == "multi")
{
foreach (var item in collection)
{
parameters.Add(name, ParameterToString(item));
}
}
else if (value is IDictionary dictionary)
{
if(collectionFormat == "deepObject") {
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
}
}
else {
foreach (DictionaryEntry entry in dictionary)
{
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
}
}
}
else
{
parameters.Add(name, ParameterToString(value));
}
return parameters;
}
/// <summary>
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
/// If parameter is a list, join the list with ",".
/// Otherwise just return the string.
/// </summary>
/// <param name="obj">The parameter (header, path, query, form).</param>
/// <param name="configuration">An optional configuration instance, providing formatting options used in processing.</param>
/// <returns>Formatted string.</returns>
public static string ParameterToString(object obj, IReadableConfiguration configuration = null)
{
if (obj is DateTime dateTime)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return dateTime.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is DateTimeOffset dateTimeOffset)
// Return a formatted date string - Can be customized with Configuration.DateTimeFormat
// Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o")
// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8
// For example: 2009-06-15T13:45:30.0000000
return dateTimeOffset.ToString((configuration ?? GlobalConfiguration.Instance).DateTimeFormat);
if (obj is bool boolean)
return boolean ? "true" : "false";
if (obj is ICollection collection) {
List<string> entries = new List<string>();
foreach (var entry in collection)
entries.Add(ParameterToString(entry, configuration));
return string.Join(",", entries);
}
if (obj is Enum && HasEnumMemberAttrValue(obj))
return GetEnumMemberAttrValue(obj);
return Convert.ToString(obj, CultureInfo.InvariantCulture);
}
/// <summary>
/// Serializes the given object when not null. Otherwise return null.
/// </summary>
/// <param name="obj">The object to serialize.</param>
/// <returns>Serialized string.</returns>
public static string Serialize(object obj)
{
return obj != null ? Newtonsoft.Json.JsonConvert.SerializeObject(obj) : null;
}
/// <summary>
/// Encode string in base64 format.
/// </summary>
/// <param name="text">string to be encoded.</param>
/// <returns>Encoded string.</returns>
public static string Base64Encode(string text)
{
return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text));
}
/// <summary>
/// Convert stream to byte array
/// </summary>
/// <param name="inputStream">Input stream to be converted</param>
/// <returns>Byte array</returns>
public static byte[] ReadAsBytes(Stream inputStream)
{
using (var ms = new MemoryStream())
{
inputStream.CopyTo(ms);
return ms.ToArray();
}
}
/// <summary>
/// Select the Content-Type header's value from the given content-type array:
/// if JSON type exists in the given array, use it;
/// otherwise use the first one defined in 'consumes'
/// </summary>
/// <param name="contentTypes">The Content-Type array to select from.</param>
/// <returns>The Content-Type header to use.</returns>
public static string SelectHeaderContentType(string[] contentTypes)
{
if (contentTypes.Length == 0)
return null;
foreach (var contentType in contentTypes)
{
if (IsJsonMime(contentType))
return contentType;
}
return contentTypes[0]; // use the first content type specified in 'consumes'
}
/// <summary>
/// Select the Accept header's value from the given accepts array:
/// if JSON exists in the given array, use it;
/// otherwise use all of them (joining into a string)
/// </summary>
/// <param name="accepts">The accepts array to select from.</param>
/// <returns>The Accept header to use.</returns>
public static string SelectHeaderAccept(string[] accepts)
{
if (accepts.Length == 0)
return null;
if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase))
return "application/json";
return string.Join(",", accepts);
}
/// <summary>
/// Provides a case-insensitive check that a provided content type is a known JSON-like content type.
/// </summary>
public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$");
/// <summary>
/// Check if the given MIME is a JSON MIME.
/// JSON MIME examples:
/// application/json
/// application/json; charset=UTF8
/// APPLICATION/JSON
/// application/vnd.company+json
/// </summary>
/// <param name="mime">MIME</param>
/// <returns>Returns True if MIME type is json.</returns>
public static bool IsJsonMime(string mime)
{
if (string.IsNullOrWhiteSpace(mime)) return false;
return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json");
}
/// <summary>
/// Is the Enum decorated with EnumMember Attribute
/// </summary>
/// <param name="enumVal"></param>
/// <returns>true if found</returns>
private static bool HasEnumMemberAttrValue(object enumVal)
{
if (enumVal == null)
throw new ArgumentNullException(nameof(enumVal));
var enumType = enumVal.GetType();
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType<EnumMemberAttribute>().FirstOrDefault();
if (attr != null) return true;
return false;
}
/// <summary>
/// Get the EnumMember value
/// </summary>
/// <param name="enumVal"></param>
/// <returns>EnumMember value as string otherwise null</returns>
private static string GetEnumMemberAttrValue(object enumVal)
{
if (enumVal == null)
throw new ArgumentNullException(nameof(enumVal));
var enumType = enumVal.GetType();
var memInfo = enumType.GetMember(enumVal.ToString() ?? throw new InvalidOperationException());
var attr = memInfo.FirstOrDefault()?.GetCustomAttributes(false).OfType<EnumMemberAttribute>().FirstOrDefault();
if (attr != null)
{
return attr.Value;
}
return null;
}
}
}

View File

@@ -0,0 +1,613 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net.Http;
using System.Net.Security;
namespace Tribufu.Client
{
/// <summary>
/// Represents a set of configuration settings
/// </summary>
public class Configuration : IReadableConfiguration
{
#region Constants
/// <summary>
/// Version of the package.
/// </summary>
/// <value>Version of the package.</value>
public const string Version = "1.0.0";
/// <summary>
/// Identifier for ISO 8601 DateTime Format
/// </summary>
/// <remarks>See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information.</remarks>
// ReSharper disable once InconsistentNaming
public const string ISO8601_DATETIME_FORMAT = "o";
#endregion Constants
#region Static Members
/// <summary>
/// Default creation of exceptions for a given method name and response object
/// </summary>
public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) =>
{
var status = (int)response.StatusCode;
if (status >= 400)
{
return new ApiException(status,
string.Format("Error calling {0}: {1}", methodName, response.RawContent),
response.RawContent, response.Headers);
}
if (status == 0)
{
return new ApiException(status,
string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText);
}
return null;
};
#endregion Static Members
#region Private Members
/// <summary>
/// Defines the base path of the target API server.
/// Example: http://localhost:3000/v1/
/// </summary>
private string _basePath;
private bool _useDefaultCredentials = false;
/// <summary>
/// Gets or sets the API key based on the authentication name.
/// This is the key and value comprising the "secret" for accessing an API.
/// </summary>
/// <value>The API key.</value>
private IDictionary<string, string> _apiKey;
/// <summary>
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
/// </summary>
/// <value>The prefix of the API key.</value>
private IDictionary<string, string> _apiKeyPrefix;
private string _dateTimeFormat = ISO8601_DATETIME_FORMAT;
private string _tempFolderPath = Path.GetTempPath();
/// <summary>
/// Gets or sets the servers defined in the OpenAPI spec.
/// </summary>
/// <value>The servers</value>
private IList<IReadOnlyDictionary<string, object>> _servers;
/// <summary>
/// Gets or sets the operation servers defined in the OpenAPI spec.
/// </summary>
/// <value>The operation servers</value>
private IReadOnlyDictionary<string, List<IReadOnlyDictionary<string, object>>> _operationServers;
#endregion Private Members
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="Configuration" /> class
/// </summary>
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
public Configuration()
{
Proxy = null;
UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp");
BasePath = "http://localhost";
DefaultHeaders = new ConcurrentDictionary<string, string>();
ApiKey = new ConcurrentDictionary<string, string>();
ApiKeyPrefix = new ConcurrentDictionary<string, string>();
Servers = new List<IReadOnlyDictionary<string, object>>()
{
{
new Dictionary<string, object> {
{"url", ""},
{"description", "No description provided"},
}
}
};
OperationServers = new Dictionary<string, List<IReadOnlyDictionary<string, object>>>()
{
};
// Setting Timeout has side effects (forces ApiClient creation).
Timeout = TimeSpan.FromSeconds(100);
}
/// <summary>
/// Initializes a new instance of the <see cref="Configuration" /> class
/// </summary>
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")]
public Configuration(
IDictionary<string, string> defaultHeaders,
IDictionary<string, string> apiKey,
IDictionary<string, string> apiKeyPrefix,
string basePath = "http://localhost") : this()
{
if (string.IsNullOrWhiteSpace(basePath))
throw new ArgumentException("The provided basePath is invalid.", "basePath");
if (defaultHeaders == null)
throw new ArgumentNullException("defaultHeaders");
if (apiKey == null)
throw new ArgumentNullException("apiKey");
if (apiKeyPrefix == null)
throw new ArgumentNullException("apiKeyPrefix");
BasePath = basePath;
foreach (var keyValuePair in defaultHeaders)
{
DefaultHeaders.Add(keyValuePair);
}
foreach (var keyValuePair in apiKey)
{
ApiKey.Add(keyValuePair);
}
foreach (var keyValuePair in apiKeyPrefix)
{
ApiKeyPrefix.Add(keyValuePair);
}
}
#endregion Constructors
#region Properties
/// <summary>
/// Gets or sets the base path for API access.
/// </summary>
public virtual string BasePath
{
get { return _basePath; }
set { _basePath = value; }
}
/// <summary>
/// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
/// </summary>
public virtual bool UseDefaultCredentials
{
get { return _useDefaultCredentials; }
set { _useDefaultCredentials = value; }
}
/// <summary>
/// Gets or sets the default header.
/// </summary>
[Obsolete("Use DefaultHeaders instead.")]
public virtual IDictionary<string, string> DefaultHeader
{
get
{
return DefaultHeaders;
}
set
{
DefaultHeaders = value;
}
}
/// <summary>
/// Gets or sets the default headers.
/// </summary>
public virtual IDictionary<string, string> DefaultHeaders { get; set; }
/// <summary>
/// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds.
/// </summary>
public virtual TimeSpan Timeout { get; set; }
/// <summary>
/// Gets or sets the proxy
/// </summary>
/// <value>Proxy.</value>
public virtual WebProxy Proxy { get; set; }
/// <summary>
/// Gets or sets the HTTP user agent.
/// </summary>
/// <value>Http user agent.</value>
public virtual string UserAgent { get; set; }
/// <summary>
/// Gets or sets the username (HTTP basic authentication).
/// </summary>
/// <value>The username.</value>
public virtual string Username { get; set; }
/// <summary>
/// Gets or sets the password (HTTP basic authentication).
/// </summary>
/// <value>The password.</value>
public virtual string Password { get; set; }
/// <summary>
/// Gets the API key with prefix.
/// </summary>
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
/// <returns>API key with prefix.</returns>
public string GetApiKeyWithPrefix(string apiKeyIdentifier)
{
string apiKeyValue;
ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue);
string apiKeyPrefix;
if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix))
{
return apiKeyPrefix + " " + apiKeyValue;
}
return apiKeyValue;
}
/// <summary>
/// Gets or sets certificate collection to be sent with requests.
/// </summary>
/// <value>X509 Certificate collection.</value>
public X509CertificateCollection ClientCertificates { get; set; }
/// <summary>
/// Gets or sets the access token for OAuth2 authentication.
///
/// This helper property simplifies code generation.
/// </summary>
/// <value>The access token.</value>
public virtual string AccessToken { get; set; }
/// <summary>
/// Gets or sets the temporary folder path to store the files downloaded from the server.
/// </summary>
/// <value>Folder path.</value>
public virtual string TempFolderPath
{
get { return _tempFolderPath; }
set
{
if (string.IsNullOrEmpty(value))
{
_tempFolderPath = Path.GetTempPath();
return;
}
// create the directory if it does not exist
if (!Directory.Exists(value))
{
Directory.CreateDirectory(value);
}
// check if the path contains directory separator at the end
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
{
_tempFolderPath = value;
}
else
{
_tempFolderPath = value + Path.DirectorySeparatorChar;
}
}
}
/// <summary>
/// Gets or sets the date time format used when serializing in the ApiClient
/// By default, it's set to ISO 8601 - "o", for others see:
/// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx
/// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
/// No validation is done to ensure that the string you're providing is valid
/// </summary>
/// <value>The DateTimeFormat string</value>
public virtual string DateTimeFormat
{
get { return _dateTimeFormat; }
set
{
if (string.IsNullOrEmpty(value))
{
// Never allow a blank or null string, go back to the default
_dateTimeFormat = ISO8601_DATETIME_FORMAT;
return;
}
// Caution, no validation when you choose date time format other than ISO 8601
// Take a look at the above links
_dateTimeFormat = value;
}
}
/// <summary>
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
///
/// Whatever you set here will be prepended to the value defined in AddApiKey.
///
/// An example invocation here might be:
/// <example>
/// ApiKeyPrefix["Authorization"] = "Bearer";
/// </example>
/// … where ApiKey["Authorization"] would then be used to set the value of your bearer token.
///
/// <remarks>
/// OAuth2 workflows should set tokens via AccessToken.
/// </remarks>
/// </summary>
/// <value>The prefix of the API key.</value>
public virtual IDictionary<string, string> ApiKeyPrefix
{
get { return _apiKeyPrefix; }
set
{
if (value == null)
{
throw new InvalidOperationException("ApiKeyPrefix collection may not be null.");
}
_apiKeyPrefix = value;
}
}
/// <summary>
/// Gets or sets the API key based on the authentication name.
/// </summary>
/// <value>The API key.</value>
public virtual IDictionary<string, string> ApiKey
{
get { return _apiKey; }
set
{
if (value == null)
{
throw new InvalidOperationException("ApiKey collection may not be null.");
}
_apiKey = value;
}
}
/// <summary>
/// Gets or sets the servers.
/// </summary>
/// <value>The servers.</value>
public virtual IList<IReadOnlyDictionary<string, object>> Servers
{
get { return _servers; }
set
{
if (value == null)
{
throw new InvalidOperationException("Servers may not be null.");
}
_servers = value;
}
}
/// <summary>
/// Gets or sets the operation servers.
/// </summary>
/// <value>The operation servers.</value>
public virtual IReadOnlyDictionary<string, List<IReadOnlyDictionary<string, object>>> OperationServers
{
get { return _operationServers; }
set
{
if (value == null)
{
throw new InvalidOperationException("Operation servers may not be null.");
}
_operationServers = value;
}
}
/// <summary>
/// Returns URL based on server settings without providing values
/// for the variables
/// </summary>
/// <param name="index">Array index of the server settings.</param>
/// <return>The server URL.</return>
public string GetServerUrl(int index)
{
return GetServerUrl(Servers, index, null);
}
/// <summary>
/// Returns URL based on server settings.
/// </summary>
/// <param name="index">Array index of the server settings.</param>
/// <param name="inputVariables">Dictionary of the variables and the corresponding values.</param>
/// <return>The server URL.</return>
public string GetServerUrl(int index, Dictionary<string, string> inputVariables)
{
return GetServerUrl(Servers, index, inputVariables);
}
/// <summary>
/// Returns URL based on operation server settings.
/// </summary>
/// <param name="operation">Operation associated with the request path.</param>
/// <param name="index">Array index of the server settings.</param>
/// <return>The operation server URL.</return>
public string GetOperationServerUrl(string operation, int index)
{
return GetOperationServerUrl(operation, index, null);
}
/// <summary>
/// Returns URL based on operation server settings.
/// </summary>
/// <param name="operation">Operation associated with the request path.</param>
/// <param name="index">Array index of the server settings.</param>
/// <param name="inputVariables">Dictionary of the variables and the corresponding values.</param>
/// <return>The operation server URL.</return>
public string GetOperationServerUrl(string operation, int index, Dictionary<string, string> inputVariables)
{
if (operation != null && OperationServers.TryGetValue(operation, out var operationServer))
{
return GetServerUrl(operationServer, index, inputVariables);
}
return null;
}
/// <summary>
/// Returns URL based on server settings.
/// </summary>
/// <param name="servers">Dictionary of server settings.</param>
/// <param name="index">Array index of the server settings.</param>
/// <param name="inputVariables">Dictionary of the variables and the corresponding values.</param>
/// <return>The server URL.</return>
private string GetServerUrl(IList<IReadOnlyDictionary<string, object>> servers, int index, Dictionary<string, string> inputVariables)
{
if (index < 0 || index >= servers.Count)
{
throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}.");
}
if (inputVariables == null)
{
inputVariables = new Dictionary<string, string>();
}
IReadOnlyDictionary<string, object> server = servers[index];
string url = (string)server["url"];
if (server.ContainsKey("variables"))
{
// go through each variable and assign a value
foreach (KeyValuePair<string, object> variable in (IReadOnlyDictionary<string, object>)server["variables"])
{
IReadOnlyDictionary<string, object> serverVariables = (IReadOnlyDictionary<string, object>)(variable.Value);
if (inputVariables.ContainsKey(variable.Key))
{
if (((List<string>)serverVariables["enum_values"]).Contains(inputVariables[variable.Key]))
{
url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]);
}
else
{
throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List<string>)serverVariables["enum_values"]}");
}
}
else
{
// use default value
url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]);
}
}
}
return url;
}
/// <summary>
/// Gets and Sets the RemoteCertificateValidationCallback
/// </summary>
public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
#endregion Properties
#region Methods
/// <summary>
/// Returns a string with essential information for debugging.
/// </summary>
public static string ToDebugReport()
{
string report = "C# SDK (Tribufu) Debug Report:\n";
report += " OS: " + System.Environment.OSVersion + "\n";
report += " .NET Framework Version: " + System.Environment.Version + "\n";
report += " Version of the API: 1.2.6\n";
report += " SDK Package Version: 1.0.0\n";
return report;
}
/// <summary>
/// Add Api Key Header.
/// </summary>
/// <param name="key">Api Key name.</param>
/// <param name="value">Api Key value.</param>
/// <returns></returns>
public void AddApiKey(string key, string value)
{
ApiKey[key] = value;
}
/// <summary>
/// Sets the API key prefix.
/// </summary>
/// <param name="key">Api Key name.</param>
/// <param name="value">Api Key value.</param>
public void AddApiKeyPrefix(string key, string value)
{
ApiKeyPrefix[key] = value;
}
#endregion Methods
#region Static Members
/// <summary>
/// Merge configurations.
/// </summary>
/// <param name="first">First configuration.</param>
/// <param name="second">Second configuration.</param>
/// <return>Merged configuration.</return>
public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second)
{
if (second == null) return first ?? GlobalConfiguration.Instance;
Dictionary<string, string> apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary<string, string> apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
Dictionary<string, string> defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);
foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value;
foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value;
foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value;
var config = new Configuration
{
ApiKey = apiKey,
ApiKeyPrefix = apiKeyPrefix,
DefaultHeaders = defaultHeaders,
BasePath = second.BasePath ?? first.BasePath,
Timeout = second.Timeout,
Proxy = second.Proxy ?? first.Proxy,
UserAgent = second.UserAgent ?? first.UserAgent,
Username = second.Username ?? first.Username,
Password = second.Password ?? first.Password,
AccessToken = second.AccessToken ?? first.AccessToken,
TempFolderPath = second.TempFolderPath ?? first.TempFolderPath,
DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat,
ClientCertificates = second.ClientCertificates ?? first.ClientCertificates,
UseDefaultCredentials = second.UseDefaultCredentials,
RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback,
};
return config;
}
#endregion Static Members
}
}

View File

@@ -0,0 +1,23 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
namespace Tribufu.Client
{
/// <summary>
/// A delegate to ExceptionFactory method
/// </summary>
/// <param name="methodName">Method name</param>
/// <param name="response">Response</param>
/// <returns>Exceptions</returns>
public delegate Exception ExceptionFactory(string methodName, IApiResponse response);
}

View File

@@ -0,0 +1,68 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System.Collections.Generic;
namespace Tribufu.Client
{
/// <summary>
/// <see cref="GlobalConfiguration"/> provides a compile-time extension point for globally configuring
/// API Clients.
/// </summary>
/// <remarks>
/// A customized implementation via partial class may reside in another file and may
/// be excluded from automatic generation via a .openapi-generator-ignore file.
/// </remarks>
public partial class GlobalConfiguration : Configuration
{
#region Private Members
private static readonly object GlobalConfigSync = new { };
private static IReadableConfiguration _globalConfiguration;
#endregion Private Members
#region Constructors
/// <inheritdoc />
private GlobalConfiguration()
{
}
/// <inheritdoc />
public GlobalConfiguration(IDictionary<string, string> defaultHeader, IDictionary<string, string> apiKey, IDictionary<string, string> apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath)
{
}
static GlobalConfiguration()
{
Instance = new GlobalConfiguration();
}
#endregion Constructors
/// <summary>
/// Gets or sets the default Configuration.
/// </summary>
/// <value>Configuration.</value>
public static IReadableConfiguration Instance
{
get { return _globalConfiguration; }
set
{
lock (GlobalConfigSync)
{
_globalConfiguration = value;
}
}
}
}
}

View File

@@ -0,0 +1,34 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
namespace Tribufu.Client
{
/// <summary>
/// Http methods supported by swagger
/// </summary>
public enum HttpMethod
{
/// <summary>HTTP GET request.</summary>
Get,
/// <summary>HTTP POST request.</summary>
Post,
/// <summary>HTTP PUT request.</summary>
Put,
/// <summary>HTTP DELETE request.</summary>
Delete,
/// <summary>HTTP HEAD request.</summary>
Head,
/// <summary>HTTP OPTIONS request.</summary>
Options,
/// <summary>HTTP PATCH request.</summary>
Patch
}
}

View File

@@ -0,0 +1,38 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
namespace Tribufu.Client
{
/// <summary>
/// Represents configuration aspects required to interact with the API endpoints.
/// </summary>
public interface IApiAccessor
{
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
IReadableConfiguration Configuration { get; set; }
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
string GetBasePath();
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
ExceptionFactory ExceptionFactory { get; set; }
}
}

View File

@@ -0,0 +1,101 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Threading.Tasks;
namespace Tribufu.Client
{
/// <summary>
/// Contract for Asynchronous RESTful API interactions.
///
/// This interface allows consumers to provide a custom API accessor client.
/// </summary>
public interface IAsynchronousClient
{
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the GET http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> GetAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the POST http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PostAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PUT http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PutAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the DELETE http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> DeleteAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the HEAD http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> HeadAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the OPTIONS http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> OptionsAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Executes a non-blocking call to some <paramref name="path"/> using the PATCH http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>A task eventually representing the response data, decorated with <see cref="ApiResponse{T}"/></returns>
Task<ApiResponse<T>> PatchAsync<T>(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
}
}

View File

@@ -0,0 +1,142 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Tribufu.Client
{
/// <summary>
/// Represents a readable-only configuration contract.
/// </summary>
public interface IReadableConfiguration
{
/// <summary>
/// Gets the access token.
/// </summary>
/// <value>Access token.</value>
string AccessToken { get; }
/// <summary>
/// Gets the API key.
/// </summary>
/// <value>API key.</value>
IDictionary<string, string> ApiKey { get; }
/// <summary>
/// Gets the API key prefix.
/// </summary>
/// <value>API key prefix.</value>
IDictionary<string, string> ApiKeyPrefix { get; }
/// <summary>
/// Gets the base path.
/// </summary>
/// <value>Base path.</value>
string BasePath { get; }
/// <summary>
/// Gets the date time format.
/// </summary>
/// <value>Date time format.</value>
string DateTimeFormat { get; }
/// <summary>
/// Gets the default header.
/// </summary>
/// <value>Default header.</value>
[Obsolete("Use DefaultHeaders instead.")]
IDictionary<string, string> DefaultHeader { get; }
/// <summary>
/// Gets the default headers.
/// </summary>
/// <value>Default headers.</value>
IDictionary<string, string> DefaultHeaders { get; }
/// <summary>
/// Gets the temp folder path.
/// </summary>
/// <value>Temp folder path.</value>
string TempFolderPath { get; }
/// <summary>
/// Gets the HTTP connection timeout.
/// </summary>
/// <value>HTTP connection timeout.</value>
TimeSpan Timeout { get; }
/// <summary>
/// Gets the proxy.
/// </summary>
/// <value>Proxy.</value>
WebProxy Proxy { get; }
/// <summary>
/// Gets the user agent.
/// </summary>
/// <value>User agent.</value>
string UserAgent { get; }
/// <summary>
/// Gets the username.
/// </summary>
/// <value>Username.</value>
string Username { get; }
/// <summary>
/// Gets the password.
/// </summary>
/// <value>Password.</value>
string Password { get; }
/// <summary>
/// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false.
/// </summary>
bool UseDefaultCredentials { get; }
/// <summary>
/// Get the servers associated with the operation.
/// </summary>
/// <value>Operation servers.</value>
IReadOnlyDictionary<string, List<IReadOnlyDictionary<string, object>>> OperationServers { get; }
/// <summary>
/// Gets the API key with prefix.
/// </summary>
/// <param name="apiKeyIdentifier">API key identifier (authentication scheme).</param>
/// <returns>API key with prefix.</returns>
string GetApiKeyWithPrefix(string apiKeyIdentifier);
/// <summary>
/// Gets the Operation server url at the provided index.
/// </summary>
/// <param name="operation">Operation server name.</param>
/// <param name="index">Index of the operation server settings.</param>
/// <returns></returns>
string GetOperationServerUrl(string operation, int index);
/// <summary>
/// Gets certificate collection to be sent with requests.
/// </summary>
/// <value>X509 Certificate collection.</value>
X509CertificateCollection ClientCertificates { get; }
/// <summary>
/// Callback function for handling the validation of remote certificates. Useful for certificate pinning and
/// overriding certificate errors in the scope of a request.
/// </summary>
RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; }
}
}

View File

@@ -0,0 +1,94 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.IO;
namespace Tribufu.Client
{
/// <summary>
/// Contract for Synchronous RESTful API interactions.
///
/// This interface allows consumers to provide a custom API accessor client.
/// </summary>
public interface ISynchronousClient
{
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the GET http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Get<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the POST http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Post<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the PUT http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Put<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the DELETE http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Delete<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the HEAD http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Head<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the OPTIONS http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Options<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
/// <summary>
/// Executes a blocking call to some <paramref name="path"/> using the PATCH http verb.
/// </summary>
/// <param name="path">The relative path to invoke.</param>
/// <param name="options">The request parameters to pass along to the client.</param>
/// <param name="configuration">Per-request configurable settings.</param>
/// <typeparam name="T">The return type.</typeparam>
/// <returns>The response data, decorated with <see cref="ApiResponse{T}"/></returns>
ApiResponse<T> Patch<T>(string path, RequestOptions options, IReadableConfiguration configuration = null);
}
}

View File

@@ -0,0 +1,296 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
namespace Tribufu.Client
{
/// <summary>
/// A dictionary in which one key has many associated values.
/// </summary>
/// <typeparam name="TKey">The type of the key</typeparam>
/// <typeparam name="TValue">The type of the value associated with the key.</typeparam>
public class Multimap<TKey, TValue> : IDictionary<TKey, IList<TValue>>
{
#region Private Fields
private readonly Dictionary<TKey, IList<TValue>> _dictionary;
#endregion Private Fields
#region Constructors
/// <summary>
/// Empty Constructor.
/// </summary>
public Multimap()
{
_dictionary = new Dictionary<TKey, IList<TValue>>();
}
/// <summary>
/// Constructor with comparer.
/// </summary>
/// <param name="comparer"></param>
public Multimap(IEqualityComparer<TKey> comparer)
{
_dictionary = new Dictionary<TKey, IList<TValue>>(comparer);
}
#endregion Constructors
#region Enumerators
/// <summary>
/// To get the enumerator.
/// </summary>
/// <returns>Enumerator</returns>
public IEnumerator<KeyValuePair<TKey, IList<TValue>>> GetEnumerator()
{
return _dictionary.GetEnumerator();
}
/// <summary>
/// To get the enumerator.
/// </summary>
/// <returns>Enumerator</returns>
IEnumerator IEnumerable.GetEnumerator()
{
return _dictionary.GetEnumerator();
}
#endregion Enumerators
#region Public Members
/// <summary>
/// Add values to Multimap
/// </summary>
/// <param name="item">Key value pair</param>
public void Add(KeyValuePair<TKey, IList<TValue>> item)
{
if (!TryAdd(item.Key, item.Value))
throw new InvalidOperationException("Could not add values to Multimap.");
}
/// <summary>
/// Add Multimap to Multimap
/// </summary>
/// <param name="multimap">Multimap</param>
public void Add(Multimap<TKey, TValue> multimap)
{
foreach (var item in multimap)
{
if (!TryAdd(item.Key, item.Value))
throw new InvalidOperationException("Could not add values to Multimap.");
}
}
/// <summary>
/// Clear Multimap
/// </summary>
public void Clear()
{
_dictionary.Clear();
}
/// <summary>
/// Determines whether Multimap contains the specified item.
/// </summary>
/// <param name="item">Key value pair</param>
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
/// <returns>true if the Multimap contains the item; otherwise, false.</returns>
public bool Contains(KeyValuePair<TKey, IList<TValue>> item)
{
throw new NotImplementedException();
}
/// <summary>
/// Copy items of the Multimap to an array,
/// starting at a particular array index.
/// </summary>
/// <param name="array">The array that is the destination of the items copied
/// from Multimap. The array must have zero-based indexing.</param>
/// <param name="arrayIndex">The zero-based index in array at which copying begins.</param>
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
public void CopyTo(KeyValuePair<TKey, IList<TValue>>[] array, int arrayIndex)
{
throw new NotImplementedException();
}
/// <summary>
/// Removes the specified item from the Multimap.
/// </summary>
/// <param name="item">Key value pair</param>
/// <returns>true if the item is successfully removed; otherwise, false.</returns>
/// <exception cref="NotImplementedException">Method needs to be implemented</exception>
public bool Remove(KeyValuePair<TKey, IList<TValue>> item)
{
throw new NotImplementedException();
}
/// <summary>
/// Gets the number of items contained in the Multimap.
/// </summary>
public int Count => _dictionary.Count;
/// <summary>
/// Gets a value indicating whether the Multimap is read-only.
/// </summary>
public bool IsReadOnly => false;
/// <summary>
/// Adds an item with the provided key and value to the Multimap.
/// </summary>
/// <param name="key">The object to use as the key of the item to add.</param>
/// <param name="value">The object to use as the value of the item to add.</param>
/// <exception cref="InvalidOperationException">Thrown when couldn't add the value to Multimap.</exception>
public void Add(TKey key, IList<TValue> value)
{
if (value != null && value.Count > 0)
{
if (_dictionary.TryGetValue(key, out var list))
{
foreach (var k in value) list.Add(k);
}
else
{
list = new List<TValue>(value);
if (!TryAdd(key, list))
throw new InvalidOperationException("Could not add values to Multimap.");
}
}
}
/// <summary>
/// Determines whether the Multimap contains an item with the specified key.
/// </summary>
/// <param name="key">The key to locate in the Multimap.</param>
/// <returns>true if the Multimap contains an item with
/// the key; otherwise, false.</returns>
public bool ContainsKey(TKey key)
{
return _dictionary.ContainsKey(key);
}
/// <summary>
/// Removes item with the specified key from the Multimap.
/// </summary>
/// <param name="key">The key to locate in the Multimap.</param>
/// <returns>true if the item is successfully removed; otherwise, false.</returns>
public bool Remove(TKey key)
{
return TryRemove(key, out var _);
}
/// <summary>
/// Gets the value associated with the specified key.
/// </summary>
/// <param name="key">The key whose value to get.</param>
/// <param name="value">When this method returns, the value associated with the specified key, if the
/// key is found; otherwise, the default value for the type of the value parameter.
/// This parameter is passed uninitialized.</param>
/// <returns> true if the object that implements Multimap contains
/// an item with the specified key; otherwise, false.</returns>
public bool TryGetValue(TKey key, out IList<TValue> value)
{
return _dictionary.TryGetValue(key, out value);
}
/// <summary>
/// Gets or sets the item with the specified key.
/// </summary>
/// <param name="key">The key of the item to get or set.</param>
/// <returns>The value of the specified key.</returns>
public IList<TValue> this[TKey key]
{
get => _dictionary[key];
set => _dictionary[key] = value;
}
/// <summary>
/// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap.
/// </summary>
public ICollection<TKey> Keys => _dictionary.Keys;
/// <summary>
/// Gets a System.Collections.Generic.ICollection containing the values of the Multimap.
/// </summary>
public ICollection<IList<TValue>> Values => _dictionary.Values;
/// <summary>
/// Copy the items of the Multimap to an System.Array,
/// starting at a particular System.Array index.
/// </summary>
/// <param name="array">The one-dimensional System.Array that is the destination of the items copied
/// from Multimap. The System.Array must have zero-based indexing.</param>
/// <param name="index">The zero-based index in array at which copying begins.</param>
public void CopyTo(Array array, int index)
{
((ICollection)_dictionary).CopyTo(array, index);
}
/// <summary>
/// Adds an item with the provided key and value to the Multimap.
/// </summary>
/// <param name="key">The object to use as the key of the item to add.</param>
/// <param name="value">The object to use as the value of the item to add.</param>
/// <exception cref="InvalidOperationException">Thrown when couldn't add value to Multimap.</exception>
public void Add(TKey key, TValue value)
{
if (value != null)
{
if (_dictionary.TryGetValue(key, out var list))
{
list.Add(value);
}
else
{
list = new List<TValue> { value };
if (!TryAdd(key, list))
throw new InvalidOperationException("Could not add value to Multimap.");
}
}
}
#endregion Public Members
#region Private Members
/**
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryRemove(TKey key, out IList<TValue> value)
{
_dictionary.TryGetValue(key, out value);
return _dictionary.Remove(key);
}
/**
* Helper method to encapsulate generator differences between dictionary types.
*/
private bool TryAdd(TKey key, IList<TValue> value)
{
try
{
_dictionary.Add(key, value);
}
catch (ArgumentException)
{
return false;
}
return true;
}
#endregion Private Members
}
}

View File

@@ -0,0 +1,30 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Newtonsoft.Json.Converters;
namespace Tribufu.Client
{
/// <summary>
/// Formatter for 'date' openapi formats ss defined by full-date - RFC3339
/// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
/// </summary>
public class OpenAPIDateConverter : IsoDateTimeConverter
{
/// <summary>
/// Initializes a new instance of the <see cref="OpenAPIDateConverter" /> class.
/// </summary>
public OpenAPIDateConverter()
{
// full-date = date-fullyear "-" date-month "-" date-mday
DateTimeFormat = "yyyy-MM-dd";
}
}
}

View File

@@ -0,0 +1,85 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
namespace Tribufu.Client
{
/// <summary>
/// A container for generalized request inputs. This type allows consumers to extend the request functionality
/// by abstracting away from the default (built-in) request framework (e.g. RestSharp).
/// </summary>
public class RequestOptions
{
/// <summary>
/// Parameters to be bound to path parts of the Request's URL
/// </summary>
public Dictionary<string, string> PathParameters { get; set; }
/// <summary>
/// Query parameters to be applied to the request.
/// Keys may have 1 or more values associated.
/// </summary>
public Multimap<string, string> QueryParameters { get; set; }
/// <summary>
/// Header parameters to be applied to the request.
/// Keys may have 1 or more values associated.
/// </summary>
public Multimap<string, string> HeaderParameters { get; set; }
/// <summary>
/// Form parameters to be sent along with the request.
/// </summary>
public Dictionary<string, string> FormParameters { get; set; }
/// <summary>
/// File parameters to be sent along with the request.
/// </summary>
public Multimap<string, Stream> FileParameters { get; set; }
/// <summary>
/// Cookies to be sent along with the request.
/// </summary>
public List<Cookie> Cookies { get; set; }
/// <summary>
/// Operation associated with the request path.
/// </summary>
public string Operation { get; set; }
/// <summary>
/// Index associated with the operation.
/// </summary>
public int OperationIndex { get; set; }
/// <summary>
/// Any data associated with a request body.
/// </summary>
public Object Data { get; set; }
/// <summary>
/// Constructs a new instance of <see cref="RequestOptions"/>
/// </summary>
public RequestOptions()
{
PathParameters = new Dictionary<string, string>();
QueryParameters = new Multimap<string, string>();
HeaderParameters = new Multimap<string, string>();
FormParameters = new Dictionary<string, string>();
FileParameters = new Multimap<string, Stream>();
Cookies = new List<Cookie>();
}
}
}

View File

@@ -0,0 +1,32 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using Polly;
using RestSharp;
namespace Tribufu.Client
{
/// <summary>
/// Configuration class to set the polly retry policies to be applied to the requests.
/// </summary>
public static class RetryConfiguration
{
/// <summary>
/// Retry policy
/// </summary>
public static Policy<RestResponse> RetryPolicy { get; set; }
/// <summary>
/// Async retry policy
/// </summary>
public static AsyncPolicy<RestResponse> AsyncRetryPolicy { get; set; }
}
}

View File

@@ -0,0 +1,77 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Tribufu.Model
{
/// <summary>
/// Abstract base class for oneOf, anyOf schemas in the OpenAPI specification
/// </summary>
public abstract partial class AbstractOpenAPISchema
{
/// <summary>
/// Custom JSON serializer
/// </summary>
static public readonly JsonSerializerSettings SerializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = MissingMemberHandling.Error,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Custom JSON serializer for objects with additional properties
/// </summary>
static public readonly JsonSerializerSettings AdditionalPropertiesSerializerSettings = new JsonSerializerSettings
{
// OpenAPI generated types generally hide default constructors.
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
MissingMemberHandling = MissingMemberHandling.Ignore,
ContractResolver = new DefaultContractResolver
{
NamingStrategy = new CamelCaseNamingStrategy
{
OverrideSpecifiedNames = false
}
}
};
/// <summary>
/// Gets or Sets the actual instance
/// </summary>
public abstract Object ActualInstance { get; set; }
/// <summary>
/// Gets or Sets IsNullable to indicate whether the instance is nullable
/// </summary>
public bool IsNullable { get; protected set; }
/// <summary>
/// Gets or Sets the schema type, which can be either `oneOf` or `anyOf`
/// </summary>
public string SchemaType { get; protected set; }
/// <summary>
/// Converts the instance into JSON string.
/// </summary>
public abstract string ToJson();
}
}

View File

@@ -0,0 +1,156 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Account
/// </summary>
[DataContract(Name = "Account")]
public partial class Account : IValidatableObject
{
/// <summary>
/// Gets or Sets Provider
/// </summary>
[DataMember(Name = "provider", IsRequired = true, EmitDefaultValue = true)]
public LoginProvider Provider { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Account" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Account() { }
/// <summary>
/// Initializes a new instance of the <see cref="Account" /> class.
/// </summary>
/// <param name="id">id (required).</param>
/// <param name="name">name.</param>
/// <param name="provider">provider (required).</param>
/// <param name="userId">userId.</param>
/// <param name="authorized">authorized.</param>
/// <param name="fields">fields.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public Account(string id = default(string), string name = default(string), LoginProvider provider = default(LoginProvider), string userId = default(string), bool authorized = default(bool), Object fields = default(Object), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "id" is required (not null)
if (id == null)
{
throw new ArgumentNullException("id is a required property for Account and cannot be null");
}
this.Id = id;
this.Provider = provider;
this.Name = name;
this.UserId = userId;
this.Authorized = authorized;
this.Fields = fields;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", IsRequired = true, EmitDefaultValue = true)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets UserId
/// </summary>
[DataMember(Name = "user_id", EmitDefaultValue = false)]
public string UserId { get; set; }
/// <summary>
/// Gets or Sets Authorized
/// </summary>
[DataMember(Name = "authorized", EmitDefaultValue = true)]
public bool Authorized { get; set; }
/// <summary>
/// Gets or Sets Fields
/// </summary>
[DataMember(Name = "fields", EmitDefaultValue = true)]
public Object Fields { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class Account {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Provider: ").Append(Provider).Append("\n");
sb.Append(" UserId: ").Append(UserId).Append("\n");
sb.Append(" Authorized: ").Append(Authorized).Append("\n");
sb.Append(" Fields: ").Append(Fields).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,228 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Application
/// </summary>
[DataContract(Name = "Application")]
public partial class Application : IValidatableObject
{
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
public ApplicationType? Type { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Application" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Application() { }
/// <summary>
/// Initializes a new instance of the <see cref="Application" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="description">description.</param>
/// <param name="type">type.</param>
/// <param name="organizationId">organizationId.</param>
/// <param name="iconUrl">iconUrl.</param>
/// <param name="bannerUrl">bannerUrl.</param>
/// <param name="capsuleImageUrl">capsuleImageUrl.</param>
/// <param name="libraryImageUrl">libraryImageUrl.</param>
/// <param name="slug">slug.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public Application(string id = default(string), string name = default(string), string description = default(string), ApplicationType? type = default(ApplicationType?), string organizationId = default(string), string iconUrl = default(string), string bannerUrl = default(string), string capsuleImageUrl = default(string), string libraryImageUrl = default(string), string slug = default(string), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for Application and cannot be null");
}
this.Name = name;
this.Id = id;
this.Description = description;
this.Type = type;
this.OrganizationId = organizationId;
this.IconUrl = iconUrl;
this.BannerUrl = bannerUrl;
this.CapsuleImageUrl = capsuleImageUrl;
this.LibraryImageUrl = libraryImageUrl;
this.Slug = slug;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name = "description", EmitDefaultValue = true)]
public string Description { get; set; }
/// <summary>
/// Gets or Sets OrganizationId
/// </summary>
[DataMember(Name = "organization_id", EmitDefaultValue = true)]
public string OrganizationId { get; set; }
/// <summary>
/// Gets or Sets IconUrl
/// </summary>
[DataMember(Name = "icon_url", EmitDefaultValue = true)]
public string IconUrl { get; set; }
/// <summary>
/// Gets or Sets BannerUrl
/// </summary>
[DataMember(Name = "banner_url", EmitDefaultValue = true)]
public string BannerUrl { get; set; }
/// <summary>
/// Gets or Sets CapsuleImageUrl
/// </summary>
[DataMember(Name = "capsule_image_url", EmitDefaultValue = true)]
public string CapsuleImageUrl { get; set; }
/// <summary>
/// Gets or Sets LibraryImageUrl
/// </summary>
[DataMember(Name = "library_image_url", EmitDefaultValue = true)]
public string LibraryImageUrl { get; set; }
/// <summary>
/// Gets or Sets Slug
/// </summary>
[DataMember(Name = "slug", EmitDefaultValue = true)]
public string Slug { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class Application {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" OrganizationId: ").Append(OrganizationId).Append("\n");
sb.Append(" IconUrl: ").Append(IconUrl).Append("\n");
sb.Append(" BannerUrl: ").Append(BannerUrl).Append("\n");
sb.Append(" CapsuleImageUrl: ").Append(CapsuleImageUrl).Append("\n");
sb.Append(" LibraryImageUrl: ").Append(LibraryImageUrl).Append("\n");
sb.Append(" Slug: ").Append(Slug).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 75)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
}
// IconUrl (string) maxLength
if (this.IconUrl != null && this.IconUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for IconUrl, length must be less than 255.", new [] { "IconUrl" });
}
// BannerUrl (string) maxLength
if (this.BannerUrl != null && this.BannerUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for BannerUrl, length must be less than 255.", new [] { "BannerUrl" });
}
// CapsuleImageUrl (string) maxLength
if (this.CapsuleImageUrl != null && this.CapsuleImageUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for CapsuleImageUrl, length must be less than 255.", new [] { "CapsuleImageUrl" });
}
// LibraryImageUrl (string) maxLength
if (this.LibraryImageUrl != null && this.LibraryImageUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for LibraryImageUrl, length must be less than 255.", new [] { "LibraryImageUrl" });
}
// Slug (string) maxLength
if (this.Slug != null && this.Slug.Length > 75)
{
yield return new ValidationResult("Invalid value for Slug, length must be less than 75.", new [] { "Slug" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,48 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines ApplicationType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ApplicationType
{
/// <summary>
/// Enum Application for value: application
/// </summary>
[EnumMember(Value = "application")]
Application,
/// <summary>
/// Enum Game for value: game
/// </summary>
[EnumMember(Value = "game")]
Game
}
}

View File

@@ -0,0 +1,152 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// AuthorizeRequest
/// </summary>
[DataContract(Name = "AuthorizeRequest")]
public partial class AuthorizeRequest : IValidatableObject
{
/// <summary>
/// Gets or Sets ResponseType
/// </summary>
[DataMember(Name = "response_type", EmitDefaultValue = false)]
public ResponseType? ResponseType { get; set; }
/// <summary>
/// Gets or Sets CodeChallengeMethod
/// </summary>
[DataMember(Name = "code_challenge_method", EmitDefaultValue = false)]
public CodeChallengeMethod? CodeChallengeMethod { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="AuthorizeRequest" /> class.
/// </summary>
[JsonConstructorAttribute]
protected AuthorizeRequest() { }
/// <summary>
/// Initializes a new instance of the <see cref="AuthorizeRequest" /> class.
/// </summary>
/// <param name="responseType">responseType.</param>
/// <param name="clientId">clientId (required).</param>
/// <param name="codeChallenge">codeChallenge.</param>
/// <param name="codeChallengeMethod">codeChallengeMethod.</param>
/// <param name="redirectUri">redirectUri (required).</param>
/// <param name="scope">scope.</param>
/// <param name="state">state.</param>
public AuthorizeRequest(ResponseType? responseType = default(ResponseType?), string clientId = default(string), string codeChallenge = default(string), CodeChallengeMethod? codeChallengeMethod = default(CodeChallengeMethod?), string redirectUri = default(string), string scope = default(string), string state = default(string))
{
// to ensure "clientId" is required (not null)
if (clientId == null)
{
throw new ArgumentNullException("clientId is a required property for AuthorizeRequest and cannot be null");
}
this.ClientId = clientId;
// to ensure "redirectUri" is required (not null)
if (redirectUri == null)
{
throw new ArgumentNullException("redirectUri is a required property for AuthorizeRequest and cannot be null");
}
this.RedirectUri = redirectUri;
this.ResponseType = responseType;
this.CodeChallenge = codeChallenge;
this.CodeChallengeMethod = codeChallengeMethod;
this.Scope = scope;
this.State = state;
}
/// <summary>
/// Gets or Sets ClientId
/// </summary>
[DataMember(Name = "client_id", IsRequired = true, EmitDefaultValue = true)]
public string ClientId { get; set; }
/// <summary>
/// Gets or Sets CodeChallenge
/// </summary>
[DataMember(Name = "code_challenge", EmitDefaultValue = true)]
public string CodeChallenge { get; set; }
/// <summary>
/// Gets or Sets RedirectUri
/// </summary>
[DataMember(Name = "redirect_uri", IsRequired = true, EmitDefaultValue = true)]
public string RedirectUri { get; set; }
/// <summary>
/// Gets or Sets Scope
/// </summary>
[DataMember(Name = "scope", EmitDefaultValue = true)]
public string Scope { get; set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name = "state", EmitDefaultValue = true)]
public string State { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class AuthorizeRequest {\n");
sb.Append(" ResponseType: ").Append(ResponseType).Append("\n");
sb.Append(" ClientId: ").Append(ClientId).Append("\n");
sb.Append(" CodeChallenge: ").Append(CodeChallenge).Append("\n");
sb.Append(" CodeChallengeMethod: ").Append(CodeChallengeMethod).Append("\n");
sb.Append(" RedirectUri: ").Append(RedirectUri).Append("\n");
sb.Append(" Scope: ").Append(Scope).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,129 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// ClientInfo
/// </summary>
[DataContract(Name = "ClientInfo")]
public partial class ClientInfo : IValidatableObject
{
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
public ClientType? Type { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ClientInfo" /> class.
/// </summary>
[JsonConstructorAttribute]
protected ClientInfo() { }
/// <summary>
/// Initializes a new instance of the <see cref="ClientInfo" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="type">type.</param>
/// <param name="photoUrl">photoUrl.</param>
/// <param name="permissions">permissions.</param>
public ClientInfo(string id = default(string), string name = default(string), ClientType? type = default(ClientType?), string photoUrl = default(string), List<string> permissions = default(List<string>))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for ClientInfo and cannot be null");
}
this.Name = name;
this.Id = id;
this.Type = type;
this.PhotoUrl = photoUrl;
this.Permissions = permissions;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets PhotoUrl
/// </summary>
[DataMember(Name = "photo_url", EmitDefaultValue = true)]
public string PhotoUrl { get; set; }
/// <summary>
/// Gets or Sets Permissions
/// </summary>
[DataMember(Name = "permissions", EmitDefaultValue = true)]
public List<string> Permissions { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class ClientInfo {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" PhotoUrl: ").Append(PhotoUrl).Append("\n");
sb.Append(" Permissions: ").Append(Permissions).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,54 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines ClientType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum ClientType
{
/// <summary>
/// Enum Web for value: web
/// </summary>
[EnumMember(Value = "web")]
Web,
/// <summary>
/// Enum Desktop for value: desktop
/// </summary>
[EnumMember(Value = "desktop")]
Desktop,
/// <summary>
/// Enum Mobile for value: mobile
/// </summary>
[EnumMember(Value = "mobile")]
Mobile
}
}

View File

@@ -0,0 +1,48 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines CodeChallengeMethod
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum CodeChallengeMethod
{
/// <summary>
/// Enum Plain for value: plain
/// </summary>
[EnumMember(Value = "plain")]
Plain,
/// <summary>
/// Enum S256 for value: S256
/// </summary>
[EnumMember(Value = "S256")]
S256
}
}

View File

@@ -0,0 +1,102 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// CodeResponse
/// </summary>
[DataContract(Name = "CodeResponse")]
public partial class CodeResponse : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CodeResponse" /> class.
/// </summary>
[JsonConstructorAttribute]
protected CodeResponse() { }
/// <summary>
/// Initializes a new instance of the <see cref="CodeResponse" /> class.
/// </summary>
/// <param name="code">code (required).</param>
/// <param name="state">state.</param>
public CodeResponse(string code = default(string), string state = default(string))
{
// to ensure "code" is required (not null)
if (code == null)
{
throw new ArgumentNullException("code is a required property for CodeResponse and cannot be null");
}
this.Code = code;
this.State = state;
}
/// <summary>
/// Gets or Sets Code
/// </summary>
[DataMember(Name = "code", IsRequired = true, EmitDefaultValue = true)]
public string Code { get; set; }
/// <summary>
/// Gets or Sets State
/// </summary>
[DataMember(Name = "state", EmitDefaultValue = true)]
public string State { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class CodeResponse {\n");
sb.Append(" Code: ").Append(Code).Append("\n");
sb.Append(" State: ").Append(State).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,225 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// CreateUser
/// </summary>
[DataContract(Name = "CreateUser")]
public partial class CreateUser : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CreateUser" /> class.
/// </summary>
[JsonConstructorAttribute]
protected CreateUser() { }
/// <summary>
/// Initializes a new instance of the <see cref="CreateUser" /> class.
/// </summary>
/// <param name="uuid">uuid.</param>
/// <param name="name">name (required).</param>
/// <param name="displayName">displayName.</param>
/// <param name="email">email.</param>
/// <param name="password">password.</param>
/// <param name="language">language.</param>
/// <param name="timezone">timezone.</param>
/// <param name="currency">currency.</param>
/// <param name="ipAddress">ipAddress.</param>
public CreateUser(Guid? uuid = default(Guid?), string name = default(string), string displayName = default(string), string email = default(string), string password = default(string), string language = default(string), string timezone = default(string), string currency = default(string), string ipAddress = default(string))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for CreateUser and cannot be null");
}
this.Name = name;
this.Uuid = uuid;
this.DisplayName = displayName;
this.Email = email;
this.Password = password;
this.Language = language;
this.Timezone = timezone;
this.Currency = currency;
this.IpAddress = ipAddress;
}
/// <summary>
/// Gets or Sets Uuid
/// </summary>
[DataMember(Name = "uuid", EmitDefaultValue = true)]
public Guid? Uuid { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets DisplayName
/// </summary>
[DataMember(Name = "display_name", EmitDefaultValue = true)]
public string DisplayName { get; set; }
/// <summary>
/// Gets or Sets Email
/// </summary>
[DataMember(Name = "email", EmitDefaultValue = true)]
public string Email { get; set; }
/// <summary>
/// Gets or Sets Password
/// </summary>
[DataMember(Name = "password", EmitDefaultValue = true)]
public string Password { get; set; }
/// <summary>
/// Gets or Sets Language
/// </summary>
[DataMember(Name = "language", EmitDefaultValue = true)]
public string Language { get; set; }
/// <summary>
/// Gets or Sets Timezone
/// </summary>
[DataMember(Name = "timezone", EmitDefaultValue = true)]
public string Timezone { get; set; }
/// <summary>
/// Gets or Sets Currency
/// </summary>
[DataMember(Name = "currency", EmitDefaultValue = true)]
public string Currency { get; set; }
/// <summary>
/// Gets or Sets IpAddress
/// </summary>
[DataMember(Name = "ip_address", EmitDefaultValue = true)]
public string IpAddress { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class CreateUser {\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" DisplayName: ").Append(DisplayName).Append("\n");
sb.Append(" Email: ").Append(Email).Append("\n");
sb.Append(" Password: ").Append(Password).Append("\n");
sb.Append(" Language: ").Append(Language).Append("\n");
sb.Append(" Timezone: ").Append(Timezone).Append("\n");
sb.Append(" Currency: ").Append(Currency).Append("\n");
sb.Append(" IpAddress: ").Append(IpAddress).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 45)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 45.", new [] { "Name" });
}
// Name (string) minLength
if (this.Name != null && this.Name.Length < 1)
{
yield return new ValidationResult("Invalid value for Name, length must be greater than 1.", new [] { "Name" });
}
if (this.Name != null) {
// Name (string) pattern
Regex regexName = new Regex(@"^[a-zA-Z0-9-_]*$", RegexOptions.CultureInvariant);
if (!regexName.Match(this.Name).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" });
}
}
// DisplayName (string) maxLength
if (this.DisplayName != null && this.DisplayName.Length > 45)
{
yield return new ValidationResult("Invalid value for DisplayName, length must be less than 45.", new [] { "DisplayName" });
}
if (this.DisplayName != null) {
// DisplayName (string) pattern
Regex regexDisplayName = new Regex(@"^[a-zA-Z0-9-_ ]*$", RegexOptions.CultureInvariant);
if (!regexDisplayName.Match(this.DisplayName).Success)
{
yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for DisplayName, must match a pattern of " + regexDisplayName, new [] { "DisplayName" });
}
}
// Email (string) maxLength
if (this.Email != null && this.Email.Length > 255)
{
yield return new ValidationResult("Invalid value for Email, length must be less than 255.", new [] { "Email" });
}
// Language (string) maxLength
if (this.Language != null && this.Language.Length > 5)
{
yield return new ValidationResult("Invalid value for Language, length must be less than 5.", new [] { "Language" });
}
// Currency (string) maxLength
if (this.Currency != null && this.Currency.Length > 3)
{
yield return new ValidationResult("Invalid value for Currency, length must be less than 3.", new [] { "Currency" });
}
// IpAddress (string) maxLength
if (this.IpAddress != null && this.IpAddress.Length > 255)
{
yield return new ValidationResult("Invalid value for IpAddress, length must be less than 255.", new [] { "IpAddress" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,92 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// CryptoViewModel
/// </summary>
[DataContract(Name = "CryptoViewModel")]
public partial class CryptoViewModel : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="CryptoViewModel" /> class.
/// </summary>
/// <param name="encoded">encoded.</param>
/// <param name="decoded">decoded.</param>
public CryptoViewModel(string encoded = default(string), string decoded = default(string))
{
this.Encoded = encoded;
this.Decoded = decoded;
}
/// <summary>
/// Gets or Sets Encoded
/// </summary>
[DataMember(Name = "encoded", EmitDefaultValue = true)]
public string Encoded { get; set; }
/// <summary>
/// Gets or Sets Decoded
/// </summary>
[DataMember(Name = "decoded", EmitDefaultValue = true)]
public string Decoded { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class CryptoViewModel {\n");
sb.Append(" Encoded: ").Append(Encoded).Append("\n");
sb.Append(" Decoded: ").Append(Decoded).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

205
src/Tribufu/Model/File.cs Normal file
View File

@@ -0,0 +1,205 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// File
/// </summary>
[DataContract(Name = "File")]
public partial class File : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="File" /> class.
/// </summary>
[JsonConstructorAttribute]
protected File() { }
/// <summary>
/// Initializes a new instance of the <see cref="File" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="contentType">contentType (required).</param>
/// <param name="url">url (required).</param>
/// <param name="hash">hash.</param>
/// <param name="etag">etag.</param>
/// <param name="size">size.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public File(string id = default(string), string name = default(string), string contentType = default(string), string url = default(string), string hash = default(string), string etag = default(string), long size = default(long), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for File and cannot be null");
}
this.Name = name;
// to ensure "contentType" is required (not null)
if (contentType == null)
{
throw new ArgumentNullException("contentType is a required property for File and cannot be null");
}
this.ContentType = contentType;
// to ensure "url" is required (not null)
if (url == null)
{
throw new ArgumentNullException("url is a required property for File and cannot be null");
}
this.Url = url;
this.Id = id;
this.Hash = hash;
this.Etag = etag;
this.Size = size;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets ContentType
/// </summary>
[DataMember(Name = "content_type", IsRequired = true, EmitDefaultValue = true)]
public string ContentType { get; set; }
/// <summary>
/// Gets or Sets Url
/// </summary>
[DataMember(Name = "url", IsRequired = true, EmitDefaultValue = true)]
public string Url { get; set; }
/// <summary>
/// Gets or Sets Hash
/// </summary>
[DataMember(Name = "hash", EmitDefaultValue = true)]
public string Hash { get; set; }
/// <summary>
/// Gets or Sets Etag
/// </summary>
[DataMember(Name = "etag", EmitDefaultValue = true)]
public string Etag { get; set; }
/// <summary>
/// Gets or Sets Size
/// </summary>
[DataMember(Name = "size", EmitDefaultValue = false)]
public long Size { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class File {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" ContentType: ").Append(ContentType).Append("\n");
sb.Append(" Url: ").Append(Url).Append("\n");
sb.Append(" Hash: ").Append(Hash).Append("\n");
sb.Append(" Etag: ").Append(Etag).Append("\n");
sb.Append(" Size: ").Append(Size).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 45)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 45.", new [] { "Name" });
}
// ContentType (string) maxLength
if (this.ContentType != null && this.ContentType.Length > 45)
{
yield return new ValidationResult("Invalid value for ContentType, length must be less than 45.", new [] { "ContentType" });
}
// Url (string) maxLength
if (this.Url != null && this.Url.Length > 255)
{
yield return new ValidationResult("Invalid value for Url, length must be less than 255.", new [] { "Url" });
}
// Hash (string) maxLength
if (this.Hash != null && this.Hash.Length > 64)
{
yield return new ValidationResult("Invalid value for Hash, length must be less than 64.", new [] { "Hash" });
}
// Etag (string) maxLength
if (this.Etag != null && this.Etag.Length > 32)
{
yield return new ValidationResult("Invalid value for Etag, length must be less than 32.", new [] { "Etag" });
}
yield break;
}
}
}

297
src/Tribufu/Model/Game.cs Normal file
View File

@@ -0,0 +1,297 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Game
/// </summary>
[DataContract(Name = "Game")]
public partial class Game : IValidatableObject
{
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
public ApplicationType? Type { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="Game" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Game() { }
/// <summary>
/// Initializes a new instance of the <see cref="Game" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="description">description.</param>
/// <param name="type">type.</param>
/// <param name="organizationId">organizationId.</param>
/// <param name="iconUrl">iconUrl.</param>
/// <param name="bannerUrl">bannerUrl.</param>
/// <param name="capsuleImageUrl">capsuleImageUrl.</param>
/// <param name="libraryImageUrl">libraryImageUrl.</param>
/// <param name="slug">slug.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
/// <param name="enableServers">enableServers.</param>
/// <param name="gamePort">gamePort.</param>
/// <param name="queryPort">queryPort.</param>
/// <param name="rconPort">rconPort.</param>
/// <param name="gamedigId">gamedigId.</param>
/// <param name="steamAppId">steamAppId.</param>
/// <param name="steamServerAppId">steamServerAppId.</param>
public Game(string id = default(string), string name = default(string), string description = default(string), ApplicationType? type = default(ApplicationType?), string organizationId = default(string), string iconUrl = default(string), string bannerUrl = default(string), string capsuleImageUrl = default(string), string libraryImageUrl = default(string), string slug = default(string), DateTime created = default(DateTime), DateTime? updated = default(DateTime?), bool enableServers = default(bool), int? gamePort = default(int?), int? queryPort = default(int?), int? rconPort = default(int?), string gamedigId = default(string), int? steamAppId = default(int?), int? steamServerAppId = default(int?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for Game and cannot be null");
}
this.Name = name;
this.Id = id;
this.Description = description;
this.Type = type;
this.OrganizationId = organizationId;
this.IconUrl = iconUrl;
this.BannerUrl = bannerUrl;
this.CapsuleImageUrl = capsuleImageUrl;
this.LibraryImageUrl = libraryImageUrl;
this.Slug = slug;
this.Created = created;
this.Updated = updated;
this.EnableServers = enableServers;
this.GamePort = gamePort;
this.QueryPort = queryPort;
this.RconPort = rconPort;
this.GamedigId = gamedigId;
this.SteamAppId = steamAppId;
this.SteamServerAppId = steamServerAppId;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name = "description", EmitDefaultValue = true)]
public string Description { get; set; }
/// <summary>
/// Gets or Sets OrganizationId
/// </summary>
[DataMember(Name = "organization_id", EmitDefaultValue = true)]
public string OrganizationId { get; set; }
/// <summary>
/// Gets or Sets IconUrl
/// </summary>
[DataMember(Name = "icon_url", EmitDefaultValue = true)]
public string IconUrl { get; set; }
/// <summary>
/// Gets or Sets BannerUrl
/// </summary>
[DataMember(Name = "banner_url", EmitDefaultValue = true)]
public string BannerUrl { get; set; }
/// <summary>
/// Gets or Sets CapsuleImageUrl
/// </summary>
[DataMember(Name = "capsule_image_url", EmitDefaultValue = true)]
public string CapsuleImageUrl { get; set; }
/// <summary>
/// Gets or Sets LibraryImageUrl
/// </summary>
[DataMember(Name = "library_image_url", EmitDefaultValue = true)]
public string LibraryImageUrl { get; set; }
/// <summary>
/// Gets or Sets Slug
/// </summary>
[DataMember(Name = "slug", EmitDefaultValue = true)]
public string Slug { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Gets or Sets EnableServers
/// </summary>
[DataMember(Name = "enable_servers", EmitDefaultValue = true)]
public bool EnableServers { get; set; }
/// <summary>
/// Gets or Sets GamePort
/// </summary>
[DataMember(Name = "game_port", EmitDefaultValue = true)]
public int? GamePort { get; set; }
/// <summary>
/// Gets or Sets QueryPort
/// </summary>
[DataMember(Name = "query_port", EmitDefaultValue = true)]
public int? QueryPort { get; set; }
/// <summary>
/// Gets or Sets RconPort
/// </summary>
[DataMember(Name = "rcon_port", EmitDefaultValue = true)]
public int? RconPort { get; set; }
/// <summary>
/// Gets or Sets GamedigId
/// </summary>
[DataMember(Name = "gamedig_id", EmitDefaultValue = true)]
public string GamedigId { get; set; }
/// <summary>
/// Gets or Sets SteamAppId
/// </summary>
[DataMember(Name = "steam_app_id", EmitDefaultValue = true)]
public int? SteamAppId { get; set; }
/// <summary>
/// Gets or Sets SteamServerAppId
/// </summary>
[DataMember(Name = "steam_server_app_id", EmitDefaultValue = true)]
public int? SteamServerAppId { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class Game {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" OrganizationId: ").Append(OrganizationId).Append("\n");
sb.Append(" IconUrl: ").Append(IconUrl).Append("\n");
sb.Append(" BannerUrl: ").Append(BannerUrl).Append("\n");
sb.Append(" CapsuleImageUrl: ").Append(CapsuleImageUrl).Append("\n");
sb.Append(" LibraryImageUrl: ").Append(LibraryImageUrl).Append("\n");
sb.Append(" Slug: ").Append(Slug).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append(" EnableServers: ").Append(EnableServers).Append("\n");
sb.Append(" GamePort: ").Append(GamePort).Append("\n");
sb.Append(" QueryPort: ").Append(QueryPort).Append("\n");
sb.Append(" RconPort: ").Append(RconPort).Append("\n");
sb.Append(" GamedigId: ").Append(GamedigId).Append("\n");
sb.Append(" SteamAppId: ").Append(SteamAppId).Append("\n");
sb.Append(" SteamServerAppId: ").Append(SteamServerAppId).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 75)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
}
// IconUrl (string) maxLength
if (this.IconUrl != null && this.IconUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for IconUrl, length must be less than 255.", new [] { "IconUrl" });
}
// BannerUrl (string) maxLength
if (this.BannerUrl != null && this.BannerUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for BannerUrl, length must be less than 255.", new [] { "BannerUrl" });
}
// CapsuleImageUrl (string) maxLength
if (this.CapsuleImageUrl != null && this.CapsuleImageUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for CapsuleImageUrl, length must be less than 255.", new [] { "CapsuleImageUrl" });
}
// LibraryImageUrl (string) maxLength
if (this.LibraryImageUrl != null && this.LibraryImageUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for LibraryImageUrl, length must be less than 255.", new [] { "LibraryImageUrl" });
}
// Slug (string) maxLength
if (this.Slug != null && this.Slug.Length > 75)
{
yield return new ValidationResult("Invalid value for Slug, length must be less than 75.", new [] { "Slug" });
}
// GamedigId (string) maxLength
if (this.GamedigId != null && this.GamedigId.Length > 45)
{
yield return new ValidationResult("Invalid value for GamedigId, length must be less than 45.", new [] { "GamedigId" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,326 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// GameServer
/// </summary>
[DataContract(Name = "GameServer")]
public partial class GameServer : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="GameServer" /> class.
/// </summary>
[JsonConstructorAttribute]
protected GameServer() { }
/// <summary>
/// Initializes a new instance of the <see cref="GameServer" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="description">description.</param>
/// <param name="ownerId">ownerId.</param>
/// <param name="address">address (required).</param>
/// <param name="queryPort">queryPort (required).</param>
/// <param name="gamePort">gamePort.</param>
/// <param name="map">map.</param>
/// <param name="varVersion">varVersion.</param>
/// <param name="gameId">gameId.</param>
/// <param name="gameIconUrl">gameIconUrl.</param>
/// <param name="clusterId">clusterId.</param>
/// <param name="websiteUrl">websiteUrl.</param>
/// <param name="bannerUrl">bannerUrl.</param>
/// <param name="uptime">uptime.</param>
/// <param name="country">country.</param>
/// <param name="steam">steam.</param>
/// <param name="discordServerId">discordServerId.</param>
/// <param name="youtubeVideoUrl">youtubeVideoUrl.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public GameServer(string id = default(string), string name = default(string), string description = default(string), string ownerId = default(string), string address = default(string), int queryPort = default(int), int? gamePort = default(int?), string map = default(string), string varVersion = default(string), string gameId = default(string), string gameIconUrl = default(string), string clusterId = default(string), string websiteUrl = default(string), string bannerUrl = default(string), double uptime = default(double), string country = default(string), bool steam = default(bool), string discordServerId = default(string), string youtubeVideoUrl = default(string), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for GameServer and cannot be null");
}
this.Name = name;
// to ensure "address" is required (not null)
if (address == null)
{
throw new ArgumentNullException("address is a required property for GameServer and cannot be null");
}
this.Address = address;
this.QueryPort = queryPort;
this.Id = id;
this.Description = description;
this.OwnerId = ownerId;
this.GamePort = gamePort;
this.Map = map;
this.VarVersion = varVersion;
this.GameId = gameId;
this.GameIconUrl = gameIconUrl;
this.ClusterId = clusterId;
this.WebsiteUrl = websiteUrl;
this.BannerUrl = bannerUrl;
this.Uptime = uptime;
this.Country = country;
this.Steam = steam;
this.DiscordServerId = discordServerId;
this.YoutubeVideoUrl = youtubeVideoUrl;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name = "description", EmitDefaultValue = true)]
public string Description { get; set; }
/// <summary>
/// Gets or Sets OwnerId
/// </summary>
[DataMember(Name = "owner_id", EmitDefaultValue = true)]
public string OwnerId { get; set; }
/// <summary>
/// Gets or Sets Address
/// </summary>
[DataMember(Name = "address", IsRequired = true, EmitDefaultValue = true)]
public string Address { get; set; }
/// <summary>
/// Gets or Sets QueryPort
/// </summary>
[DataMember(Name = "query_port", IsRequired = true, EmitDefaultValue = true)]
public int QueryPort { get; set; }
/// <summary>
/// Gets or Sets GamePort
/// </summary>
[DataMember(Name = "game_port", EmitDefaultValue = true)]
public int? GamePort { get; set; }
/// <summary>
/// Gets or Sets Map
/// </summary>
[DataMember(Name = "map", EmitDefaultValue = true)]
public string Map { get; set; }
/// <summary>
/// Gets or Sets VarVersion
/// </summary>
[DataMember(Name = "version", EmitDefaultValue = true)]
public string VarVersion { get; set; }
/// <summary>
/// Gets or Sets GameId
/// </summary>
[DataMember(Name = "game_id", EmitDefaultValue = false)]
public string GameId { get; set; }
/// <summary>
/// Gets or Sets GameIconUrl
/// </summary>
[DataMember(Name = "game_icon_url", EmitDefaultValue = true)]
public string GameIconUrl { get; set; }
/// <summary>
/// Gets or Sets ClusterId
/// </summary>
[DataMember(Name = "cluster_id", EmitDefaultValue = true)]
public string ClusterId { get; set; }
/// <summary>
/// Gets or Sets WebsiteUrl
/// </summary>
[DataMember(Name = "website_url", EmitDefaultValue = true)]
public string WebsiteUrl { get; set; }
/// <summary>
/// Gets or Sets BannerUrl
/// </summary>
[DataMember(Name = "banner_url", EmitDefaultValue = true)]
public string BannerUrl { get; set; }
/// <summary>
/// Gets or Sets Uptime
/// </summary>
[DataMember(Name = "uptime", EmitDefaultValue = false)]
public double Uptime { get; set; }
/// <summary>
/// Gets or Sets Country
/// </summary>
[DataMember(Name = "country", EmitDefaultValue = true)]
public string Country { get; set; }
/// <summary>
/// Gets or Sets Steam
/// </summary>
[DataMember(Name = "steam", EmitDefaultValue = true)]
public bool Steam { get; set; }
/// <summary>
/// Gets or Sets DiscordServerId
/// </summary>
[DataMember(Name = "discord_server_id", EmitDefaultValue = true)]
public string DiscordServerId { get; set; }
/// <summary>
/// Gets or Sets YoutubeVideoUrl
/// </summary>
[DataMember(Name = "youtube_video_url", EmitDefaultValue = true)]
public string YoutubeVideoUrl { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class GameServer {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" OwnerId: ").Append(OwnerId).Append("\n");
sb.Append(" Address: ").Append(Address).Append("\n");
sb.Append(" QueryPort: ").Append(QueryPort).Append("\n");
sb.Append(" GamePort: ").Append(GamePort).Append("\n");
sb.Append(" Map: ").Append(Map).Append("\n");
sb.Append(" VarVersion: ").Append(VarVersion).Append("\n");
sb.Append(" GameId: ").Append(GameId).Append("\n");
sb.Append(" GameIconUrl: ").Append(GameIconUrl).Append("\n");
sb.Append(" ClusterId: ").Append(ClusterId).Append("\n");
sb.Append(" WebsiteUrl: ").Append(WebsiteUrl).Append("\n");
sb.Append(" BannerUrl: ").Append(BannerUrl).Append("\n");
sb.Append(" Uptime: ").Append(Uptime).Append("\n");
sb.Append(" Country: ").Append(Country).Append("\n");
sb.Append(" Steam: ").Append(Steam).Append("\n");
sb.Append(" DiscordServerId: ").Append(DiscordServerId).Append("\n");
sb.Append(" YoutubeVideoUrl: ").Append(YoutubeVideoUrl).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 75)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
}
// Address (string) maxLength
if (this.Address != null && this.Address.Length > 255)
{
yield return new ValidationResult("Invalid value for Address, length must be less than 255.", new [] { "Address" });
}
// Map (string) maxLength
if (this.Map != null && this.Map.Length > 255)
{
yield return new ValidationResult("Invalid value for Map, length must be less than 255.", new [] { "Map" });
}
// VarVersion (string) maxLength
if (this.VarVersion != null && this.VarVersion.Length > 45)
{
yield return new ValidationResult("Invalid value for VarVersion, length must be less than 45.", new [] { "VarVersion" });
}
// WebsiteUrl (string) maxLength
if (this.WebsiteUrl != null && this.WebsiteUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for WebsiteUrl, length must be less than 255.", new [] { "WebsiteUrl" });
}
// BannerUrl (string) maxLength
if (this.BannerUrl != null && this.BannerUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for BannerUrl, length must be less than 255.", new [] { "BannerUrl" });
}
// Country (string) maxLength
if (this.Country != null && this.Country.Length > 2)
{
yield return new ValidationResult("Invalid value for Country, length must be less than 2.", new [] { "Country" });
}
// YoutubeVideoUrl (string) maxLength
if (this.YoutubeVideoUrl != null && this.YoutubeVideoUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for YoutubeVideoUrl, length must be less than 255.", new [] { "YoutubeVideoUrl" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,234 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// GameServerCluster
/// </summary>
[DataContract(Name = "GameServerCluster")]
public partial class GameServerCluster : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="GameServerCluster" /> class.
/// </summary>
[JsonConstructorAttribute]
protected GameServerCluster() { }
/// <summary>
/// Initializes a new instance of the <see cref="GameServerCluster" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="name">name (required).</param>
/// <param name="description">description.</param>
/// <param name="gameId">gameId.</param>
/// <param name="websiteUrl">websiteUrl.</param>
/// <param name="bannerUrl">bannerUrl.</param>
/// <param name="ownerId">ownerId.</param>
/// <param name="discordServerId">discordServerId.</param>
/// <param name="youtubeVideoUrl">youtubeVideoUrl.</param>
/// <param name="tags">tags.</param>
/// <param name="commentCount">commentCount.</param>
/// <param name="serverCount">serverCount.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public GameServerCluster(string id = default(string), string name = default(string), string description = default(string), string gameId = default(string), string websiteUrl = default(string), string bannerUrl = default(string), string ownerId = default(string), string discordServerId = default(string), string youtubeVideoUrl = default(string), string tags = default(string), int commentCount = default(int), int serverCount = default(int), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for GameServerCluster and cannot be null");
}
this.Name = name;
this.Id = id;
this.Description = description;
this.GameId = gameId;
this.WebsiteUrl = websiteUrl;
this.BannerUrl = bannerUrl;
this.OwnerId = ownerId;
this.DiscordServerId = discordServerId;
this.YoutubeVideoUrl = youtubeVideoUrl;
this.Tags = tags;
this.CommentCount = commentCount;
this.ServerCount = serverCount;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name = "description", EmitDefaultValue = true)]
public string Description { get; set; }
/// <summary>
/// Gets or Sets GameId
/// </summary>
[DataMember(Name = "game_id", EmitDefaultValue = false)]
public string GameId { get; set; }
/// <summary>
/// Gets or Sets WebsiteUrl
/// </summary>
[DataMember(Name = "website_url", EmitDefaultValue = true)]
public string WebsiteUrl { get; set; }
/// <summary>
/// Gets or Sets BannerUrl
/// </summary>
[DataMember(Name = "banner_url", EmitDefaultValue = true)]
public string BannerUrl { get; set; }
/// <summary>
/// Gets or Sets OwnerId
/// </summary>
[DataMember(Name = "owner_id", EmitDefaultValue = false)]
public string OwnerId { get; set; }
/// <summary>
/// Gets or Sets DiscordServerId
/// </summary>
[DataMember(Name = "discord_server_id", EmitDefaultValue = true)]
public string DiscordServerId { get; set; }
/// <summary>
/// Gets or Sets YoutubeVideoUrl
/// </summary>
[DataMember(Name = "youtube_video_url", EmitDefaultValue = true)]
public string YoutubeVideoUrl { get; set; }
/// <summary>
/// Gets or Sets Tags
/// </summary>
[DataMember(Name = "tags", EmitDefaultValue = true)]
public string Tags { get; set; }
/// <summary>
/// Gets or Sets CommentCount
/// </summary>
[DataMember(Name = "comment_count", EmitDefaultValue = false)]
public int CommentCount { get; set; }
/// <summary>
/// Gets or Sets ServerCount
/// </summary>
[DataMember(Name = "server_count", EmitDefaultValue = false)]
public int ServerCount { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class GameServerCluster {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" GameId: ").Append(GameId).Append("\n");
sb.Append(" WebsiteUrl: ").Append(WebsiteUrl).Append("\n");
sb.Append(" BannerUrl: ").Append(BannerUrl).Append("\n");
sb.Append(" OwnerId: ").Append(OwnerId).Append("\n");
sb.Append(" DiscordServerId: ").Append(DiscordServerId).Append("\n");
sb.Append(" YoutubeVideoUrl: ").Append(YoutubeVideoUrl).Append("\n");
sb.Append(" Tags: ").Append(Tags).Append("\n");
sb.Append(" CommentCount: ").Append(CommentCount).Append("\n");
sb.Append(" ServerCount: ").Append(ServerCount).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Name (string) maxLength
if (this.Name != null && this.Name.Length > 75)
{
yield return new ValidationResult("Invalid value for Name, length must be less than 75.", new [] { "Name" });
}
// WebsiteUrl (string) maxLength
if (this.WebsiteUrl != null && this.WebsiteUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for WebsiteUrl, length must be less than 255.", new [] { "WebsiteUrl" });
}
// BannerUrl (string) maxLength
if (this.BannerUrl != null && this.BannerUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for BannerUrl, length must be less than 255.", new [] { "BannerUrl" });
}
// YoutubeVideoUrl (string) maxLength
if (this.YoutubeVideoUrl != null && this.YoutubeVideoUrl.Length > 255)
{
yield return new ValidationResult("Invalid value for YoutubeVideoUrl, length must be less than 255.", new [] { "YoutubeVideoUrl" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,152 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// GameServerQuery
/// </summary>
[DataContract(Name = "GameServerQuery")]
public partial class GameServerQuery : IValidatableObject
{
/// <summary>
/// Gets or Sets Status
/// </summary>
[DataMember(Name = "status", EmitDefaultValue = false)]
public GameServerStatus? Status { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="GameServerQuery" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="serverId">serverId.</param>
/// <param name="status">status.</param>
/// <param name="ping">ping.</param>
/// <param name="currentPlayers">currentPlayers.</param>
/// <param name="maxPlayers">maxPlayers.</param>
/// <param name="motd">motd.</param>
/// <param name="created">created.</param>
public GameServerQuery(string id = default(string), string serverId = default(string), GameServerStatus? status = default(GameServerStatus?), int ping = default(int), int currentPlayers = default(int), int maxPlayers = default(int), string motd = default(string), DateTime created = default(DateTime))
{
this.Id = id;
this.ServerId = serverId;
this.Status = status;
this.Ping = ping;
this.CurrentPlayers = currentPlayers;
this.MaxPlayers = maxPlayers;
this.Motd = motd;
this.Created = created;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets ServerId
/// </summary>
[DataMember(Name = "server_id", EmitDefaultValue = false)]
public string ServerId { get; set; }
/// <summary>
/// Gets or Sets Ping
/// </summary>
[DataMember(Name = "ping", EmitDefaultValue = false)]
public int Ping { get; set; }
/// <summary>
/// Gets or Sets CurrentPlayers
/// </summary>
[DataMember(Name = "current_players", EmitDefaultValue = false)]
public int CurrentPlayers { get; set; }
/// <summary>
/// Gets or Sets MaxPlayers
/// </summary>
[DataMember(Name = "max_players", EmitDefaultValue = false)]
public int MaxPlayers { get; set; }
/// <summary>
/// Gets or Sets Motd
/// </summary>
[DataMember(Name = "motd", EmitDefaultValue = true)]
public string Motd { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class GameServerQuery {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" ServerId: ").Append(ServerId).Append("\n");
sb.Append(" Status: ").Append(Status).Append("\n");
sb.Append(" Ping: ").Append(Ping).Append("\n");
sb.Append(" CurrentPlayers: ").Append(CurrentPlayers).Append("\n");
sb.Append(" MaxPlayers: ").Append(MaxPlayers).Append("\n");
sb.Append(" Motd: ").Append(Motd).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
// Motd (string) maxLength
if (this.Motd != null && this.Motd.Length > 255)
{
yield return new ValidationResult("Invalid value for Motd, length must be less than 255.", new [] { "Motd" });
}
yield break;
}
}
}

View File

@@ -0,0 +1,54 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines GameServerStatus
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum GameServerStatus
{
/// <summary>
/// Enum Unknown for value: unknown
/// </summary>
[EnumMember(Value = "unknown")]
Unknown,
/// <summary>
/// Enum Offline for value: offline
/// </summary>
[EnumMember(Value = "offline")]
Offline,
/// <summary>
/// Enum Online for value: online
/// </summary>
[EnumMember(Value = "online")]
Online
}
}

View File

@@ -0,0 +1,60 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines GrantType
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum GrantType
{
/// <summary>
/// Enum AuthorizationCode for value: authorization_code
/// </summary>
[EnumMember(Value = "authorization_code")]
AuthorizationCode,
/// <summary>
/// Enum ClientCredentials for value: client_credentials
/// </summary>
[EnumMember(Value = "client_credentials")]
ClientCredentials,
/// <summary>
/// Enum Password for value: password
/// </summary>
[EnumMember(Value = "password")]
Password,
/// <summary>
/// Enum RefreshToken for value: refresh_token
/// </summary>
[EnumMember(Value = "refresh_token")]
RefreshToken
}
}

228
src/Tribufu/Model/Group.cs Normal file
View File

@@ -0,0 +1,228 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Group
/// </summary>
[DataContract(Name = "Group")]
public partial class Group : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="Group" /> class.
/// </summary>
[JsonConstructorAttribute]
protected Group() { }
/// <summary>
/// Initializes a new instance of the <see cref="Group" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="uuid">uuid.</param>
/// <param name="name">name (required).</param>
/// <param name="tag">tag.</param>
/// <param name="description">description.</param>
/// <param name="type">type.</param>
/// <param name="privacy">privacy.</param>
/// <param name="ownerId">ownerId.</param>
/// <param name="verified">verified.</param>
/// <param name="photoUrl">photoUrl.</param>
/// <param name="bannerUrl">bannerUrl.</param>
/// <param name="memberCount">memberCount.</param>
/// <param name="followerCount">followerCount.</param>
/// <param name="viewCount">viewCount.</param>
/// <param name="created">created.</param>
/// <param name="updated">updated.</param>
public Group(string id = default(string), Guid uuid = default(Guid), string name = default(string), string tag = default(string), string description = default(string), int type = default(int), int privacy = default(int), string ownerId = default(string), bool verified = default(bool), string photoUrl = default(string), string bannerUrl = default(string), int memberCount = default(int), int followerCount = default(int), int viewCount = default(int), DateTime created = default(DateTime), DateTime? updated = default(DateTime?))
{
// to ensure "name" is required (not null)
if (name == null)
{
throw new ArgumentNullException("name is a required property for Group and cannot be null");
}
this.Name = name;
this.Id = id;
this.Uuid = uuid;
this.Tag = tag;
this.Description = description;
this.Type = type;
this.Privacy = privacy;
this.OwnerId = ownerId;
this.Verified = verified;
this.PhotoUrl = photoUrl;
this.BannerUrl = bannerUrl;
this.MemberCount = memberCount;
this.FollowerCount = followerCount;
this.ViewCount = viewCount;
this.Created = created;
this.Updated = updated;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Uuid
/// </summary>
[DataMember(Name = "uuid", EmitDefaultValue = false)]
public Guid Uuid { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", IsRequired = true, EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets Tag
/// </summary>
[DataMember(Name = "tag", EmitDefaultValue = true)]
public string Tag { get; set; }
/// <summary>
/// Gets or Sets Description
/// </summary>
[DataMember(Name = "description", EmitDefaultValue = true)]
public string Description { get; set; }
/// <summary>
/// Gets or Sets Type
/// </summary>
[DataMember(Name = "type", EmitDefaultValue = false)]
public int Type { get; set; }
/// <summary>
/// Gets or Sets Privacy
/// </summary>
[DataMember(Name = "privacy", EmitDefaultValue = false)]
public int Privacy { get; set; }
/// <summary>
/// Gets or Sets OwnerId
/// </summary>
[DataMember(Name = "owner_id", EmitDefaultValue = false)]
public string OwnerId { get; set; }
/// <summary>
/// Gets or Sets Verified
/// </summary>
[DataMember(Name = "verified", EmitDefaultValue = true)]
public bool Verified { get; set; }
/// <summary>
/// Gets or Sets PhotoUrl
/// </summary>
[DataMember(Name = "photo_url", EmitDefaultValue = true)]
public string PhotoUrl { get; set; }
/// <summary>
/// Gets or Sets BannerUrl
/// </summary>
[DataMember(Name = "banner_url", EmitDefaultValue = true)]
public string BannerUrl { get; set; }
/// <summary>
/// Gets or Sets MemberCount
/// </summary>
[DataMember(Name = "member_count", EmitDefaultValue = false)]
public int MemberCount { get; set; }
/// <summary>
/// Gets or Sets FollowerCount
/// </summary>
[DataMember(Name = "follower_count", EmitDefaultValue = false)]
public int FollowerCount { get; set; }
/// <summary>
/// Gets or Sets ViewCount
/// </summary>
[DataMember(Name = "view_count", EmitDefaultValue = false)]
public int ViewCount { get; set; }
/// <summary>
/// Gets or Sets Created
/// </summary>
[DataMember(Name = "created", EmitDefaultValue = false)]
public DateTime Created { get; set; }
/// <summary>
/// Gets or Sets Updated
/// </summary>
[DataMember(Name = "updated", EmitDefaultValue = true)]
public DateTime? Updated { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class Group {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" Tag: ").Append(Tag).Append("\n");
sb.Append(" Description: ").Append(Description).Append("\n");
sb.Append(" Type: ").Append(Type).Append("\n");
sb.Append(" Privacy: ").Append(Privacy).Append("\n");
sb.Append(" OwnerId: ").Append(OwnerId).Append("\n");
sb.Append(" Verified: ").Append(Verified).Append("\n");
sb.Append(" PhotoUrl: ").Append(PhotoUrl).Append("\n");
sb.Append(" BannerUrl: ").Append(BannerUrl).Append("\n");
sb.Append(" MemberCount: ").Append(MemberCount).Append("\n");
sb.Append(" FollowerCount: ").Append(FollowerCount).Append("\n");
sb.Append(" ViewCount: ").Append(ViewCount).Append("\n");
sb.Append(" Created: ").Append(Created).Append("\n");
sb.Append(" Updated: ").Append(Updated).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,147 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// GroupGame
/// </summary>
[DataContract(Name = "GroupGame")]
public partial class GroupGame : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="GroupGame" /> class.
/// </summary>
[JsonConstructorAttribute]
protected GroupGame() { }
/// <summary>
/// Initializes a new instance of the <see cref="GroupGame" /> class.
/// </summary>
/// <param name="groupId">groupId (required).</param>
/// <param name="group">group.</param>
/// <param name="applicationId">applicationId.</param>
/// <param name="application">application.</param>
/// <param name="stats">stats.</param>
/// <param name="acquired">acquired.</param>
/// <param name="lastUsed">lastUsed.</param>
public GroupGame(string groupId = default(string), Group group = default(Group), string applicationId = default(string), Application application = default(Application), Object stats = default(Object), DateTime acquired = default(DateTime), DateTime? lastUsed = default(DateTime?))
{
// to ensure "groupId" is required (not null)
if (groupId == null)
{
throw new ArgumentNullException("groupId is a required property for GroupGame and cannot be null");
}
this.GroupId = groupId;
this.Group = group;
this.ApplicationId = applicationId;
this.Application = application;
this.Stats = stats;
this.Acquired = acquired;
this.LastUsed = lastUsed;
}
/// <summary>
/// Gets or Sets GroupId
/// </summary>
[DataMember(Name = "group_id", IsRequired = true, EmitDefaultValue = true)]
public string GroupId { get; set; }
/// <summary>
/// Gets or Sets Group
/// </summary>
[DataMember(Name = "group", EmitDefaultValue = false)]
public Group Group { get; set; }
/// <summary>
/// Gets or Sets ApplicationId
/// </summary>
[DataMember(Name = "application_id", EmitDefaultValue = false)]
public string ApplicationId { get; set; }
/// <summary>
/// Gets or Sets Application
/// </summary>
[DataMember(Name = "application", EmitDefaultValue = false)]
public Application Application { get; set; }
/// <summary>
/// Gets or Sets Stats
/// </summary>
[DataMember(Name = "stats", EmitDefaultValue = true)]
public Object Stats { get; set; }
/// <summary>
/// Gets or Sets Acquired
/// </summary>
[DataMember(Name = "acquired", EmitDefaultValue = false)]
public DateTime Acquired { get; set; }
/// <summary>
/// Gets or Sets LastUsed
/// </summary>
[DataMember(Name = "last_used", EmitDefaultValue = true)]
public DateTime? LastUsed { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class GroupGame {\n");
sb.Append(" GroupId: ").Append(GroupId).Append("\n");
sb.Append(" Group: ").Append(Group).Append("\n");
sb.Append(" ApplicationId: ").Append(ApplicationId).Append("\n");
sb.Append(" Application: ").Append(Application).Append("\n");
sb.Append(" Stats: ").Append(Stats).Append("\n");
sb.Append(" Acquired: ").Append(Acquired).Append("\n");
sb.Append(" LastUsed: ").Append(LastUsed).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,155 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// GroupMember
/// </summary>
[DataContract(Name = "GroupMember")]
public partial class GroupMember : IValidatableObject
{
/// <summary>
/// Gets or Sets Rank
/// </summary>
[DataMember(Name = "rank", EmitDefaultValue = false)]
public GroupRank? Rank { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="GroupMember" /> class.
/// </summary>
/// <param name="id">id.</param>
/// <param name="uuid">uuid.</param>
/// <param name="name">name.</param>
/// <param name="displayName">displayName.</param>
/// <param name="verified">verified.</param>
/// <param name="photoUrl">photoUrl.</param>
/// <param name="lastOnline">lastOnline.</param>
/// <param name="rank">rank.</param>
/// <param name="since">since.</param>
public GroupMember(string id = default(string), Guid uuid = default(Guid), string name = default(string), string displayName = default(string), bool verified = default(bool), string photoUrl = default(string), DateTime? lastOnline = default(DateTime?), GroupRank? rank = default(GroupRank?), DateTime since = default(DateTime))
{
this.Id = id;
this.Uuid = uuid;
this.Name = name;
this.DisplayName = displayName;
this.Verified = verified;
this.PhotoUrl = photoUrl;
this.LastOnline = lastOnline;
this.Rank = rank;
this.Since = since;
}
/// <summary>
/// Gets or Sets Id
/// </summary>
[DataMember(Name = "id", EmitDefaultValue = false)]
public string Id { get; set; }
/// <summary>
/// Gets or Sets Uuid
/// </summary>
[DataMember(Name = "uuid", EmitDefaultValue = false)]
public Guid Uuid { get; set; }
/// <summary>
/// Gets or Sets Name
/// </summary>
[DataMember(Name = "name", EmitDefaultValue = true)]
public string Name { get; set; }
/// <summary>
/// Gets or Sets DisplayName
/// </summary>
[DataMember(Name = "display_name", EmitDefaultValue = true)]
public string DisplayName { get; set; }
/// <summary>
/// Gets or Sets Verified
/// </summary>
[DataMember(Name = "verified", EmitDefaultValue = true)]
public bool Verified { get; set; }
/// <summary>
/// Gets or Sets PhotoUrl
/// </summary>
[DataMember(Name = "photo_url", EmitDefaultValue = true)]
public string PhotoUrl { get; set; }
/// <summary>
/// Gets or Sets LastOnline
/// </summary>
[DataMember(Name = "last_online", EmitDefaultValue = true)]
public DateTime? LastOnline { get; set; }
/// <summary>
/// Gets or Sets Since
/// </summary>
[DataMember(Name = "since", EmitDefaultValue = false)]
public DateTime Since { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class GroupMember {\n");
sb.Append(" Id: ").Append(Id).Append("\n");
sb.Append(" Uuid: ").Append(Uuid).Append("\n");
sb.Append(" Name: ").Append(Name).Append("\n");
sb.Append(" DisplayName: ").Append(DisplayName).Append("\n");
sb.Append(" Verified: ").Append(Verified).Append("\n");
sb.Append(" PhotoUrl: ").Append(PhotoUrl).Append("\n");
sb.Append(" LastOnline: ").Append(LastOnline).Append("\n");
sb.Append(" Rank: ").Append(Rank).Append("\n");
sb.Append(" Since: ").Append(Since).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,54 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// Defines GroupRank
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum GroupRank
{
/// <summary>
/// Enum Member for value: member
/// </summary>
[EnumMember(Value = "member")]
Member,
/// <summary>
/// Enum Leader for value: leader
/// </summary>
[EnumMember(Value = "leader")]
Leader,
/// <summary>
/// Enum Owner for value: owner
/// </summary>
[EnumMember(Value = "owner")]
Owner
}
}

View File

@@ -0,0 +1,93 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// HashViewModel
/// </summary>
[DataContract(Name = "HashViewModel")]
public partial class HashViewModel : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="HashViewModel" /> class.
/// </summary>
[JsonConstructorAttribute]
protected HashViewModel() { }
/// <summary>
/// Initializes a new instance of the <see cref="HashViewModel" /> class.
/// </summary>
/// <param name="value">value (required).</param>
public HashViewModel(string value = default(string))
{
// to ensure "value" is required (not null)
if (value == null)
{
throw new ArgumentNullException("value is a required property for HashViewModel and cannot be null");
}
this.Value = value;
}
/// <summary>
/// Gets or Sets Value
/// </summary>
[DataMember(Name = "value", IsRequired = true, EmitDefaultValue = true)]
public string Value { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class HashViewModel {\n");
sb.Append(" Value: ").Append(Value).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,102 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// IntrospectRequest
/// </summary>
[DataContract(Name = "IntrospectRequest")]
public partial class IntrospectRequest : IValidatableObject
{
/// <summary>
/// Gets or Sets TokenTypeHint
/// </summary>
[DataMember(Name = "token_type_hint", IsRequired = true, EmitDefaultValue = true)]
public TokenHintType TokenTypeHint { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="IntrospectRequest" /> class.
/// </summary>
[JsonConstructorAttribute]
protected IntrospectRequest() { }
/// <summary>
/// Initializes a new instance of the <see cref="IntrospectRequest" /> class.
/// </summary>
/// <param name="token">token (required).</param>
/// <param name="tokenTypeHint">tokenTypeHint (required).</param>
public IntrospectRequest(string token = default(string), TokenHintType tokenTypeHint = default(TokenHintType))
{
// to ensure "token" is required (not null)
if (token == null)
{
throw new ArgumentNullException("token is a required property for IntrospectRequest and cannot be null");
}
this.Token = token;
this.TokenTypeHint = tokenTypeHint;
}
/// <summary>
/// Gets or Sets Token
/// </summary>
[DataMember(Name = "token", IsRequired = true, EmitDefaultValue = true)]
public string Token { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class IntrospectRequest {\n");
sb.Append(" Token: ").Append(Token).Append("\n");
sb.Append(" TokenTypeHint: ").Append(TokenTypeHint).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

View File

@@ -0,0 +1,182 @@
/*
* Tribufu API
*
* API to access Tribufu services.
*
* The version of the OpenAPI document: 1.2.6
* Contact: contact@tribufu.com
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = Tribufu.Client.OpenAPIDateConverter;
namespace Tribufu.Model
{
/// <summary>
/// IntrospectResponse
/// </summary>
[DataContract(Name = "IntrospectResponse")]
public partial class IntrospectResponse : IValidatableObject
{
/// <summary>
/// Initializes a new instance of the <see cref="IntrospectResponse" /> class.
/// </summary>
/// <param name="jti">jti.</param>
/// <param name="active">active.</param>
/// <param name="tokenType">tokenType.</param>
/// <param name="clientId">clientId.</param>
/// <param name="sub">sub.</param>
/// <param name="username">username.</param>
/// <param name="scope">scope.</param>
/// <param name="iss">iss.</param>
/// <param name="aud">aud.</param>
/// <param name="iat">iat.</param>
/// <param name="exp">exp.</param>
/// <param name="nbf">nbf.</param>
public IntrospectResponse(string jti = default(string), bool active = default(bool), string tokenType = default(string), string clientId = default(string), string sub = default(string), string username = default(string), string scope = default(string), string iss = default(string), string aud = default(string), long? iat = default(long?), long? exp = default(long?), long? nbf = default(long?))
{
this.Jti = jti;
this.Active = active;
this.TokenType = tokenType;
this.ClientId = clientId;
this.Sub = sub;
this.Username = username;
this.Scope = scope;
this.Iss = iss;
this.Aud = aud;
this.Iat = iat;
this.Exp = exp;
this.Nbf = nbf;
}
/// <summary>
/// Gets or Sets Jti
/// </summary>
[DataMember(Name = "jti", EmitDefaultValue = true)]
public string Jti { get; set; }
/// <summary>
/// Gets or Sets Active
/// </summary>
[DataMember(Name = "active", EmitDefaultValue = true)]
public bool Active { get; set; }
/// <summary>
/// Gets or Sets TokenType
/// </summary>
[DataMember(Name = "token_type", EmitDefaultValue = true)]
public string TokenType { get; set; }
/// <summary>
/// Gets or Sets ClientId
/// </summary>
[DataMember(Name = "client_id", EmitDefaultValue = true)]
public string ClientId { get; set; }
/// <summary>
/// Gets or Sets Sub
/// </summary>
[DataMember(Name = "sub", EmitDefaultValue = true)]
public string Sub { get; set; }
/// <summary>
/// Gets or Sets Username
/// </summary>
[DataMember(Name = "username", EmitDefaultValue = true)]
public string Username { get; set; }
/// <summary>
/// Gets or Sets Scope
/// </summary>
[DataMember(Name = "scope", EmitDefaultValue = true)]
public string Scope { get; set; }
/// <summary>
/// Gets or Sets Iss
/// </summary>
[DataMember(Name = "iss", EmitDefaultValue = true)]
public string Iss { get; set; }
/// <summary>
/// Gets or Sets Aud
/// </summary>
[DataMember(Name = "aud", EmitDefaultValue = true)]
public string Aud { get; set; }
/// <summary>
/// Gets or Sets Iat
/// </summary>
[DataMember(Name = "iat", EmitDefaultValue = true)]
public long? Iat { get; set; }
/// <summary>
/// Gets or Sets Exp
/// </summary>
[DataMember(Name = "exp", EmitDefaultValue = true)]
public long? Exp { get; set; }
/// <summary>
/// Gets or Sets Nbf
/// </summary>
[DataMember(Name = "nbf", EmitDefaultValue = true)]
public long? Nbf { get; set; }
/// <summary>
/// Returns the string presentation of the object
/// </summary>
/// <returns>String presentation of the object</returns>
public override string ToString()
{
StringBuilder sb = new StringBuilder();
sb.Append("class IntrospectResponse {\n");
sb.Append(" Jti: ").Append(Jti).Append("\n");
sb.Append(" Active: ").Append(Active).Append("\n");
sb.Append(" TokenType: ").Append(TokenType).Append("\n");
sb.Append(" ClientId: ").Append(ClientId).Append("\n");
sb.Append(" Sub: ").Append(Sub).Append("\n");
sb.Append(" Username: ").Append(Username).Append("\n");
sb.Append(" Scope: ").Append(Scope).Append("\n");
sb.Append(" Iss: ").Append(Iss).Append("\n");
sb.Append(" Aud: ").Append(Aud).Append("\n");
sb.Append(" Iat: ").Append(Iat).Append("\n");
sb.Append(" Exp: ").Append(Exp).Append("\n");
sb.Append(" Nbf: ").Append(Nbf).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
/// <summary>
/// Returns the JSON string presentation of the object
/// </summary>
/// <returns>JSON string presentation of the object</returns>
public virtual string ToJson()
{
return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
}
/// <summary>
/// To validate all properties of the instance
/// </summary>
/// <param name="validationContext">Validation context</param>
/// <returns>Validation Result</returns>
IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
{
yield break;
}
}
}

Some files were not shown because too many files have changed in this diff Show More