MisskeySharp 0.23.7.102

There is a newer version of this package available.
See the version list below for details.
dotnet add package MisskeySharp --version 0.23.7.102                
NuGet\Install-Package MisskeySharp -Version 0.23.7.102                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MisskeySharp" Version="0.23.7.102" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MisskeySharp --version 0.23.7.102                
#r "nuget: MisskeySharp, 0.23.7.102"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MisskeySharp as a Cake Addin
#addin nuget:?package=MisskeySharp&version=0.23.7.102

// Install MisskeySharp as a Cake Tool
#tool nuget:?package=MisskeySharp&version=0.23.7.102                

MisskeySharp

What's this ?

MisskeySharp is a client library for .NET applications to utilize Misskey.

<span style="color: gray;">This library is not an official offering by the Misskey developers.</span>

Example

The usage examples are as follows:

Get a new access token with "MiAuth"

Step 1: Get a URL for authorize app page
We will prepare to obtain the access token using "MiAuth".

var misskey = new MisskeyService("https://misskey.io/");
var authUri = misskey.GetAuthorizeUri(
                    "サンプル (my app) " + DateTime.Now.ToString("yyyyMMdd-HHmmsss-fff"),
                    "https://www.a32kita.net/favicon.ico",
                    "https://dummy.a32kita.net/callback",
                    MisskeyPermissions.Write_notes | MisskeyPermissions.Read_account);

In MiAuth, you can use any value for the GetAuthorizeUri() parameter because it allows you to set the application name, icon, and callback URL during access token acquisition.

Step 2: After the user approves the application in the browser, obtain the access token

await misskey.AuthorizeWithAuthorizeUriAsync(authUri);

// misskey.AccessToken: "98eY****************************"; <= Access Token

The obtained access token will be stored in the AccessToken property.

Authenticate with the already obtained access token

If the initially obtained access token is being recorded, user approval will not be required from the second time onwards.

await misskey.AuthorizeWithAccessTokenAsync("98eY****************************");

Post a note

We will post a new note. In the following example, we will post a note with the content 'hello, world!!' to the timeline for followers.

await misskey.Notes.Create(new Note()
            {
                Text = "hello, world!!",
                Visibility = "followers",
            });
Console.WriteLine("Completed: {0}", resp.CreatedNote.Id);

For the parameters specified here, please refer to the official documentation:
https://misskey-hub.net/docs/api/endpoints/notes/create.html

Retrieve a list of followed users

Retrieve a list of followed users by specifying the user ID.

<details> <summary>Example code</summary>

var resp = await misskey.Users.Following(new UsersFollowingFollowersQuery()
                {
                    UserId = "9arwh5oymn",
                });

Console.WriteLine("Following list;");
foreach (var follow in resp)
{
    Console.WriteLine(" {0} | {1}", follow.Followee.Username.PadRight(20), follow.Followee.Name);
}

</details>

Receiving a timeline through the streaming API

Using the Streaming API to receive the timeline in real-time. Events will be triggered upon receiving new notes.

<details> <summary>Example code</summary> Notice: This feature is currently under verification and there is a possibility of significant specification changes in the future

var noteReceived = new Action<MisskeyNoteReceivedEventArgs>(e =>
{
    var note = e.NoteMessage.Body.Body;
    if (note == null)
        return;

    var rn = note.Renote != null;
    if (rn)
        note = note.Renote;

    Console.WriteLine("R {0}: (@{1}) {2}", rn ? "RENOTE" : "NORMAL", note?.User?.Username, note?.Text);
});

misskey.Streaming.NoteReceived += (sender, e) => noteReceived(e);

var st = misskey.Streaming.Connect(MisskeyStreamingChannels.HybridTimeline);
                
Console.ReadLine();
misskey.Streaming.Disconnect(st);

</details>

Install

Now available on NuGet

NuGet\Install-Package MisskeySharp

Platform

MisskeySharp is designed for .NET Standard 2.0, making it available for a wide range of .NET applications.

Please refer to Microsoft's documentation for information on the targets that can apply .NET Standard 2.0 libraries:
https://learn.microsoft.com/ja-jp/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-version

Dependencies

If you are using MisskeySharp via NuGet, it will be automatically installed.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.23.9.309 260 9/3/2023
0.23.9.301-alpha-370326a0b 105 9/2/2023
0.23.9.223-alpha-471443c9c 106 9/2/2023
0.23.7.102 168 6/30/2023
0.23.6.2823-beta-400757319 142 6/28/2023
0.23.6.2815-alpha-342973536 129 6/28/2023
0.23.6.2720 154 6/27/2023
0.23.6.2713 147 6/27/2023
0.23.6.26 151 6/26/2023