A Go library for pxl.blue (mirror)
Go to file
webb d5c27b28ad
Add descriptions
2020-07-19 09:09:29 -04:00
COPYING Update licence formatting so go.pkg.dev can detect it 2020-07-19 08:43:21 -04:00
README.md Add badges 2020-07-19 08:58:32 -04:00
account.go Add descriptions 2020-07-19 09:09:29 -04:00
client.go Add descriptions 2020-07-19 09:09:29 -04:00
go.mod Add module, README 2020-07-19 08:32:13 -04:00
http.go Small changes 2020-07-19 07:53:59 -04:00
upload.go Add descriptions 2020-07-19 09:09:29 -04:00

README.md

teal

godoc pkg.go.dev

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)
}