mirror of
https://gitea.com/webb/teal
synced 2024-08-15 03:18:56 +00:00
A Go library for pxl.blue (mirror)
account.go | ||
client.go | ||
COPYING | ||
go.mod | ||
http.go | ||
README.md | ||
upload.go |
teal
This is a simple library for pxl.blue, an image hosting site. Consider this library extremely unstable as pxl.blue and this library are still very early in development.
Examples
Uploading a file using your username and password
import (
"fmt"
"os"
"gitea.com/webb/teal"
)
func main() {
client, _ := teal.Login("username", "password")
file, _ := os.Open("glenda.png")
image, _ := client.UploadFile(file, "glenda.png")
fmt.Println(image)
}
Getting an upload key with username and password
package main
import (
"fmt"
"gitea.com/webb/teal"
)
func main() {
client, _ := teal.Login("username", "password")
fmt.Println(client.UploadKey)
}
Manually creating a barebones client and uploading a file
import (
"fmt"
"os"
"gitea.com/webb/teal"
)
func main() {
client := teal.Client{
UserAgent: "teal",
UploadKey: "key",
}
file, _ := os.Open("glenda.png")
url, _ := client.UploadFile(file, "glenda.png")
fmt.Println(url)
}