在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):DeeUnderscore/elefren开源软件地址(OpenSource Url):https://github.com/DeeUnderscore/elefren开源编程语言(OpenSource Language):Rust 99.9%开源软件介绍(OpenSource Introduction):NOTICEThis repository (https://github.com/DeeUnderscore/elefren) was originally a Github fork of https://github.com/pwoolcoc/elefren. The upstream repository was deleted at some point prior to August 2021. I, the owner of this repository, do not know why the upstream was deleted; I am not in contact with the (former) maintainer of the upstream repository. This repository is not intended as a continuation of the project, and contains the upstream history up to a certain point incidentally. The links below still work, as of September 2021, and as such it should be possible to use Elefren via Cargo. Original README follows. ElefrenA Wrapper for the Mastodon API.A wrapper around the API for Mastodon InstallationTo add elefren = "0.22" ExampleIn your [dependencies]
elefren = { version = "0.22", features = ["toml"] } // src/main.rs
extern crate elefren;
use std::error::Error;
use elefren::prelude::*;
use elefren::helpers::toml; // requires `features = ["toml"]`
use elefren::helpers::cli;
fn main() -> Result<(), Box<dyn Error>> {
let mastodon = if let Ok(data) = toml::from_file("mastodon-data.toml") {
Mastodon::from(data)
} else {
register()?
};
let you = mastodon.verify_credentials()?;
println!("{:#?}", you);
Ok(())
}
fn register() -> Result<Mastodon, Box<dyn Error>> {
let registration = Registration::new("https://mastodon.social")
.client_name("elefren-examples")
.build()?;
let mastodon = cli::authenticate(registration)?;
// Save app data for using on the next run.
toml::to_file(&*mastodon, "mastodon-data.toml")?;
Ok(mastodon)
} It also supports the Streaming API:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论