imgur

package
v0.0.0-...-80f5753 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*oa2.API
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(authUrl string) *API

func (*API) AddAlbumToFolder

func (i *API) AddAlbumToFolder(folderId int, albumId string) (err error)

func (*API) Authorise

func (i *API) Authorise(tokenFile string) error

func (*API) CreateAlbum

func (i *API) CreateAlbum(title, description string, privacy Privacy, images []Image) (album Album, err error)

func (*API) CreateImage

func (i *API) CreateImage(name, title, description string, albumId string, imgBytes []byte) (image Image, err error)

func (*API) DeleteImage

func (i *API) DeleteImage(imageId string) (err error)

func (*API) DownloadImage

func (i *API) DownloadImage(imageLink string) (data []byte, err error)

func (*API) GetAlbumImages

func (i *API) GetAlbumImages(albumId string) (images []Image, err error)

func (*API) GetAlbums

func (i *API) GetAlbums() (albums []Album, err error)

func (*API) GetFavourites

func (i *API) GetFavourites(folderOwner string) (data []ImageOrAlbum, err error)

func (*API) GetFolderImages

func (i *API) GetFolderImages(folderOwner string, folderId int) (images []Image, err error)

func (*API) GetFolders

func (i *API) GetFolders(folderOwner string) (folders []Folder, err error)

type APIResponse

type APIResponse struct {
	Data    interface{} `json:"data"`
	Success bool        `json:"success"`
	Status  int         `json:"status"`
}

type Album

type Album struct {
	Item
	Cover       string  `json:"cover"`
	CoverHeight int     `json:"cover_height"`
	CoverWidth  int     `json:"cover_width"`
	Privacy     string  `json:"privacy"`
	Images      []Image `json:"images,omitempty"`
	ImagesCount int     `json:"images_count"`
}

type AlbumContentResponse

type AlbumContentResponse struct {
	APIResponse
	Data []Image `json:"data"`
}

type AlbumPostResponse

type AlbumPostResponse struct {
	APIResponse
	Data Album `json:"data"`
}

type AlbumsResponse

type AlbumsResponse struct {
	APIResponse
	Data []Album `json:"data"`
}

type BasicItem

type BasicItem struct {
	AccountId  int    `json:"account_id"`
	AccountUrl string `json:"account_url"`
	Id         string `json:"id"`
	Link       string `json:"link"`
}

type Folder

type Folder struct {
	BasicItem
	Id          int    `json:"id"`
	Cover       string `json:"cover_hash"`
	CoverHeight int    `json:"cover_height"`
	CoverWidth  int    `json:"cover_width"`
	CreatedAt   string `json:"created_at"`
	Name        string `json:"name"`
	Link        string `json:"link"`
	UpdatedAt   string `json:"updated_at"`
}

type FolderContentResponse

type FolderContentResponse struct {
	APIResponse
	Data []ImageOrAlbum `json:"data"`
}

type FoldersResponse

type FoldersResponse struct {
	APIResponse
	Data []Folder `json:"data"`
}

type Image

type Image struct {
	Item
	Animated   bool   `json:"animated"`
	HasSound   bool   `json:"has_sound"`
	Height     int    `json:"height"`
	Size       int    `json:"size"`
	Type       string `json:"type"`
	Width      int    `json:"width"`
	Link       string `json:"link"`
	Name       string `json:"name"`
	ParentId   string
	ParentName string
}

func (*Image) Ratio

func (i *Image) Ratio() int

type ImagePostResponse

type ImagePostResponse struct {
	APIResponse
	Data Image `json:"data"`
}

type Item

type Item struct {
	BasicItem
	CommentCount int      `json:"comment_count"`
	Datetime     int      `json:"datetime"`
	Description  string   `json:"description"`
	Downs        int      `json:"downs"`
	Favorite     bool     `json:"favorite"`
	InGallery    bool     `json:"in_gallery"`
	InMostViral  bool     `json:"in_most_viral"`
	IsAd         bool     `json:"is_ad"`
	IsAlbum      bool     `json:"is_album"`
	Nsfw         bool     `json:"nsfw"`
	Points       int      `json:"points"`
	Section      string   `json:"section"`
	Tags         []string `json:"tags"`
	Title        string   `json:"title"`
	Ups          int      `json:"ups"`
	Views        int      `json:"views"`
	Vote         string   `json:"vote"`
}

type Privacy

type Privacy string
const (
	PrivacyPublic Privacy = "public"
	PrivacyHidden Privacy = "hidden"
)

Jump to

Keyboard shortcuts

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