https://github.com/glatrix/tfd-api-sdk
An unofficial dotnet / csharp SDK for The First Descendant API
https://github.com/glatrix/tfd-api-sdk
nexon-openapi nexonstudio tfa thefirstdescendant
Last synced: 14 days ago
JSON representation
An unofficial dotnet / csharp SDK for The First Descendant API
- Host: GitHub
- URL: https://github.com/glatrix/tfd-api-sdk
- Owner: Glatrix
- License: mit
- Created: 2024-07-14T05:40:54.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-14T06:00:02.000Z (almost 2 years ago)
- Last Synced: 2025-02-25T05:31:58.037Z (over 1 year ago)
- Topics: nexon-openapi, nexonstudio, tfa, thefirstdescendant
- Language: C#
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# The First Descendant API SDK
An Unofficial dotnet / csharp SDK for [Nexon's OpenAPI for The First Descendant](https://openapi.nexon.com/game/tfd/?id=20)
Work In Progress. Feel free to make pull requests to improve. Example code worked for me :)
Credit To [FraWolf's Typescript Version](https://github.com/FraWolf/tfd-api) for some of the models
```csharp
using TfdApiSDK;
using TfdApiSDK.Models.General;
using TfdApiSDK.Models.Account;
using TfdApiSDK.Models.Game;
using System.Web;
using System.Text.Json;
namespace YourApp
{
internal class Program
{
private const string KEY = "test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
private const string USERNAME = "User#1234";
static async Task Main(string[] args)
{
APIClient client = new TfdApiSDK.APIClient(KEY, throwOnSdkError: true);
// MetaData API
//APIResponse? DescendantMetadata = await client.metadataAPI.GetDescendantMetadata();
//APIResponse? WeaponMetadata = await client.metadataAPI.GetWeaponMetadata();
APIResponse? ModuleMetadata = await client.metadataAPI.GetModuleMetadata();
//APIResponse? ReactorMetadata = await client.metadataAPI.GetReactorMetadata();
//APIResponse? ExternalComponentMetadata = await client.metadataAPI.GetExternalComponentMetadata();
//APIResponse? RewardMetadata = await client.metadataAPI.GetRewardMetadata();
//APIResponse? StatMetadata = await client.metadataAPI.GetStatMetadata();
//APIResponse? VoidBattleMetadata = await client.metadataAPI.GetVoidBattleMetadata();
//APIResponse? TitleMetadata = await client.metadataAPI.GetTitleMetadata();
// Account API
APIResponse? UserOUID = await client.accountAPI.GetUserOUID(USERNAME);
string? ouid = UserOUID?.Value.ouid;
if(ouid is null) { return; }
APIResponse? UserBasicInfo = await client.accountAPI.GetUserBasicInfo(ouid);
APIResponse? UserDescendantInfo = await client.accountAPI.GetUserDescendantInfo(ouid);
APIResponse? UserWeaponInfo = await client.accountAPI.GetUserWeaponInfo(ouid);
APIResponse? UserReactorInfo = await client.accountAPI.GetUserReactorInfo(ouid);
APIResponse? UserExternalComponent = await client.accountAPI.GetUserExternalComponent(ouid);
string? descendant_id = UserDescendantInfo?.Value.descendant_id;
string? weapon_id = UserWeaponInfo?.Value.weapon[0].weapon_id; // first (top slot) weapon ID
string? void_battle_id = "651000001"; // Grave Walker
QueryPeriod period = QueryPeriod.Last7Days;
if (descendant_id is null || weapon_id is null || void_battle_id is null) { return; }
APIResponse? RecommendationModule =
await client.accountAPI.GetRecommendationModule(descendant_id, weapon_id, void_battle_id, period);
if(RecommendationModule?.Value.descendant.recommendation.Length == 0) { return; }
string? module_id = RecommendationModule?.Value.descendant.recommendation[0].module_id;
string? module_name = ModuleMetadata?.Value.FirstOrDefault((mod) => mod.module_id == module_id)?.module_name;
Console.WriteLine($"The Module You Should Pick Is: {module_name ?? "N/A"}");
}
}
}
```