• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

NicolasConstant/mastodon.NET: Mastodon API Wrapper in C# .NET

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

NicolasConstant/mastodon.NET

开源软件地址(OpenSource Url):

https://github.com/NicolasConstant/mastodon.NET

开源编程语言(OpenSource Language):

C# 100.0%

开源软件介绍(OpenSource Introduction):

mastodon.NET

Mastodon API Wrapper in C# .NET

Still work in progress, insights and pull requests welcome!

Install

Find it on Nuget

Install-Package Mastodon 

Current state

As most other mastodon .NET wrappers aren't working anymore, this lib is 100% functionnal for the set of API functionnalities it covers at the date of 09 June 2018.

API coverage

[WIP]

How to

Register app

using(var appHandler = new AppHandler("InstanceName")){
    var scopes = AppScopeEnum.Read | AppScopeEnum.Write | AppScopeEnum.Follow;
    var appData = await appHandler.CreateAppAsync("MyAppName", scopes, "ProjectUri");
}

See scope definition

Retrieve OAuth Token per email/password

using(var authHandler = new AuthHandler("InstanceName")){
    var tokenInfo = await authHandler.GetTokenInfoAsync("ClientId", "ClientSecret", "UserEmail", "UserPassword", AppScopeEnum.Read);
}

Retrieve OAuth Token per Oauth Code Workflow

using(var authHandler = new AuthHandler("InstanceName")){
    var oauthCodeUrl = authHandler.GetOauthCodeUrl("ClientId", AppScopeEnum.Read);
    
    //Open browser/gui to open the oauth url and retrieve the oauth code
    var code = GetCodeFromBrowser(oauthCodeUrl);
    
    var tokenInfo = await authHandler.GetTokenInfoAsync("ClientId", "ClientSecret", code);
}

Access API via Client

using(var client = new MastodonClient("InstanceName")){
    var timeline = await client.GetHomeTimelineAsync("access_token");
}

See Mastodon API

Author

Nicolas Constant (mastodon)

License

mastodon.NET is available under the MIT license. See the LICENSE file for more info.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
philgyford/samuelpepys-twitter: Python script to publish timed tweets发布时间:2022-08-17
下一篇:
kawax/socialite-mastodon发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap