From 550eac1e0e67319d776ccff9190dc8d391ed0450 Mon Sep 17 00:00:00 2001 From: webb Date: Sun, 19 Jul 2020 08:10:45 -0400 Subject: [PATCH] Add readme --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..31dcb67 --- /dev/null +++ b/README.md @@ -0,0 +1,55 @@ +# 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" +"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) +```