bing

package module
v0.0.0-...-0e69211 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 6 Imported by: 0

README

go-bing

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EndpointAPI = "https://api.cognitive.microsoft.com/bing/v7.0"

	EndpointWebSearch string

	EndpointImages        string
	EndpointImageSearch   string
	EndpointImageDetails  string
	EndpointImageTrending string
)

Functions

func SetEndpointAPI

func SetEndpointAPI(apiEndpoint string)

Types

type AggregateRating

type AggregateRating struct {
	BestRating  float64 `json:"bestRating"`
	RatingValue float64 `json:"ratingValue"`
	ReviewCount uint    `json:"reviewCount"`
	Text        string  `json:"text"`
}

type Category

type Category struct {
	Tiles []*Tile `json:"tiles"`
	Title string  `json:"title"`
}

type Client

type Client struct {
	APIKey string
	Market string
	// contains filtered or unexported fields
}

func New

func New(apiKey string) *Client

func (*Client) ImageSearch

func (client *Client) ImageSearch(searchQuery *SearchQuery) (*Images, error)

type Computation

type Computation struct {
	Expression string `json:"expression"`
	Value      string `json:"value"`
}

type Entity

type Entity struct {
	BingID           string                  `json:"bingId"`
	ContractualRules []*Object               `json:"contractualRules"`
	Description      string                  `json:"description"`
	PresentationInfo *EntityPresentationInfo `json:"entityPresentationInfo"`
	Image            *Image                  `json:"image"`
	Name             string                  `json:"name"`
	WebSearchURL     string                  `json:"webSearchUrl"`
}

type EntityAnswer

type EntityAnswer struct {
	QueryScenario string    `json:"queryScenario"`
	Value         []*Entity `json:"value"`
}

type EntityPresentationInfo

type EntityPresentationInfo struct {
	Scenario        string `json:"entityScenario"`
	TypeDisplayHint string `json:"entityTypeDisplayHint"`
	TypeHint        string `json:"entityTypeHint"`
}

type Error

type Error struct {
	Code        string `json:"code"`
	SubCode     string `json:"subCode"`
	Message     string `json:"message"`
	MoreDetails string `json:"moreDetails"`
	Parameter   string `json:"parameter"`
	Value       string `json:"value"`
}

type ErrorResponse

type ErrorResponse struct {
	Type            string           `json:"_type"`
	Instrumentation *Instrumentation `json:"instrumentation"`
	Errors          []*Error         `json:"errors"`
}

func (*ErrorResponse) Error

func (errorResponse *ErrorResponse) Error() string

type Identifiable

type Identifiable struct {
	ID string `json:"id"`
}

type Image

type Image struct {
	*MediaSize
	AccentColor        string            `json:"accentColor"`
	ContentSize        string            `json:"contentSize"`
	ContentURL         string            `json:"contentUrl"`
	DatePublished      string            `json:"datePublished"`
	EncodingFormat     string            `json:"encodingFormat"`
	HostPageDisplayURL string            `json:"hostPageDisplayUrl"`
	HostPageURL        string            `json:"hostPageUrl"`
	ID                 string            `json:"id"`
	ImageID            string            `json:"imageId"`
	ImageInsightsToken string            `json:"imageInsightsToken"`
	InsightsMetadata   *InsightsMetadata `json:"insightsMetadata"`
	Name               string            `json:"name"`
	Provider           []*Organization   `json:"provider"`
	Thumbnail          *MediaSize        `json:"thumbnail"`
	ThumbnailURL       string            `json:"thumbnailUrl"`
	WebSearchURL       string            `json:"webSearchUrl"`
}

type Images

type Images struct {
	Type                  string   `json:"_type"`
	ID                    string   `json:"id"`
	IsFamilyFriendly      bool     `json:"isFamilyFriendly"`
	NextOffset            int      `json:"nextOffset"`
	PivotSuggestions      *Pivot   `json:"pivotSuggestions"`
	QueryExpansions       *Query   `json:"queryExpansions"`
	ReadLink              string   `json:"readLink"`
	SimilarTerms          *Query   `json:"similarTerms"`
	TotalEstimatedMatches int      `json:"totalEstimatedMatches"`
	Value                 []*Image `json:"value"`
	WebSearchURL          string   `json:"webSearchUrl"`
}

type InsightsMetadata

type InsightsMetadata struct {
	AggregateOffer       *Offer `json:"aggregateOffer"`
	RecipeSourcesCount   uint   `json:"recipeSourcesCount"`
	ShoppingSourcesCount uint   `json:"shoppingSourcesCount"`
}

type Instrumentation

type Instrumentation struct {
	Type string `json:"type"`
}

type License

type License struct {
}

type MediaSize

type MediaSize struct {
	Height int `json:"height"`
	Width  int `json:"width"`
}

type MetaTag

type MetaTag struct {
	Content string `json:"content"`
	Name    string `json:"name"`
}

type News

type News struct {
	Type                  string          `json:"type"`
	ID                    string          `json:"id"`
	ReadLink              string          `json:"readLink"`
	RelatedTopics         []*RelatedTopic `json:"relatedTopics"`
	Sort                  []*SortValue    `json:"sort"`
	TotalEstimatedMatches int             `json:"totalEstimatedMatches"`
	Value                 []*NewsArticle  `json:"value"`
}

type NewsArticle

type NewsArticle struct {
	Category          string          `json:"category"`
	ClusteredArticles []*NewsArticle  `json:"clusteredArticles"`
	ContractualRules  []*Object       `json:"contractualRules"`
	DatePublished     string          `json:"datePublished"`
	Description       string          `json:"description"`
	Headline          bool            `json:"headline"`
	ID                string          `json:"id"`
	Image             *Image          `json:"image"`
	Mentions          []*Thing        `json:"mentions"`
	Name              string          `json:"name"`
	Provider          []*Organization `json:"provider"`
	URL               string          `json:"url"`
	Video             *Video          `json:"video"`
}

type Object

type Object struct {
	Type                 string   `json:"_type"`
	License              *License `json:"license"`
	LicenseNotice        string   `json:"licenseNotice"`
	MustBeCloseToContent bool     `json:"mustBeCloseToContent"`
	TargetPropertyName   string   `json:"targetPropertyName"`
	Text                 string   `json:"text"`
	URL                  string   `json:"url"`
}

type Offer

type Offer struct {
	AggregateRating *AggregateRating `json:"aggregateRating"`
	Availability    string           `json:"availability"`
	Description     string           `json:"description"`
	LastUpdated     string           `json:"lastUpdated"`
	LowPrice        float64          `json:"lowPrice"`
	Name            string           `json:"name"`
	OfferCount      uint             `json:"offerCount"`
	Price           float64          `json:"price"`
	PriceCurrency   string           `json:"priceCurrency"`
	Seller          *Organization    `json:"seller"`
	URL             string           `json:"url"`
}

type Organization

type Organization struct {
	Image *Image `json:"image"`
	Name  string `json:"name"`
	URL   string `json:"url"`
}

type Pivot

type Pivot struct {
	Pivot       string `json:"pivot"`
	Suggestions *Query `json:"suggestions"`
}

type Publisher

type Publisher struct {
	Name string `json:"name"`
}

type Query

type Query struct {
	DisplayText  string     `json:"displayText"`
	SearchLink   string     `json:"searchLink"`
	Text         string     `json:"text"`
	Thumbnail    *Thumbnail `json:"thumbnail"`
	WebSearchURL string     `json:"webSearchUrl"`
}

type QueryContext

type QueryContext struct {
	AdultIntent             bool   `json:"adultIntent"`
	AlterationOverrideQuery string `json:"alterationOverrideQuery"`
	AlteredQuery            string `json:"alteredQuery"`
	AskUserForLocation      bool   `json:"askUserForLocation"`
	OriginalQuery           string `json:"originalQuery"`
}

type RankingGroup

type RankingGroup struct {
	Items []*RankingItem `json:"items"`
}

type RankingItem

type RankingItem struct {
	AnswerType  string        `json:"answerType"`
	ResultIndex int           `json:"resultIndex"`
	Value       *Identifiable `json:"value"`
}

type RankingResponse

type RankingResponse struct {
	Mainline *RankingGroup `json:"mainline"`
	Pole     *RankingGroup `json:"pole"`
	Sidebar  *RankingGroup `json:"sidebar"`
}

type RelatedSearchAnswer

type RelatedSearchAnswer struct {
	ID    string   `json:"id"`
	Value []*Query `json:"value"`
}

type RelatedTopic

type RelatedTopic struct {
	RelatedNews  *NewsArticle `json:"relatedNews"`
	Name         string       `json:"name"`
	WebSearchURL string       `json:"webSearchUrl"`
}

type SearchQuery

type SearchQuery struct {
	Query      string `url:"q"`
	Count      int    `url:"count,omitempty"`
	Offset     int    `url:"offset,omitempty"`
	Market     string `url:"mkt,omitempty"`
	SafeSearch string `url:"safeSearch,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	Type             string               `json:"_type"`
	Computation      *Computation         `json:"computation"`
	Entities         *EntityAnswer        `json:"entities"`
	Images           *Images              `json:"images"`
	News             *News                `json:"news"`
	QueryContext     *QueryContext        `json:"queryContext"`
	RankingResponse  *RankingResponse     `json:"rankingResponse"`
	RelatedSearches  *RelatedSearchAnswer `json:"relatedSearches"`
	SpellSuggestions *SpellSuggestions    `json:"spellSuggestions"`
	TimeZone         *TimeZone            `json:"timeZone"`
	Videos           *Videos              `json:"videos"`
	WebPages         *WebAnswer           `json:"webPages"`
}

type SortValue

type SortValue struct {
	ID         string `json:"id"`
	IsSelected bool   `json:"isSelected"`
	Name       string `json:"name"`
	URL        string `json:"url"`
}

type SpellSuggestions

type SpellSuggestions struct {
	ID    string   `json:"id"`
	Value []*Query `json:"value"`
}

type Thing

type Thing struct {
	Name string `json:"name"`
}

type Thumbnail

type Thumbnail struct {
	URL string `json:"url"`
}

type Tile

type Tile struct {
	Image *Image `json:"image"`
	Query *Query `json:"query"`
}

type TimeZone

type TimeZone struct {
	OtherCityTimes  []*TimeZoneInformation `json:"otherCityTimes"`
	PrimaryCityTime *TimeZoneInformation   `json:"primaryCityTime"`
}

type TimeZoneInformation

type TimeZoneInformation struct {
	Location  string `json:"location"`
	Time      string `json:"time"`
	UTCOffset string `json:"utcOffset"`
}

type TrendingImages

type TrendingImages struct {
	Categories []*Category `json:"categories"`
}

type Video

type Video struct {
	AllowHTTPSEmbed     bool       `json:"allowHttpsEmbed"`
	AllowMobileEmbed    bool       `json:"allowMobileEmbed"`
	Creator             *Publisher `json:"creator"`
	ContentURL          string     `json:"contentUrl"`
	DatePublished       string     `json:"datePublished"`
	Description         string     `json:"description"`
	Duration            string     `json:"duration"`
	EmbedHTML           string     `json:"embedHtml"`
	EncodingFormat      string     `json:"encodingFormat"`
	Height              int        `json:"height"`
	HostPageDisplayURL  string     `json:"hostPageDisplayUrl"`
	HostPageURL         string     `json:"hostPageUrl"`
	ID                  string     `json:"id"`
	IsAccessibleForFree bool       `json:"isAccessibleForFree"`
	IsSuperfresh        bool       `json:"isSuperfresh"`
	MainEntity          *Thing     `json:"mainEntity"`
	MotionThumbnailURL  string     `json:"motionThumbnailUrl"`
	Name                string     `json:"name"`
	Publisher           *Publisher `json:"publisher"`
	Thumbnail           *MediaSize `json:"thumbnail"`
	ThumbnailURL        string     `json:"thumbnailUrl"`
	VideoID             string     `json:"videoID"`
	ViewCount           int        `json:"viewCount"`
	WebSearchURL        string     `json:"webSearchUrl"`
	Width               int        `json:"width"`
}

type Videos

type Videos struct {
	Type                  string   `json:"_type"`
	ID                    string   `json:"id"`
	IsFamilyFriendly      bool     `json:"isFamilyFriendly"`
	NextOffset            int      `json:"nextOffset"`
	PivotSuggestions      []*Pivot `json:"pivotSuggestions"`
	QueryExpansions       []*Query `json:"queryExpansions"`
	Scenario              string   `json:"scenario"`
	TotalEstimatedMatches int      `json:"totalEstimatedMatches"`
	Value                 []*Video `json:"value"`
	WebSearchURL          string   `json:"webSearchUrl"`
}

type WebAnswer

type WebAnswer struct {
	ID                    string     `json:"id"`
	SomeResultsRemoved    bool       `json:"someResultsRemoved"`
	TotalEstimatedMatches int        `json:"totalEstimatedMatches"`
	Value                 []*WebPage `json:"value"`
	WebSearchURL          string     `json:"webSearchUrl"`
}

type WebPage

type WebPage struct {
	About           *Object    `json:"about"`
	DateLastCrawled string     `json:"dateLastCrawled"`
	DeepLinks       []*WebPage `json:"deepLinks"`
	DisplayURL      string     `json:"displayUrl"`
	ID              string     `json:"id"`
	Name            string     `json:"name"`
	Mentions        *Object    `json:"mentions"`
	SearchTags      []*MetaTag `json:"searchTags"`
	Snippet         string     `json:"snippet"`
	URL             string     `json:"url"`
}

Jump to

Keyboard shortcuts

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