Skip to content

Latest commit

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

TDSharp

TDSharp - .NET bindings for TDLib (Telegram Database Library) JSON API: https://github.com/tdlib/td

  • Generated API bindings
  • .NET Core and .NET Standard support

Installation

Install via NuGet: TDLib

NuGet

Dependencies

Build TDLib and put the compiled library into your project's output directory

  • tdjson.dll (Windows)
  • libtdjson.dylib (MacOS)
  • libtdjson.so (Linux)

Simple example

Client is a wrapper around native JSON API. Use it to send/receive data as strings.

usingTD;// create clientvarclient=newClient();// sending dataclient.Send(json);// synchronous executionvarresult=client.Execute(json);// receiving datawhile(true){result=cient.Receive(timeout);}

Using generated APIs

Lib contains classes for API types and methods. It handles json serialization/deserialization behind the scenes. Use Hub to subscribe to events. Use Dialer to asynchronously call methods.

usingTD;// receiving datavarhub=newHub(client);hub.Received+= data =>{if(dataisOk){// do something}elseif(dataisError){// handle error}}// asynchronous executionvardialer=newDialer(client,hub);varok=awaitdialer.ExecuteAsync(newSetAuthenticationPhoneNumber{PhoneNumber=phoneNumber});

About

.NET bindings for TDLib (Telegram JSON API)

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages