mirror of
https://github.com/tribufu/tribufu-dotnet
synced 2025-06-15 09:54:18 +00:00
Update README.md
This commit is contained in:
285
README.md
285
README.md
@ -1,279 +1,20 @@
|
||||
# Tribufu - the C# library for the Tribufu API
|
||||
# Tribufu .NET
|
||||
|
||||
REST API to access Tribufu services.
|
||||
.NET SDK to access Tribufu APIs and services.
|
||||
|
||||
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
|
||||
[![MIT License][mit-badge]][mit-url]
|
||||
[![Discord Chat][discord-badge]][discord-url]
|
||||
|
||||
- API version: 1.1.0
|
||||
- SDK version: 1.0.0
|
||||
- Generator version: 7.8.0
|
||||
- Build package: org.openapitools.codegen.languages.CSharpClientCodegen
|
||||
For more information, please visit [https://www.tribufu.com/contact](https://www.tribufu.com/contact)
|
||||
[mit-badge]: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
[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
|
||||
|
||||
<a id="frameworks-supported"></a>
|
||||
## Frameworks supported
|
||||
[Website](https://www.tribufu.com) |
|
||||
[Discord](https://www.tribufu.com/discord)
|
||||
|
||||
<a id="dependencies"></a>
|
||||
## Dependencies
|
||||
## License
|
||||
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 13.0.2 or later
|
||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
|
||||
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
```
|
||||
Install-Package Newtonsoft.Json
|
||||
Install-Package JsonSubTypes
|
||||
Install-Package System.ComponentModel.Annotations
|
||||
```
|
||||
<a id="installation"></a>
|
||||
## Installation
|
||||
Run the following command to generate the DLL
|
||||
- [Mac/Linux] `/bin/sh build.sh`
|
||||
- [Windows] `build.bat`
|
||||
|
||||
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
|
||||
```csharp
|
||||
using Tribufu.Api;
|
||||
using Tribufu.Client;
|
||||
using Tribufu.Model;
|
||||
```
|
||||
<a id="packaging"></a>
|
||||
## Packaging
|
||||
|
||||
A `.nuspec` is included with the project. You can follow the Nuget quickstart to [create](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#create-the-package) and [publish](https://docs.microsoft.com/en-us/nuget/quickstart/create-and-publish-a-package#publish-the-package) packages.
|
||||
|
||||
This `.nuspec` uses placeholders from the `.csproj`, so build the `.csproj` directly:
|
||||
|
||||
```
|
||||
nuget pack -Build -OutputDirectory out Tribufu.csproj
|
||||
```
|
||||
|
||||
Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-packages/local-feeds) or [other host](https://docs.microsoft.com/en-us/nuget/hosting-packages/overview) and consume the new package via Nuget as usual.
|
||||
|
||||
<a id="usage"></a>
|
||||
## Usage
|
||||
|
||||
To use the API client with a HTTP proxy, setup a `System.Net.WebProxy`
|
||||
```csharp
|
||||
Configuration c = new Configuration();
|
||||
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
|
||||
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
|
||||
c.Proxy = webProxy;
|
||||
```
|
||||
|
||||
### Connections
|
||||
Each ApiClass (properly the ApiClient inside it) will create an instance of HttpClient. It will use that for the entire lifecycle and dispose it when called the Dispose method.
|
||||
|
||||
To better manager the connections it's a common practice to reuse the HttpClient and HttpClientHandler (see [here](https://docs.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests#issues-with-the-original-httpclient-class-available-in-net) for details). To use your own HttpClient instance just pass it to the ApiClass constructor.
|
||||
|
||||
```csharp
|
||||
HttpClientHandler yourHandler = new HttpClientHandler();
|
||||
HttpClient yourHttpClient = new HttpClient(yourHandler);
|
||||
var api = new YourApiClass(yourHttpClient, yourHandler);
|
||||
```
|
||||
|
||||
If you want to use an HttpClient and don't have access to the handler, for example in a DI context in Asp.net Core when using IHttpClientFactory.
|
||||
|
||||
```csharp
|
||||
HttpClient yourHttpClient = new HttpClient();
|
||||
var api = new YourApiClass(yourHttpClient);
|
||||
```
|
||||
You'll loose some configuration settings, the features affected are: Setting and Retrieving Cookies, Client Certificates, Proxy settings. You need to either manually handle those in your setup of the HttpClient or they won't be available.
|
||||
|
||||
Here an example of DI setup in a sample web project:
|
||||
|
||||
```csharp
|
||||
services.AddHttpClient<YourApiClass>(httpClient =>
|
||||
new PetApi(httpClient));
|
||||
```
|
||||
|
||||
|
||||
<a id="getting-started"></a>
|
||||
## Getting Started
|
||||
|
||||
```csharp
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using Tribufu.Api;
|
||||
using Tribufu.Client;
|
||||
using Tribufu.Model;
|
||||
|
||||
namespace Example
|
||||
{
|
||||
public class Example
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
|
||||
Configuration config = new Configuration();
|
||||
config.BasePath = "http://localhost";
|
||||
// Configure API key authorization: ApiKey
|
||||
config.ApiKey.Add("Authorization", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// config.ApiKeyPrefix.Add("Authorization", "Bearer");
|
||||
|
||||
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
|
||||
HttpClient httpClient = new HttpClient();
|
||||
HttpClientHandler httpClientHandler = new HttpClientHandler();
|
||||
var apiInstance = new TribufuApi(httpClient, config, httpClientHandler);
|
||||
var authorizeRequest = new AuthorizeRequest?(); // AuthorizeRequest? | (optional)
|
||||
|
||||
try
|
||||
{
|
||||
// Authorize the client to access the user information.
|
||||
apiInstance.Authorize(authorizeRequest);
|
||||
}
|
||||
catch (ApiException e)
|
||||
{
|
||||
Debug.Print("Exception when calling TribufuApi.Authorize: " + e.Message );
|
||||
Debug.Print("Status Code: "+ e.ErrorCode);
|
||||
Debug.Print(e.StackTrace);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<a id="documentation-for-api-endpoints"></a>
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*TribufuApi* | [**Authorize**](docs/TribufuApi.md#authorize) | **POST** /v1/oauth2/authorize | Authorize the client to access the user information.
|
||||
*TribufuApi* | [**ChangeEmail**](docs/TribufuApi.md#changeemail) | **PUT** /v1/users/{id}/email | Change the email of a user.
|
||||
*TribufuApi* | [**ChangePassword**](docs/TribufuApi.md#changepassword) | **PUT** /v1/users/{id}/password | Change the password of a user.
|
||||
*TribufuApi* | [**ClaimGameServer**](docs/TribufuApi.md#claimgameserver) | **PUT** /v1/servers/{id}/claim | Claim a game server.
|
||||
*TribufuApi* | [**ConvertBase64**](docs/TribufuApi.md#convertbase64) | **POST** /v1/utils/base64 | Convert a string to base64 or vice versa.
|
||||
*TribufuApi* | [**CreateGameServer**](docs/TribufuApi.md#creategameserver) | **POST** /v1/servers | Create a new game server.
|
||||
*TribufuApi* | [**CreateGameServerCluster**](docs/TribufuApi.md#creategameservercluster) | **POST** /v1/clusters | Create a new game server cluster.
|
||||
*TribufuApi* | [**CreateGroup**](docs/TribufuApi.md#creategroup) | **POST** /v1/groups | Create a new group.
|
||||
*TribufuApi* | [**CreateToken**](docs/TribufuApi.md#createtoken) | **POST** /v1/oauth2/token | Create a new token with grant type.
|
||||
*TribufuApi* | [**DeleteGameServer**](docs/TribufuApi.md#deletegameserver) | **DELETE** /v1/servers/{id} | Delete a game server.
|
||||
*TribufuApi* | [**DeleteGameServerCluster**](docs/TribufuApi.md#deletegameservercluster) | **DELETE** /v1/clusters/{id} | Delete a game server cluster.
|
||||
*TribufuApi* | [**DeleteGroup**](docs/TribufuApi.md#deletegroup) | **DELETE** /v1/groups/{id} | Delete a group.
|
||||
*TribufuApi* | [**GenerateFlakeId**](docs/TribufuApi.md#generateflakeid) | **GET** /v1/utils/flake | Generate one or more flake ids.
|
||||
*TribufuApi* | [**GenerateFlakeIdFromTimestamp**](docs/TribufuApi.md#generateflakeidfromtimestamp) | **GET** /v1/utils/flake/{timestamp} | Generate one or more flake ids from a timestamp.
|
||||
*TribufuApi* | [**GeneratePassword**](docs/TribufuApi.md#generatepassword) | **GET** /v1/utils/password | Generate a random password.
|
||||
*TribufuApi* | [**GenerateUuid**](docs/TribufuApi.md#generateuuid) | **GET** /v1/utils/uuid | Generate one or more uuids with a specific version.
|
||||
*TribufuApi* | [**GetClientInfo**](docs/TribufuApi.md#getclientinfo) | **GET** /v1/oauth2/clientinfo | Get current client information.
|
||||
*TribufuApi* | [**GetCurrentIpAddress**](docs/TribufuApi.md#getcurrentipaddress) | **GET** /v1/geoip | Get current ip address location.
|
||||
*TribufuApi* | [**GetGameById**](docs/TribufuApi.md#getgamebyid) | **GET** /v1/games/{id} | Get a game by id.
|
||||
*TribufuApi* | [**GetGameClustersByGameId**](docs/TribufuApi.md#getgameclustersbygameid) | **GET** /v1/games/{id}/clusters | Get a list of game server clusters of a game.
|
||||
*TribufuApi* | [**GetGameItems**](docs/TribufuApi.md#getgameitems) | **GET** /v1/games/{id}/items | Get a list of game items.
|
||||
*TribufuApi* | [**GetGameServerByAddressAndQueryPort**](docs/TribufuApi.md#getgameserverbyaddressandqueryport) | **GET** /v1/servers/address/{address}:{port} | Get a game server by address and query port.
|
||||
*TribufuApi* | [**GetGameServerById**](docs/TribufuApi.md#getgameserverbyid) | **GET** /v1/servers/{id} | Get a game server by id.
|
||||
*TribufuApi* | [**GetGameServerClusterById**](docs/TribufuApi.md#getgameserverclusterbyid) | **GET** /v1/clusters/{id} | Get a game server cluster by id.
|
||||
*TribufuApi* | [**GetGameServerClusters**](docs/TribufuApi.md#getgameserverclusters) | **GET** /v1/clusters | Get a list of game server clusters.
|
||||
*TribufuApi* | [**GetGameServers**](docs/TribufuApi.md#getgameservers) | **GET** /v1/servers | Get a list of game servers.
|
||||
*TribufuApi* | [**GetGameServersByCountry**](docs/TribufuApi.md#getgameserversbycountry) | **GET** /v1/servers/country/{country} | Get a list of game servers from a country.
|
||||
*TribufuApi* | [**GetGameServersByGameId**](docs/TribufuApi.md#getgameserversbygameid) | **GET** /v1/games/{id}/servers | Get a list of game servers of a game.
|
||||
*TribufuApi* | [**GetGameServersCountries**](docs/TribufuApi.md#getgameserverscountries) | **GET** /v1/servers/countries | Get a list of countries with the number of game servers.
|
||||
*TribufuApi* | [**GetGameServersMetrics**](docs/TribufuApi.md#getgameserversmetrics) | **GET** /v1/servers/metrics | Get metrics about the tracked game servers.
|
||||
*TribufuApi* | [**GetGames**](docs/TribufuApi.md#getgames) | **GET** /v1/games | Get a list of games.
|
||||
*TribufuApi* | [**GetGroupById**](docs/TribufuApi.md#getgroupbyid) | **GET** /v1/groups/{id} | Get a group by id.
|
||||
*TribufuApi* | [**GetGroupByTag**](docs/TribufuApi.md#getgroupbytag) | **GET** /v1/groups/tag/{tag} | Get a group by tag.
|
||||
*TribufuApi* | [**GetGroupByUuid**](docs/TribufuApi.md#getgroupbyuuid) | **GET** /v1/groups/uuid/{uuid} | Get a group by uuid.
|
||||
*TribufuApi* | [**GetGroupGames**](docs/TribufuApi.md#getgroupgames) | **GET** /v1/groups/{id}/games | Get a list of games of a group.
|
||||
*TribufuApi* | [**GetGroupMembers**](docs/TribufuApi.md#getgroupmembers) | **GET** /v1/groups/{id}/members | Get a list of members in a group.
|
||||
*TribufuApi* | [**GetGroups**](docs/TribufuApi.md#getgroups) | **GET** /v1/groups | Get a list of groups.
|
||||
*TribufuApi* | [**GetIpAddress**](docs/TribufuApi.md#getipaddress) | **GET** /v1/geoip/addresses/{address} | Get a ip address location.
|
||||
*TribufuApi* | [**GetIpAddresses**](docs/TribufuApi.md#getipaddresses) | **GET** /v1/geoip/addresses | Get a list of ip addresses.
|
||||
*TribufuApi* | [**GetLeaderboard**](docs/TribufuApi.md#getleaderboard) | **GET** /v1/leaderboard | Get the top 20 leaderboard users.
|
||||
*TribufuApi* | [**GetMe**](docs/TribufuApi.md#getme) | **GET** /v1/me | Get current user information.
|
||||
*TribufuApi* | [**GetPackageById**](docs/TribufuApi.md#getpackagebyid) | **GET** /v1/packages/{id} | Get a package by id.
|
||||
*TribufuApi* | [**GetPackages**](docs/TribufuApi.md#getpackages) | **GET** /v1/packages | Get a list of packages.
|
||||
*TribufuApi* | [**GetPublicKeys**](docs/TribufuApi.md#getpublickeys) | **GET** /v1/oauth2/jwks | Get the public keys for the client.
|
||||
*TribufuApi* | [**GetSubscriptionById**](docs/TribufuApi.md#getsubscriptionbyid) | **GET** /v1/subscriptions/{id} | Get a subscription by id.
|
||||
*TribufuApi* | [**GetSubscriptions**](docs/TribufuApi.md#getsubscriptions) | **GET** /v1/subscriptions | Get a list of subscriptions.
|
||||
*TribufuApi* | [**GetUserAccounts**](docs/TribufuApi.md#getuseraccounts) | **GET** /v1/users/{id}/accounts | Get a list of connected accounts of the user.
|
||||
*TribufuApi* | [**GetUserById**](docs/TribufuApi.md#getuserbyid) | **GET** /v1/users/{id} | Get a user profile by id.
|
||||
*TribufuApi* | [**GetUserByName**](docs/TribufuApi.md#getuserbyname) | **GET** /v1/users/name/{name} | Get a user profile by name.
|
||||
*TribufuApi* | [**GetUserByUuid**](docs/TribufuApi.md#getuserbyuuid) | **GET** /v1/users/uuid/{uuid} | Get a user profile by uuid.
|
||||
*TribufuApi* | [**GetUserFriends**](docs/TribufuApi.md#getuserfriends) | **GET** /v1/users/{id}/friends | Get a list of friends of the user.
|
||||
*TribufuApi* | [**GetUserGames**](docs/TribufuApi.md#getusergames) | **GET** /v1/users/{id}/games | Get a list of games the user has played.
|
||||
*TribufuApi* | [**GetUserGroups**](docs/TribufuApi.md#getusergroups) | **GET** /v1/users/{id}/groups | Get a list of groups the user is a member of.
|
||||
*TribufuApi* | [**GetUserInfo**](docs/TribufuApi.md#getuserinfo) | **GET** /v1/oauth2/userinfo | Get current user information.
|
||||
*TribufuApi* | [**GetUserPunishments**](docs/TribufuApi.md#getuserpunishments) | **GET** /v1/users/{id}/punishments | Get a list of punishments the user has received.
|
||||
*TribufuApi* | [**GetUserServers**](docs/TribufuApi.md#getuserservers) | **GET** /v1/users/{id}/servers | Get a list of servers the user is owner of.
|
||||
*TribufuApi* | [**GetUsers**](docs/TribufuApi.md#getusers) | **GET** /v1/users | Get a list of user profiles.
|
||||
*TribufuApi* | [**HashArgon2**](docs/TribufuApi.md#hashargon2) | **POST** /v1/utils/argon2 | Hash a string using argon2.
|
||||
*TribufuApi* | [**HashBcrypt**](docs/TribufuApi.md#hashbcrypt) | **POST** /v1/utils/bcrypt | Hash a string using bcrypt.
|
||||
*TribufuApi* | [**HashMd5**](docs/TribufuApi.md#hashmd5) | **POST** /v1/utils/md5 | Hash a string using md5.
|
||||
*TribufuApi* | [**HashSha256**](docs/TribufuApi.md#hashsha256) | **POST** /v1/utils/sha256 | Hash a string using sha256.
|
||||
*TribufuApi* | [**IntrospectToken**](docs/TribufuApi.md#introspecttoken) | **POST** /v1/oauth2/introspect | Introspect a token.
|
||||
*TribufuApi* | [**Login**](docs/TribufuApi.md#login) | **POST** /v1/login | Login with name or email and password.
|
||||
*TribufuApi* | [**Logout**](docs/TribufuApi.md#logout) | **POST** /v1/logout | Invalidate credentials.
|
||||
*TribufuApi* | [**Refresh**](docs/TribufuApi.md#refresh) | **POST** /v1/refresh | Refresh credentials.
|
||||
*TribufuApi* | [**Register**](docs/TribufuApi.md#register) | **POST** /v1/register | Create a new user.
|
||||
*TribufuApi* | [**RevokeToken**](docs/TribufuApi.md#revoketoken) | **POST** /v1/oauth2/revoke | Revoke a token.
|
||||
*TribufuApi* | [**Search**](docs/TribufuApi.md#search) | **POST** /v1/search | Advanced search for servers or players.
|
||||
*TribufuApi* | [**UpdateGameServer**](docs/TribufuApi.md#updategameserver) | **PUT** /v1/servers/{id} | Update a game server.
|
||||
*TribufuApi* | [**UpdateGameServerCluster**](docs/TribufuApi.md#updategameservercluster) | **PUT** /v1/clusters/{id} | Update a game server cluster.
|
||||
*TribufuApi* | [**UpdateGroup**](docs/TribufuApi.md#updategroup) | **PUT** /v1/groups/{id} | Update a group.
|
||||
*TribufuApi* | [**UpdateUserProfile**](docs/TribufuApi.md#updateuserprofile) | **PUT** /v1/users/{id}/profile | Update a user profile.
|
||||
|
||||
|
||||
<a id="documentation-for-models"></a>
|
||||
## Documentation for Models
|
||||
|
||||
- [Model.Account](docs/Account.md)
|
||||
- [Model.Application](docs/Application.md)
|
||||
- [Model.ApplicationType](docs/ApplicationType.md)
|
||||
- [Model.AuthorizeRequest](docs/AuthorizeRequest.md)
|
||||
- [Model.CodeChallengeMethod](docs/CodeChallengeMethod.md)
|
||||
- [Model.CryptoViewModel](docs/CryptoViewModel.md)
|
||||
- [Model.Game](docs/Game.md)
|
||||
- [Model.GameServer](docs/GameServer.md)
|
||||
- [Model.GameServerCluster](docs/GameServerCluster.md)
|
||||
- [Model.GrantType](docs/GrantType.md)
|
||||
- [Model.Group](docs/Group.md)
|
||||
- [Model.GroupGame](docs/GroupGame.md)
|
||||
- [Model.GroupMember](docs/GroupMember.md)
|
||||
- [Model.GroupRank](docs/GroupRank.md)
|
||||
- [Model.HashViewModel](docs/HashViewModel.md)
|
||||
- [Model.IntrospectRequest](docs/IntrospectRequest.md)
|
||||
- [Model.IpAddress](docs/IpAddress.md)
|
||||
- [Model.LeaderboardItem](docs/LeaderboardItem.md)
|
||||
- [Model.LeaderboardOrder](docs/LeaderboardOrder.md)
|
||||
- [Model.LoginProvider](docs/LoginProvider.md)
|
||||
- [Model.LoginRequest](docs/LoginRequest.md)
|
||||
- [Model.LoginResponse](docs/LoginResponse.md)
|
||||
- [Model.Package](docs/Package.md)
|
||||
- [Model.Profile](docs/Profile.md)
|
||||
- [Model.ProfileGame](docs/ProfileGame.md)
|
||||
- [Model.ProfileGroup](docs/ProfileGroup.md)
|
||||
- [Model.RefreshRequest](docs/RefreshRequest.md)
|
||||
- [Model.RegisterRequest](docs/RegisterRequest.md)
|
||||
- [Model.ResponseType](docs/ResponseType.md)
|
||||
- [Model.RevokeRequest](docs/RevokeRequest.md)
|
||||
- [Model.SearchRequest](docs/SearchRequest.md)
|
||||
- [Model.SearchType](docs/SearchType.md)
|
||||
- [Model.ServerMetrics](docs/ServerMetrics.md)
|
||||
- [Model.ServerStatus](docs/ServerStatus.md)
|
||||
- [Model.Subscription](docs/Subscription.md)
|
||||
- [Model.TokenHintType](docs/TokenHintType.md)
|
||||
- [Model.TokenRequest](docs/TokenRequest.md)
|
||||
- [Model.TokenResponse](docs/TokenResponse.md)
|
||||
- [Model.TokenType](docs/TokenType.md)
|
||||
- [Model.UpdateProfile](docs/UpdateProfile.md)
|
||||
- [Model.UserInfo](docs/UserInfo.md)
|
||||
- [Model.UserType](docs/UserType.md)
|
||||
|
||||
|
||||
<a id="documentation-for-authorization"></a>
|
||||
## Documentation for Authorization
|
||||
|
||||
|
||||
Authentication schemes defined for the API:
|
||||
<a id="ApiKey"></a>
|
||||
### ApiKey
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: Authorization
|
||||
- **Location**: HTTP header
|
||||
This project is licensed under the [MIT License].
|
||||
|
||||
[MIT License]: https://github.com/tribufu/sdk-dotnet/blob/main/LICENSE.txt
|
||||
|
Reference in New Issue
Block a user