mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2026-02-04 10:46:34 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 06f60eec10 | |||
| 7275aef60b | |||
| 24c18dbbbe | |||
| 7bb51a21e1 |
13
Directory.Build.props
Normal file
13
Directory.Build.props
Normal file
@@ -0,0 +1,13 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
<Version>1.0.0</Version>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -4,5 +4,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageVersion Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
[![Discord Chat][discord-badge]][discord-url]
|
||||
|
||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[mit-url]: https://github.com/Tribufu/TribufuNet/blob/main/LICENSE.txt
|
||||
[mit-url]: https://github.com/tribufu/sdk-dotnet/blob/main/LICENSE.txt
|
||||
[discord-badge]: https://img.shields.io/discord/276504514616623104.svg?logo=discord&style=flat-square
|
||||
[discord-url]: https://www.tribufu.com/discord
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
|
||||
This project is licensed under the [MIT License].
|
||||
|
||||
[MIT License]: https://github.com/Tribufu/TribufuNet/blob/main/LICENSE.txt
|
||||
[MIT License]: https://github.com/tribufu/sdk-dotnet/blob/main/LICENSE.txt
|
||||
|
||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu", "src\Tribufu\Trib
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.Utils", "src\Tribufu.Utils\Tribufu.Utils.csproj", "{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tribufu.ComponentModel", "src\Tribufu.ComponentModel\Tribufu.ComponentModel.csproj", "{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -37,6 +39,10 @@ Global
|
||||
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F16FBBB-199E-4EE3-BFF3-31DD6F84DCD0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3DFBC35E-62A7-4CB0-81D9-5E7AA1882557}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
3
scripts/nswag.ps1
Normal file
3
scripts/nswag.ps1
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
nswag run ./src/Tribufu/api.nswag
|
||||
30
src/Tribufu.ComponentModel/EnumMemberConverter.cs
Normal file
30
src/Tribufu.ComponentModel/EnumMemberConverter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Tribufu.ComponentModel
|
||||
{
|
||||
public class EnumMemberConverter<T> : EnumConverter
|
||||
{
|
||||
public EnumMemberConverter(Type type) : base(type) { }
|
||||
|
||||
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
var type = typeof(T);
|
||||
|
||||
foreach (var field in type.GetFields())
|
||||
{
|
||||
if (Attribute.GetCustomAttribute(field, typeof(EnumMemberAttribute)) is EnumMemberAttribute attribute && value is string enumValue && attribute.Value == enumValue)
|
||||
{
|
||||
return field.GetValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
src/Tribufu.ComponentModel/README.md
Normal file
1
src/Tribufu.ComponentModel/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# Tribufu
|
||||
16
src/Tribufu.ComponentModel/Tribufu.ComponentModel.csproj
Normal file
16
src/Tribufu.ComponentModel/Tribufu.ComponentModel.csproj
Normal file
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.ComponentModel</PackageId>
|
||||
<Description>Tribufu Component Model Helpers</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>
|
||||
</Project>
|
||||
@@ -1,15 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.Native</PackageId>
|
||||
<Version>0.1.0</Version>
|
||||
<Description>Tribufu Native Interop</Description>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -17,12 +10,12 @@
|
||||
<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>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.Serialization.Newtonsoft</PackageId>
|
||||
<Version>0.1.0</Version>
|
||||
<Description>Tribufu Serialization Helpers for Newtonsoft.Json</Description>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -17,10 +10,10 @@
|
||||
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.Serialization</PackageId>
|
||||
<Version>0.1.0</Version>
|
||||
<Description>Tribufu Serialization Helpers</Description>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu.Utils</PackageId>
|
||||
<Version>0.1.0</Version>
|
||||
<Description>Tribufu Utils</Description>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -17,9 +10,9 @@
|
||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,15 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<PackageId>Tribufu</PackageId>
|
||||
<Version>0.1.0</Version>
|
||||
<Description>Tribufu .NET SDK</Description>
|
||||
<Authors>Tribufu</Authors>
|
||||
<Company>Tribufu</Company>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<Copyright>Copyright (c) Tribufu. All Rights Reserved.</Copyright>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://github.com/Tribufu/TribufuNet</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -17,10 +10,15 @@
|
||||
<TargetFrameworks>netstandard2.0;net45;net5.0</TargetFrameworks>
|
||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tribufu.Native\Tribufu.Native.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" />
|
||||
<PackageReference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Tribufu.Native\Tribufu.Native.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
14
src/Tribufu/TribufuApi.cs
Normal file
14
src/Tribufu/TribufuApi.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
using System.Net.Http;
|
||||
|
||||
namespace Tribufu
|
||||
{
|
||||
public class TribufuApi : TribufuApiGenerated
|
||||
{
|
||||
public TribufuApi(TribufuApiOptions options) : base(options.BaseUrl, new HttpClient())
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
5889
src/Tribufu/TribufuApi.generated.cs
Normal file
5889
src/Tribufu/TribufuApi.generated.cs
Normal file
File diff suppressed because it is too large
Load Diff
18
src/Tribufu/TribufuApiOptions.cs
Normal file
18
src/Tribufu/TribufuApiOptions.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright (c) Tribufu. All Rights Reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
namespace Tribufu
|
||||
{
|
||||
public class TribufuApiOptions
|
||||
{
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
public string ApiKey { get; set; }
|
||||
|
||||
public TribufuApiOptions(string baseUrl, string apiKey)
|
||||
{
|
||||
BaseUrl = baseUrl;
|
||||
ApiKey = apiKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
101
src/Tribufu/api.nswag
Normal file
101
src/Tribufu/api.nswag
Normal file
@@ -0,0 +1,101 @@
|
||||
{
|
||||
"runtime": "Default",
|
||||
"defaultVariables": null,
|
||||
"documentGenerator": {
|
||||
"fromDocument": {
|
||||
"json": "",
|
||||
"url": "https://api.tribufu.com/v1/openapi.json",
|
||||
"output": null,
|
||||
"newLineBehavior": "Auto"
|
||||
}
|
||||
},
|
||||
"codeGenerators": {
|
||||
"openApiToCSharpClient": {
|
||||
"clientBaseClass": null,
|
||||
"configurationClass": null,
|
||||
"generateClientClasses": true,
|
||||
"suppressClientClassesOutput": false,
|
||||
"generateClientInterfaces": false,
|
||||
"suppressClientInterfacesOutput": false,
|
||||
"clientBaseInterface": null,
|
||||
"injectHttpClient": true,
|
||||
"disposeHttpClient": true,
|
||||
"protectedMethods": [],
|
||||
"generateExceptionClasses": true,
|
||||
"exceptionClass": "TribufuApiException",
|
||||
"wrapDtoExceptions": true,
|
||||
"useHttpClientCreationMethod": false,
|
||||
"httpClientType": "System.Net.Http.HttpClient",
|
||||
"useHttpRequestMessageCreationMethod": false,
|
||||
"useBaseUrl": true,
|
||||
"generateBaseUrlProperty": true,
|
||||
"generateSyncMethods": false,
|
||||
"generatePrepareRequestAndProcessResponseAsAsyncMethods": false,
|
||||
"exposeJsonSerializerSettings": false,
|
||||
"clientClassAccessModifier": "public",
|
||||
"typeAccessModifier": "public",
|
||||
"propertySetterAccessModifier": "",
|
||||
"generateNativeRecords": false,
|
||||
"generateContractsOutput": false,
|
||||
"contractsNamespace": null,
|
||||
"contractsOutputFilePath": null,
|
||||
"parameterDateTimeFormat": "s",
|
||||
"parameterDateFormat": "yyyy-MM-dd",
|
||||
"generateUpdateJsonSerializerSettingsMethod": true,
|
||||
"useRequestAndResponseSerializationSettings": false,
|
||||
"serializeTypeInformation": false,
|
||||
"queryNullValue": "",
|
||||
"className": "TribufuApiGenerated",
|
||||
"operationGenerationMode": "SingleClientFromOperationId",
|
||||
"additionalNamespaceUsages": [],
|
||||
"additionalContractNamespaceUsages": [],
|
||||
"generateOptionalParameters": true,
|
||||
"generateJsonMethods": false,
|
||||
"enforceFlagEnums": false,
|
||||
"parameterArrayType": "System.Collections.Generic.IEnumerable",
|
||||
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
|
||||
"responseArrayType": "System.Collections.Generic.ICollection",
|
||||
"responseDictionaryType": "System.Collections.Generic.IDictionary",
|
||||
"wrapResponses": false,
|
||||
"wrapResponseMethods": [],
|
||||
"generateResponseClasses": true,
|
||||
"responseClass": "SwaggerResponse",
|
||||
"namespace": "Tribufu",
|
||||
"requiredPropertiesMustBeDefined": true,
|
||||
"dateType": "System.DateTimeOffset",
|
||||
"jsonConverters": null,
|
||||
"anyType": "object",
|
||||
"dateTimeType": "System.DateTimeOffset",
|
||||
"timeType": "System.TimeSpan",
|
||||
"timeSpanType": "System.TimeSpan",
|
||||
"arrayType": "System.Collections.Generic.ICollection",
|
||||
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
|
||||
"dictionaryType": "System.Collections.Generic.IDictionary",
|
||||
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
|
||||
"arrayBaseType": "System.Collections.ObjectModel.Collection",
|
||||
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
|
||||
"classStyle": "Poco",
|
||||
"jsonLibrary": "NewtonsoftJson",
|
||||
"generateDefaultValues": true,
|
||||
"generateDataAnnotations": true,
|
||||
"excludedTypeNames": [],
|
||||
"excludedParameterNames": [],
|
||||
"handleReferences": false,
|
||||
"generateImmutableArrayProperties": false,
|
||||
"generateImmutableDictionaryProperties": false,
|
||||
"jsonSerializerSettingsTransformationMethod": null,
|
||||
"inlineNamedArrays": false,
|
||||
"inlineNamedDictionaries": false,
|
||||
"inlineNamedTuples": true,
|
||||
"inlineNamedAny": false,
|
||||
"generateDtoTypes": true,
|
||||
"generateOptionalPropertiesAsNullable": false,
|
||||
"generateNullableReferenceTypes": false,
|
||||
"templateDirectory": null,
|
||||
"serviceHost": null,
|
||||
"serviceSchemes": null,
|
||||
"output": "TribufuApi.generated.cs",
|
||||
"newLineBehavior": "LF"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user