bing

package
Version: v0.0.0-...-b9c0c39 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: GPL-2.0 Imports: 7 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 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 Source

type Source struct {
	N     int
	Index int
	// contains filtered or unexported fields
}

Source is source implmentation for bing everyday image.

func (*Source) Fetch

func (s *Source) Fetch(index int) (string, io.ReadCloser, error)

Fetch fetches given index from source.

func (*Source) Init

func (s *Source) Init() (int, error)

Init initiates source and return number of available images.

func (*Source) Name

func (s *Source) Name() string

Name returns source name.

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 ...

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL