https://github.com/nicolasconstant/mastodon.net
Mastodon API Wrapper in C# .NET
https://github.com/nicolasconstant/mastodon.net
Last synced: about 1 year ago
JSON representation
Mastodon API Wrapper in C# .NET
- Host: GitHub
- URL: https://github.com/nicolasconstant/mastodon.net
- Owner: NicolasConstant
- License: mit
- Created: 2017-04-07T00:27:55.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-25T15:05:46.000Z (almost 8 years ago)
- Last Synced: 2025-05-08T21:16:15.364Z (about 1 year ago)
- Language: C#
- Size: 109 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mastodon.NET
[Mastodon](https://github.com/tootsuite/mastodon) API Wrapper in C# .NET
Still work in progress, insights and pull requests welcome!
## Install
Find it on [Nuget](https://www.nuget.org/packages/Mastodon/0.1.0)
```
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
```csharp
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](https://github.com/tootsuite/documentation/blob/master/Using-the-API/OAuth-details.md)
Retrieve OAuth Token per email/password
```csharp
using(var authHandler = new AuthHandler("InstanceName")){
var tokenInfo = await authHandler.GetTokenInfoAsync("ClientId", "ClientSecret", "UserEmail", "UserPassword", AppScopeEnum.Read);
}
```
Retrieve OAuth Token per Oauth Code Workflow
```csharp
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
```csharp
using(var client = new MastodonClient("InstanceName")){
var timeline = await client.GetHomeTimelineAsync("access_token");
}
```
See [Mastodon API](https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md)
## Author
Nicolas Constant ([mastodon](https://mastodon.partipirate.org/@NicolasConstant))
## License
mastodon.NET is available under the MIT license. See the LICENSE file for more info.