Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc00c91b86 | |||
| 1e5d43121b | |||
| 6a7433c67c | |||
| ac75624c63 |
8 changed files with 84171 additions and 40115 deletions
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
|||
TAG := 054a823c1a812ee3e038f702c6d8ba3e6974be9c
|
||||
TAG := d7203eb719304866a7eb7033ef03d421459335b8
|
||||
|
||||
schema-update:
|
||||
curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# go-tdlib
|
||||
|
||||
Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.7.0
|
||||
Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.8.0
|
||||
|
||||
## TDLib installation
|
||||
|
||||
|
|
|
|||
7936
client/function.go
7936
client/function.go
File diff suppressed because it is too large
Load diff
68713
client/type.go
68713
client/type.go
File diff suppressed because it is too large
Load diff
29697
client/unmarshaler.go
29697
client/unmarshaler.go
File diff suppressed because it is too large
Load diff
|
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"log"
|
||||
|
|
@ -25,27 +24,23 @@ func main() {
|
|||
resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/generate/scheme/td_api.tl")
|
||||
if err != nil {
|
||||
log.Fatalf("http.Get error: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
schema, err := tlparser.Parse(resp.Body)
|
||||
if err != nil {
|
||||
log.Fatalf("schema parse error: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err = http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/telegram/Td.cpp")
|
||||
if err != nil {
|
||||
log.Fatalf("http.Get error: %s", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
err = tlparser.ParseCode(resp.Body, schema)
|
||||
if err != nil {
|
||||
log.Fatalf("parse code error: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(outputFilePath), os.ModePerm)
|
||||
|
|
@ -53,16 +48,17 @@ func main() {
|
|||
log.Fatalf("make dir error: %s", filepath.Dir(outputFilePath))
|
||||
}
|
||||
|
||||
file, err := os.OpenFile(outputFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm)
|
||||
file, err := os.Create(outputFilePath)
|
||||
if err != nil {
|
||||
log.Fatalf("open file error: %s", err)
|
||||
return
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
data, err := json.MarshalIndent(schema, "", strings.Repeat(" ", 4))
|
||||
enc := json.NewEncoder(file)
|
||||
enc.SetIndent("", strings.Repeat(" ", 4))
|
||||
err = enc.Encode(schema)
|
||||
if err != nil {
|
||||
log.Fatalf("json marshal error: %s", err)
|
||||
return
|
||||
log.Fatalf("enc.Encode error: %s", err)
|
||||
|
||||
}
|
||||
bufio.NewWriter(file).Write(data)
|
||||
}
|
||||
|
|
|
|||
14774
data/td_api.json
14774
data/td_api.json
File diff suppressed because it is too large
Load diff
3142
data/td_api.tl
3142
data/td_api.tl
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue