Update more docs.
Syfaro syfaro@huefox.com
Fri, 20 Aug 2021 16:23:38 -0400
1 files changed,
8 insertions(+),
6 deletions(-)
M
docs/internals/adding-endpoints.md
→
docs/internals/adding-endpoints.md
@@ -19,7 +19,8 @@ MessageID int
} ``` -What type should `ChatID` be? Telegram allows specifying numeric chat IDs or channel usernames. Golang doesn't have union types, and interfaces are entirely +What type should `ChatID` be? Telegram allows specifying numeric chat IDs or +channel usernames. Golang doesn't have union types, and interfaces are entirely untyped. This library solves this by adding two fields, a `ChatID` and a `ChannelUsername`. We can now write the struct as follows.@@ -103,8 +104,8 @@ type DeleteMessageConfig struct {
ChannelUsername string ChatID int64 MessageID int -+ Delete interface{} -+ Thumb interface{} ++ Delete RequestFileData ++ Thumb RequestFileData } ```@@ -115,13 +116,13 @@ ```go
func (config DeleteMessageConfig) files() []RequestFile { files := []RequestFile{{ Name: "delete", - File: config.Delete, + Data: config.Delete, }} if config.Thumb != nil { files = append(files, RequestFile{ Name: "thumb", - File: config.Thumb, + Data: config.Thumb, }) }@@ -129,7 +130,8 @@ return files
} ``` -And now our files will upload! It will transparently handle uploads whether File is a string with a path to a file, `FileURL`, `FileBytes`, `FileReader`, or `FileID`. +And now our files will upload! It will transparently handle uploads whether File +is a `FilePath`, `FileURL`, `FileBytes`, `FileReader`, or `FileID`. ### Base Configs