toxicafunk / rtdlib

TDLib for rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rtdlib

Build Status

rtdlib is td for rust.

rtdlib crate have td type (classes).

Usage

[dependencies]
rtdlib = "0.7.*"

The default, rtdlib only have td types, not have call tdjson dylib, if you want , you need add features to your dependency.

[dependencies]
rtdlib = { version = "0.7.*", features = "sys" }

version

Version mapping

rtdlib td
0.* master
1.3.* 1.3.*
1.4.* 1.4.*
1.5.* 1.5.*
1.6.* 1.6.*
1.7.* 1.7.*

The version 1.3, 1.4, 1.5, 1.6, 1.7 is outdated. the reason you can read

Therefore, if tdlib has not had a new release version, the rtdlib 1.x version will no longer be maintained. Please use 0.x and if you used 1.x you can change your dependency to 0.x.

Example

types

let json = r#"{"@type":"updateAuthorizationState","authorization_state":{"@type":"authorizationStateWaitTdlibParameters"}}"#;
let state: UpdateAuthorizationState = serde_json::from_str(&json[..]).expect("Json fail");
assert_eq!("updateAuthorizationState", state.td_name());
let rjson = state.to_json();
assert!(rjson.is_ok(), true);
assert_eq!(json, rjson.unwrap());

tdjson

If you enable sys features, you can use Tdlib to call tdjson dylib.

use rtdlib::Tdlib;
let tdlib = Tdlib::new();
let request = r#"{"@type": "getMe"}"#;
tdlib.send(request);

td

More document you need check telegram api

About

TDLib for rust

License:Other


Languages

Language:Rust 100.0%