Compare commits
No commits in common. "main" and "v1.7.11" have entirely different histories.
12 changed files with 27087 additions and 76190 deletions
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
||||||
TAG := d7203eb719304866a7eb7033ef03d421459335b8
|
TAG := master
|
||||||
|
|
||||||
schema-update:
|
schema-update:
|
||||||
curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl
|
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-tdlib
|
||||||
|
|
||||||
Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.8.0
|
Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.7.0
|
||||||
|
|
||||||
## TDLib installation
|
## TDLib installation
|
||||||
|
|
||||||
|
|
|
||||||
9087
client/function.go
9087
client/function.go
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,8 @@
|
||||||
package puller
|
package puller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
|
|
||||||
"git.zio.sh/astra/go-tdlib/client"
|
"git.zio.sh/astra/go-tdlib/client"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
//go:build darwin
|
|
||||||
// +build darwin
|
// +build darwin
|
||||||
|
|
||||||
package client
|
package client
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
//go:build libtdjson && (linux || darwin || windows)
|
|
||||||
// +build libtdjson
|
// +build libtdjson
|
||||||
// +build linux darwin windows
|
// +build linux darwin windows
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
//go:build !libtdjson && (linux || darwin)
|
|
||||||
// +build !libtdjson
|
// +build !libtdjson
|
||||||
// +build linux darwin
|
// +build linux darwin
|
||||||
|
|
||||||
|
|
|
||||||
48704
client/type.go
48704
client/type.go
File diff suppressed because it is too large
Load diff
24204
client/unmarshaler.go
24204
client/unmarshaler.go
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
|
|
@ -24,23 +25,27 @@ func main() {
|
||||||
resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/generate/scheme/td_api.tl")
|
resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/generate/scheme/td_api.tl")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("http.Get error: %s", err)
|
log.Fatalf("http.Get error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
schema, err := tlparser.Parse(resp.Body)
|
schema, err := tlparser.Parse(resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("schema parse error: %s", err)
|
log.Fatalf("schema parse error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err = http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/telegram/Td.cpp")
|
resp, err = http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/telegram/Td.cpp")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("http.Get error: %s", err)
|
log.Fatalf("http.Get error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
err = tlparser.ParseCode(resp.Body, schema)
|
err = tlparser.ParseCode(resp.Body, schema)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("parse code error: %s", err)
|
log.Fatalf("parse code error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.MkdirAll(filepath.Dir(outputFilePath), os.ModePerm)
|
err = os.MkdirAll(filepath.Dir(outputFilePath), os.ModePerm)
|
||||||
|
|
@ -48,17 +53,16 @@ func main() {
|
||||||
log.Fatalf("make dir error: %s", filepath.Dir(outputFilePath))
|
log.Fatalf("make dir error: %s", filepath.Dir(outputFilePath))
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.Create(outputFilePath)
|
file, err := os.OpenFile(outputFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("open file error: %s", err)
|
log.Fatalf("open file error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
defer file.Close()
|
|
||||||
|
|
||||||
enc := json.NewEncoder(file)
|
data, err := json.MarshalIndent(schema, "", strings.Repeat(" ", 4))
|
||||||
enc.SetIndent("", strings.Repeat(" ", 4))
|
|
||||||
err = enc.Encode(schema)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("enc.Encode error: %s", err)
|
log.Fatalf("json marshal error: %s", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
bufio.NewWriter(file).Write(data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17292
data/td_api.json
17292
data/td_api.json
File diff suppressed because it is too large
Load diff
3963
data/td_api.tl
3963
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