Documentation ¶
Index ¶
- Constants
- func FormatResults(vals []WebPage) (res string)
- type BingClient
- type ContractualRules
- type Creator
- type DeepLink
- type Entities
- type EntitiesValue
- type EntityPresentationInfo
- type ErrorResp
- type Image
- type News
- type NewsValue
- type Option
- type PrimaryImageOfPage
- type Provider
- type Publisher
- type QueryContext
- type RankingResponse
- type RankingResponseItem
- type RankingResponseItemValue
- type RankingResponseMainline
- type RankingResponseSidebar
- type RespData
- type SearchTag
- type Thumbnail
- type Tool
- type VideoValue
- type Videos
- type WebPage
- type WebPages
- type WebPagesValue
Constants ¶
View Source
const ( ToolName = "Bing Search API" ParamAPIKey = "apiKey" ParamCount = "count" ParamScraperPage = "scraperPage" )
View Source
const ( Endpoint = "https://api.bing.microsoft.com/v7.0/search" AuthHeaderKey = "Ocp-Apim-Subscription-Key" )
Variables ¶
This section is empty.
Functions ¶
func FormatResults ¶
Types ¶
type BingClient ¶
type BingClient struct {
// contains filtered or unexported fields
}
func NewBingClient ¶
func NewBingClient(opts ...Option) *BingClient
func NewFromToolSpec ¶
func NewFromToolSpec(tool *v1alpha1.Tool) (client *BingClient, err error)
func (*BingClient) SearchGetDetailData ¶
func (client *BingClient) SearchGetDetailData(ctx context.Context, query string) (resp []WebPage, data string, err error)
SearchGetDetailData will try to parse bing search list type webpages and news. Unlike the Search method, it returns a more detailed list of structures, not just a string. Note: only parse search list, not single source page.
type ContractualRules ¶
type Entities ¶
type Entities struct {
Value []EntitiesValue `json:"value"`
}
type EntitiesValue ¶
type EntitiesValue struct { ID string `json:"id"` EntityPresentationInfo EntityPresentationInfo `json:"entityPresentationInfo"` BingID string `json:"bingId"` }
type EntityPresentationInfo ¶
type EntityPresentationInfo struct {
EntityScenario string `json:"entityScenario"`
}
type NewsValue ¶
type NewsValue struct { ContractualRules []ContractualRules `json:"contractualRules"` Name string `json:"name"` URL string `json:"url"` Description string `json:"description"` Provider []Provider `json:"provider"` DatePublished time.Time `json:"datePublished"` Category string `json:"category"` Image Image `json:"image,omitempty"` }
type PrimaryImageOfPage ¶
type QueryContext ¶
type QueryContext struct {
OriginalQuery string `json:"originalQuery"`
}
type RankingResponse ¶
type RankingResponse struct { Mainline RankingResponseMainline `json:"mainline"` Sidebar RankingResponseSidebar `json:"sidebar"` }
type RankingResponseItem ¶
type RankingResponseItem struct { AnswerType string `json:"answerType"` ResultIndex int `json:"resultIndex"` Value RankingResponseItemValue `json:"value"` }
type RankingResponseItemValue ¶
type RankingResponseItemValue struct {
ID string `json:"id"`
}
type RankingResponseMainline ¶
type RankingResponseMainline struct {
Items []RankingResponseItem `json:"items"`
}
type RankingResponseSidebar ¶
type RankingResponseSidebar struct {
Items []RankingResponseItem `json:"items"`
}
type RespData ¶
type RespData struct { Type string `json:"_type,omitempty"` QueryContext QueryContext `json:"queryContext,omitempty"` WebPages WebPages `json:"webPages,omitempty"` Entities Entities `json:"entities,omitempty"` Videos Videos `json:"videos,omitempty"` News News `json:"news,omitempty"` RankingResponse RankingResponse `json:"rankingResponse,omitempty"` ErrorResp *ErrorResp `json:"error,omitempty"` }
type Tool ¶
func (Tool) Description ¶
type VideoValue ¶
type VideoValue struct { WebSearchURL string `json:"webSearchUrl"` Name string `json:"name"` Description string `json:"description"` ThumbnailURL string `json:"thumbnailUrl"` DatePublished string `json:"datePublished"` Publisher []Publisher `json:"publisher"` Creator Creator `json:"creator,omitempty"` ContentURL string `json:"contentUrl"` HostPageURL string `json:"hostPageUrl"` EncodingFormat string `json:"encodingFormat"` HostPageDisplayURL string `json:"hostPageDisplayUrl"` Width int `json:"width"` Height int `json:"height"` Duration string `json:"duration,omitempty"` MotionThumbnailURL string `json:"motionThumbnailUrl,omitempty"` EmbedHTML string `json:"embedHtml"` AllowHTTPSEmbed bool `json:"allowHttpsEmbed"` ViewCount int `json:"viewCount"` Thumbnail Thumbnail `json:"thumbnail"` AllowMobileEmbed bool `json:"allowMobileEmbed"` IsSuperfresh bool `json:"isSuperfresh"` }
type WebPages ¶
type WebPages struct { WebSearchURL string `json:"webSearchUrl"` TotalEstimatedMatches int `json:"totalEstimatedMatches"` Value []WebPagesValue `json:"value"` SomeResultsRemoved bool `json:"someResultsRemoved"` }
type WebPagesValue ¶
type WebPagesValue struct { ID string `json:"id"` Name string `json:"name"` URL string `json:"url"` DatePublished string `json:"datePublished,omitempty"` DatePublishedDisplayText string `json:"datePublishedDisplayText,omitempty"` IsFamilyFriendly bool `json:"isFamilyFriendly"` DisplayURL string `json:"displayUrl"` Snippet string `json:"snippet"` DeepLinks []DeepLink `json:"deepLinks,omitempty"` DateLastCrawled time.Time `json:"dateLastCrawled"` CachedPageURL string `json:"cachedPageUrl,omitempty"` Language string `json:"language"` ThumbnailURL string `json:"thumbnailUrl,omitempty"` PrimaryImageOfPage PrimaryImageOfPage `json:"primaryImageOfPage,omitempty"` SearchTags []SearchTag `json:"searchTags,omitempty"` }
Click to show internal directories.
Click to hide internal directories.