bing

package
v0.0.0-...-08b44c8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bing provides a simple way to access bing API.

Index

Constants

This section is empty.

Variables

View Source
var ErrRequestFailed = errors.New("request failed")

ErrRequestFailed indicates a general error in service request.

Functions

This section is empty.

Types

type Bing

type Bing struct {
	N      int
	Index  int
	Path   string
	Prefix string
	Client *resty.Client
}

Bing image provider based on daily wallpaper on bing.

func New

func New(count int, index int, path string) *Bing

func (*Bing) Fetch

func (b *Bing) Fetch() error

Fetch images from bing daily wallpaper.

func (*Bing) Store

func (b *Bing) Store(name string, content io.ReadCloser)

type HS

type HS struct {
	Description string `json:"desc"`
	Link        string `json:"link"`
}

HS structure ...

type Image

type Image struct {
	StartDate     string   `json:"startdate"`
	FullStartDate string   `json:"fullstartdate"`
	EndDate       string   `json:"enddate"`
	URL           string   `json:"url"`
	URLBase       string   `json:"urlbase"`
	Copyright     string   `json:"copyright"`
	CopyrightLink string   `json:"copyrightlink"`
	Wallpaper     bool     `json:"wp"`
	Hash          string   `json:"hsh"`
	Drk           int      `json:"drk"`
	Top           int      `json:"top"`
	Bot           int      `json:"bot"`
	HS            []HS     `json:"hs"`
	Msg           []string `json:"msg"`
}

Image structure stores bing image information.

type Request

type Request struct {
	Format string `url:"format"`
	Index  int    `url:"idx"`
	Number int    `url:"n"`
	Mkt    string `url:"mkt"`
}

Request structure stores bing api request to json.

type Response

type Response struct {
	Images  []Image `json:"images"`
	Tooltip Tooltip `json:"tooltip"`
}

Response structure stores bing api response from json.

type Tooltip

type Tooltip struct {
	Loading        string `json:"loading"`
	Previous       string `json:"previous"`
	Next           string `json:"next"`
	WallpaperSave  string `json:"walls"`
	WallpaperError string `json:"walle"`
}

Tooltip structure ...

Jump to

Keyboard shortcuts

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