Giter VIP home page Giter VIP logo

misskey-rs's Introduction

misskey-rs

crates.io docs.rs CI

misskey-rs is an asynchronous Misskey client library for Rust.

use misskey::prelude::*;
use misskey::HttpClient;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
  let client = HttpClient::builder("https://your.instance.example/api/")
      .token("API_TOKEN")
      .build()?;

  client.create_note("Hello, Misskey").await?;

  Ok(())
}

Take a look at the example directory for more examples.

Usage

Add the following to your Cargo.toml:

[dependencies]
misskey = { version = "0.3.0-rc.1", features = ["12-75-0"] }

To run the example above, you will need to add the following dependencies:

tokio = { version = "1.0", features = ["full"] }
anyhow = "1.0"

See the API documentation for further details.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

misskey-rs's People

Contributors

coord-e avatar dependabot[bot] avatar github-actions[bot] avatar poppingmoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

misskey-rs's Issues

Recognize pack parameters in model types

Some of the current model types are based on the "packed" representation in misskey.
There are pack functions that take parameters, and the form of the packed representation returned depends on the parameter.

https://github.com/syuilo/misskey/blob/ec4d5857d80938758ce64930159be2c941d4e30f/src/models/repositories/user.ts#L147-L154

Currently, we do not take these parameters into account, and we deal with it by using Option to fields that depends on the parameter. Since this approach misses quite a lot of invariants, it is expected to introduce a model type that statically considers the pack parameter.

/api/chart/active_users response has changed after misskey 12.104.0

ref: https://github.com/misskey-dev/misskey/blob/5f985ee832eed61e31ceb51eaa1c51810ad6de39/packages/backend/src/services/chart/charts/active-users.ts#L26-L36

before:

{
  local: {
    users: number[],
  },
  remote: {
    users: number[],
  },
}

after:

{
  readWrite: number[],
  read: number[],
  write: number[],
  registeredWithinWeek: number[],
  registeredWithinMonth: number[],
  registeredWithinYear: number[],
  registeredOutsideWeek: number[],
  registeredOutsideMonth: number[],
  registeredOutsideYear: number[]
}

get_note from a string (or an example in general)

I'm sorry if this is an obvious question and not even really a bug report but there must be something I'm missing (especially because I don't use misskey).

I'm making a site that generates embeds for Mastodon, Pleroma, and Misskey, for Discord, and Misskey could very much benefit from it seeing as its embeds don't even show the post contents at all. The library I chose doesn't seem to support misskey and it would be a large undertaking for it to do so, and an equally large undertaking would be dealing with ActivityPub which would seemingly be just as hard as just supporting the sites individually, so i'd like to use this in conjunction with it.

What I'm missing is:

If I have https://misskey.bubbletea.dev/notes/8s27fg0gok, 8s27fg0gok being the id, and the usage for get_note is get_note(&self, Id<Post>), and all the implementations for Id can only have numbers fields...how am I supposed to get the note from that id?

If nothing else it would be nice to see an example for get_note in the docs.

Support for additional Calckey API endpoints

Calckey adds a few new endpoints to Misskey, most notably the recommended timeline. It can be called in the exact same way the social/local/global timelines can, and instances have a recommendedTimelineEnabled property.

Symmetric API Testing

  • Save API responses and use it for testing
  • This can bring back per-version / ID method misskey-api testing to the stable CI

Hide fields of ID structs

Currently Aid, Meid and ObjectId exposes their (parsed) fields publicly. If we can stop exposing them we can rely on the format of string representation to limit the range of these fields (currently datetime method can panic if their values are constructed directly c5de018). This is a breaking change.

Enable to paginate endpoints under charts/

Currently, misskey-util implements pagination with an endpoint that takes a pagination parameter and returns an array (i.e. Vec). charts/ endpoint differs from the others in that the response is not a single array, but is divided into several fields, so pagination with misskey-util is currently not supported.

Duplicate streams to "shouldShare" channels

You can't have more than two connections to the "shouldShare" channel.

https://github.com/syuilo/misskey/blob/572e475b394aab0fd752783da8648b4f096653fd/src/server/api/stream/index.ts#L220-L222

Quoting the current behavior from the documentation:

Note that currently it is not possible to have multiple connections to the main stream from the same client. If you try to do so, the Future returned by this method will not complete.

This is an inconvenient and confusing behavior for a library. It is expected that the implementation will make the connection the first time and reuse it for the second and subsequent connections.

Unresolved questions

  • Where to implement:
    • misskey-websocket: Almost looks good, but feel like the obligation (to duplicate the connection) is misplaced
    • misskey-util: We may need to stop using the extension trait, which is undesirable

Implement ApiErrorId with Uuid

ApiErrorId is just a newtype of String.

pub struct ApiErrorId(pub String);

However, it seems that Misskey's error ID is actually a UUID.
Implementing ApiErrorID with Uuid has a big advantage, especially in terms of the ability to create constants.
It would be very useful to have known error IDs as constants.

Unresolved questions

  • Are all Misskey's error IDs UUID?
  • Where to implement error ID constants?

Stop including the version flag in the default feature set

Currently, The latest version flag is enabled as a default.

The latest one (12-63-0) is enabled as a default.

This way would force users who specify a version flag to specify default-features = false and enumerate other flags that have nothing to do with the version specification. It could also lead to frequent breaking changes, as the default behavior changes whenever the version of Misskey supported by misskey-rs is increased.

So, it is better to stop including the version flag in the default feature set and tell users to enable the flag for the corresponding version additionally in the documentation.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.