A Go library for pxl.blue (mirror)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
webb 3f20e9824d
Update license year
1 month ago
COPYING Update license year 1 month ago
README.md Change wording of example 2 months ago
account.go Add descriptions 2 months ago
client.go Add descriptions 2 months ago
go.mod Add module, README 2 months ago
http.go Small changes 2 months ago
upload.go Add descriptions 2 months ago

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

Logging in, and uploading a file

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