uploader

package module
v0.0.0-...-10cb234 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2022 License: MIT Imports: 8 Imported by: 1

README

1. Go Uploader

Go Report Card PkgGoDev

1.1. What is this for

Uploader can upload files with in one line command and give back respond struct decoded.

1.2. Why

For people don't wanna rewrite upload code for them selfs and make things faster.

1.3. Usage

resp ,err := uploader.Upload(uploader.BayFiles, file)
fmt.Println(resp.Data.File.Url) 

or

resp ,err := uploader.Upload(uploader.AnonFiles, file)
fmt.Println(resp.Data.File.Url) 

1.4. All Durations

Sites URL Package
AnonFiles AnonFiles Uploader
BayFiles BayFiles Uploader

1.5. Credit

ElecTwix

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	File File   `json:"file"`
	Type string `json:"type"`
}

type ErrorRespond

type ErrorRespond struct {
	Message string `json:"message"`
	Type    string `json:"type"`
}

type File

type File struct {
	Url      url      `json:"url"`
	MetaData MetaData `json:"metadata"`
}

type MetaData

type MetaData struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Respond

type Respond struct {
	Status bool         `json:"status"`
	Error  ErrorRespond `json:"error,omitempty"`
	Data   Data         `json:"data,omitempty"`
}

func Upload

func Upload(url Site, file *os.File) (*Respond, error)

type Site

type Site string
const (
	AnonFiles Site = "https://api.anonfiles.com/upload"
	BayFiles  Site = "https://api.bayfiles.com/upload"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL