imgur

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	Imgur      Imgur
}

func (*Client) DeleteImageAuthed

func (client *Client) DeleteImageAuthed(id string) (*ImageInfoWithoutData, int, error)

func (*Client) DeleteImageUnAuthed

func (client *Client) DeleteImageUnAuthed(hash string) (*ImageInfoWithoutData, int, error)

func (*Client) UploadImage

func (client *Client) UploadImage(img string, dtype string, album string) (*ImageInfoData, int, error)

Upload Image to Imgur

func (*Client) UploadImageFromFile

func (client *Client) UploadImageFromFile(path string, album string) (*ImageInfoData, int, error)

Upload Image to Imgur by File

func (*Client) UploadImageFromURL

func (client *Client) UploadImageFromURL(imgUrl string, album string) (*ImageInfoData, int, error)

Upload Image to Imgur by URL

type ImageInfo

type ImageInfo struct {
	// Imgur img ID e.g. abcde123098
	ID string `json:"id"`
	// ID with extention e.g. abcde123098.png
	IDExt string
	// Image Title
	Title string `json:"title"`
	// Image Description
	Description string `json:"description"`
	// Image Upload Datetime
	Datetime int `json:"datetime"`
	// Type Format
	MimeType string `json:"type"`
	// Image is animated?
	Animated bool `json:"animated"`
	// Image width
	Width int `json:"width"`
	// Image height
	Height int `json:"height"`
	// Image File Size
	Size int `json:"size"`
	// Image Views
	Views int `json:"views"`
	// Imgur Bandwidth
	Bandwidth int `json:"bandwidth"`
	// Imgur Delete Hash
	Deletehash string `json:"deletehash,omitempty"`
	// The name of the file
	Name    string `json:"name,omitempty"`
	Section string `json:"section"`
	// Image URL e.g. https://i.imgur.com/abcde123098.png
	Link     string `json:"link"`
	Gifv     string `json:"gifv,omitempty"`
	Mp4      string `json:"mp4,omitempty"`
	Mp4Size  int    `json:"mp4_size,omitempty"`
	Looping  bool   `json:"looping,omitempty"`
	Favorite bool   `json:"favorite"`
	// Image is Nsfw?
	Nsfw      bool   `json:"nsfw"`
	Vote      string `json:"vote"`
	InGallery bool   `json:"in_gallery"`
}

type ImageInfoData

type ImageInfoData struct {
	// Image Info
	Data *ImageInfo `json:"data"`
	// Action successfully performed?
	Success bool `json:"success"`
	// Imgur HTTP Code
	Status int `json:"status"`
}

type ImageInfoWithoutData

type ImageInfoWithoutData struct {
	// Action successfully performed?
	Success bool `json:"success"`
	// Imgur HTTP Code
	Status int `json:"status"`
}

type Imgur

type Imgur struct {
	// Imgur Client-ID
	ClientID string
	// Imgur Bearer Token
	AccessToken string
}

Jump to

Keyboard shortcuts

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