Traq 1.0.0-alpha.1
dotnet add package Traq --version 1.0.0-alpha.1
NuGet\Install-Package Traq -Version 1.0.0-alpha.1
<PackageReference Include="Traq" Version="1.0.0-alpha.1" />
<PackageVersion Include="Traq" Version="1.0.0-alpha.1" />
<PackageReference Include="Traq" />
paket add Traq --version 1.0.0-alpha.1
#r "nuget: Traq, 1.0.0-alpha.1"
#:package Traq@1.0.0-alpha.1
#addin nuget:?package=Traq&version=1.0.0-alpha.1&prerelease
#tool nuget:?package=Traq&version=1.0.0-alpha.1&prerelease
dotnet-traq
.NET client library for the traQ API.
The source code is generated from the OpenAPI Spec for the traQ API by Microsoft Kiota.
How to Use
Use in Generic Host
An extension method for the IServiceCollection
type can be used.
In the sample code below, an instance of the TraqApiClient
class configured by environment variables (TRAQ_BASE_ADDRESS
and TRAQ_ACCESS_TOKEN
) is added to the service collection.
var host = Host.CreateDefaultApplication(args)
.ConfigureServices((ctx, services) =>
{
services.AddTraqApiClient(options =>
{
var conf = ctx.Configuration;
options.BaseAddress = conf["TRAQ_BASE_ADDRESS"];
options.BearerAuthToken = conf["TRAQ_ACCESS_TOKEN"];
});
})
.Build();
host.Run();
You can also separate configurator from the AddTraqApiClient
method by using parameterless method.
In the following code, the added TraqApiClient
automatically use configured TraqApiClientOptions
.
var host = Host.CreateDefaultApplication(args)
.ConfigureServices((ctx, services) =>
{
services.Configure<TraqApiClientOptions>(ctx.Configuration);
services.AddTraqApiClient();
})
.Build();
host.Run();
Create API Client Manually
The CreateFromOptions
method in the TraqApiClientHelper
class is useful to create a new instance of the TraqApiClient
class with specified options.
TraqApiClientOptions options = new()
{
BaseAddress = "Base address of the traQ API",
BearerAuthToken = "Bearer authentication token"
}
var client = TraqApiClientHelper.CreateFromOptions(options);
The TraqApiClient
class implements Microsoft.Kiota.Abstractions.BaseRequestBuilder
so that you can manually manage methods to access the traQ API.
For more information, please check Kiota Official Documentation.
Source Generation
Docker and Task are required for source generation.
To generate API client for certain version of traQ, set it to the GITHUB_TAG_NAME
variable and run task
, task gen
or task generate-client
.
The following command generates API client for traQ v3.25.0.
GITHUB_TAG_NAME=v3.25.0 task
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Hosting (>= 9.0.4)
- Microsoft.Kiota.Bundle (>= 1.19.0)
-
net9.0
- Microsoft.Extensions.Hosting (>= 9.0.4)
- Microsoft.Kiota.Bundle (>= 1.19.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Traq:
Package | Downloads |
---|---|
KnoqNet.Extensions.Authentication
A dotnet extension library for the knoQ API that provides authentication methods with traQ service. |
|
Traq.Bot
A .NET library for traQ BOT works with WebSocker or HttpServer. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Switch API client generator from OpenAPI Generator to Microsoft Kiota and add support for Native AOT. This release contains breaking changes.