apis

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SMMS models.ImageBedCode = iota
	IMGTU
	GITEE
	GITHUB
	IPFS
)

Code for each image bed

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Only the image bed that does not provide api
	// needs to implement the login method, such as
	// "imgtu.com"
	Login(models.LoginInfo) (*models.LoginInfo, error)

	// UploadImage uploads a image to the image bed
	UploadImage(imagePath string) (string, error)

	// UploadImages uploads multiple images to the image bed
	UploadImages(imagesPath []string) ([]string, error)

	// String returns the domain name of the image bed
	String() string

	// BaseURL returns the basic url of the image bed
	BaseURL() string

	// MakeHeaders creates the header required by the image
	// bed when uploading images
	MakeHeaders(map[string]string) error

	// GetHeaders returns the header used by the image bed
	// when uploading images
	GetHeaders() http.Header

	// NewRequest creates the request needed for the image bed
	NewRequest()
	// contains filtered or unexported methods
}

func NewImageBedClient

func NewImageBedClient(config models.Config, configGile string) (Client, error)

NewImageBedClient creates a image bed client according to the configuration file

type Gitee

type Gitee struct {
	Config *models.LoginInfo
	// contains filtered or unexported fields
}

func (Gitee) BaseURL

func (g Gitee) BaseURL() string

func (Gitee) GetHeaders

func (g Gitee) GetHeaders() http.Header

func (Gitee) Login

func (g Gitee) Login(config models.LoginInfo) (*models.LoginInfo, error)

func (*Gitee) MakeHeaders

func (g *Gitee) MakeHeaders(headers map[string]string) error

func (*Gitee) NewRequest

func (g *Gitee) NewRequest()

func (Gitee) String

func (g Gitee) String() string

func (Gitee) UploadImage

func (g Gitee) UploadImage(imagePath string) (string, error)

func (Gitee) UploadImages

func (g Gitee) UploadImages(imagesPath []string) ([]string, error)

type Github

type Github struct {
	Config *models.LoginInfo
	// contains filtered or unexported fields
}

func (Github) BaseURL

func (g Github) BaseURL() string

func (Github) GetHeaders

func (g Github) GetHeaders() http.Header

func (Github) Login

func (g Github) Login(config models.LoginInfo) (*models.LoginInfo, error)

func (*Github) MakeHeaders

func (g *Github) MakeHeaders(headers map[string]string) error

func (*Github) NewRequest

func (g *Github) NewRequest()

func (Github) String

func (g Github) String() string

func (Github) UploadImage

func (g Github) UploadImage(imagePath string) (string, error)

func (Github) UploadImages

func (g Github) UploadImages(imagesPath []string) ([]string, error)

type Imgtu

type Imgtu struct {
	Config *models.LoginInfo

	ConfigFile string
	// contains filtered or unexported fields
}

func (Imgtu) BaseURL

func (i Imgtu) BaseURL() string

func (Imgtu) GetHeaders

func (i Imgtu) GetHeaders() http.Header

func (Imgtu) Login

func (i Imgtu) Login(config models.LoginInfo) (*models.LoginInfo, error)

Login gets cookies by username and password

func (*Imgtu) MakeHeaders

func (i *Imgtu) MakeHeaders(headers map[string]string) error

func (*Imgtu) NewRequest

func (i *Imgtu) NewRequest()

func (Imgtu) String

func (i Imgtu) String() string

func (Imgtu) UploadImage

func (i Imgtu) UploadImage(imagePath string) (string, error)

func (Imgtu) UploadImages

func (i Imgtu) UploadImages(imagesPath []string) ([]string, error)

type Ipfs added in v0.0.3

type Ipfs struct {
	ConfigFile string
	// contains filtered or unexported fields
}

func (Ipfs) BaseURL added in v0.0.3

func (i Ipfs) BaseURL() string

func (Ipfs) GetHeaders added in v0.0.3

func (i Ipfs) GetHeaders() http.Header

func (Ipfs) Login added in v0.0.3

func (i Ipfs) Login(models.LoginInfo) (*models.LoginInfo, error)

func (*Ipfs) MakeHeaders added in v0.0.3

func (i *Ipfs) MakeHeaders(headers map[string]string) error

func (*Ipfs) NewRequest added in v0.0.3

func (i *Ipfs) NewRequest()

func (Ipfs) String added in v0.0.3

func (i Ipfs) String() string

func (Ipfs) UploadImage added in v0.0.3

func (i Ipfs) UploadImage(imagePath string) (string, error)

func (Ipfs) UploadImages added in v0.0.3

func (i Ipfs) UploadImages(imagesPath []string) ([]string, error)

type SmMs

type SmMs struct {
	Config *models.LoginInfo

	ConfigFile string
	// contains filtered or unexported fields
}

func (SmMs) BaseURL

func (s SmMs) BaseURL() string

func (*SmMs) GetHeaders

func (s *SmMs) GetHeaders() http.Header

func (SmMs) Login

func (s SmMs) Login(config models.LoginInfo) (*models.LoginInfo, error)

func (*SmMs) MakeHeaders

func (s *SmMs) MakeHeaders(headers map[string]string) error

func (*SmMs) NewRequest

func (s *SmMs) NewRequest()

func (SmMs) String

func (s SmMs) String() string

func (SmMs) UploadImage

func (s SmMs) UploadImage(imagePath string) (string, error)

func (SmMs) UploadImages

func (s SmMs) UploadImages(imagesPath []string) ([]string, error)

Jump to

Keyboard shortcuts

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