在我们日常开发工作中对接第三方开放平台,找一款封装完善且全面的SDK能够大大的简化我们的开发难度和提高工作效率。今天给大家推荐一款C#开源、功能完善的字节跳动SDK:SKIT.FlurlHttpClient.ByteDance。
可能是全网唯一的 C# 版字节跳动 SDK,封装全部已知的字节跳动 API,包含字节小程序开放平台、抖音开放平台、抖店开放平台、巨量引擎开放平台、TikTok Developer、TikTok Shop Open Platform 等模块,可跨平台,持续随官方更新。
字节小程序开放平台(小程序、小游戏)、抖音开放平台、巨量引擎开放平台(头条广告)、TikTok Developer、TikTok Shop Open Platform等。
提示:如果你使用 Visual Studio NuGet 管理器图形化界面,请在搜索结果中勾选“包括预发行版”。
# 通过 NuGet 安装
> Install-Package SKIT.FlurlHttpClient.ByteDance.DouyinOpen
或
# 通过 dotnet-tools 安装
> dotnet add package SKIT.FlurlHttpClient.ByteDance.DouyinOpen
using SKIT.FlurlHttpClient.ByteDance.DouyinOpen;
var options = new DouyinOpenClientOptions()
{
ClientKey = "抖音开放平台应用Key",
ClientSecret = "抖音开放平台应用密钥"
};
var client = new DouyinOpenClient(options);
using SKIT.FlurlHttpClient.ByteDance.DouyinOpen;
using SKIT.FlurlHttpClient.ByteDance.DouyinOpen.Models;
/* 以获取用户信息接口为例 */
var request = new OAuthUserInfoRequest()
{
AccessToken = "抖音开放平台的AccessToken",
OpenId = "用户唯一标识"
};
var response = await client.ExecuteOAuthUserInfoAsync(request);
if (response.IsSuccessful())
{
Console.WriteLine("昵称:" + response.Data.Nickname);
Console.WriteLine("头像:" + response.Data.AvatarUrl);
}
else
{
Console.WriteLine("错误代码:" + response.Extra?.ErrorCode);
Console.WriteLine("错误描述:" + response.Extra?.ErrorDescription);
}
更多项目实用功能和特性欢迎前往项目开源地址查看👀,别忘了给项目一个Star支持💖。
https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.ByteDance