nimbleway

package
v0.0.0-...-3d7a921 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SERPEndpoint    = "https://api.webit.live/api/v1/realtime/serp"
	LoginEndpoint   = "https://api.nimbleway.com/api/v1/account/login"
	JSONContentType = "application/json"
	ContentHeader   = "Content-Type"
)

Variables

This section is empty.

Functions

func ToSites

func ToSites(results *SERPResults) ([]api.Site, error)

ToSites parses the list of SERPResults to a list of sites

Types

type Client

type Client struct {
	Token   string
	Secrets SecretsFile
}

func (*Client) GetToken

func (c *Client) GetToken() error

func (*Client) Serp

func (c *Client) Serp(ctx context.Context, req *SERPRequest) (*SERPResults, error)

Serp executes a SERP request

type Entities

type Entities struct {
	OrganicResult     []OrganicResult     `json:"OrganicResult"`
	Pagination        []Pagination        `json:"Pagination"`
	RelatedSearch     []RelatedSearch     `json:"RelatedSearch"`
	SearchInformation []SearchInformation `json:"SearchInformation"`
}

type EntitiesCount

type EntitiesCount struct {
	OrganicResult     int `json:"OrganicResult"`
	Pagination        int `json:"Pagination"`
	RelatedSearch     int `json:"RelatedSearch"`
	SearchInformation int `json:"SearchInformation"`
}

type OrganicResult

type OrganicResult struct {
	DisplayedUrl string     `json:"displayed_url"`
	EntityType   string     `json:"entityType"`
	Position     int        `json:"position"`
	Snippet      string     `json:"snippet"`
	Title        string     `json:"title"`
	Url          string     `json:"url"`
	SiteLinks    []SiteLink `json:"sitelinks"`
}

type Pagination

type Pagination struct {
	CurrentPage   int               `json:"current_page"`
	EntityType    string            `json:"entityType"`
	NextPageUrl   string            `json:"next_page_url"`
	OtherPageUrls map[string]string `json:"other_page_urls"`
}

type ParsedResults

type ParsedResults struct {
	Status             string                 `json:"status"`
	Entities           Entities               `json:"entities"`
	TotalEntitiesCount int                    `json:"total_entities_count"`
	EntitiesCount      EntitiesCount          `json:"entities_count"`
	Metrics            map[string]interface{} `json:"metrics"`
}

type RelatedSearch

type RelatedSearch struct {
	EntityType string `json:"entityType"`
	Query      string `json:"query"`
	Url        string `json:"url"`
}

type SERPRequest

type SERPRequest struct {
	SearchEngine string `json:"search_engine"`
	Country      string `json:"country"`
	Locale       string `json:"locale"`
	Query        string `json:"query"`
	Parse        bool   `json:"parse"`
}

func NewRequest

func NewRequest(query string) *SERPRequest

NewRequest instantiates a default request with the provided string

type SERPResults

type SERPResults struct {
	HtmlContent string        `json:"html_content"`
	Status      string        `json:"status"`
	Parsing     ParsedResults `json:"parsing"`
	URL         string        `json:"url"`
}

type SearchInformation

type SearchInformation struct {
	EntityType         string `json:"entityType"`
	QueryDisplayed     string `json:"query_displayed"`
	TimeTakenDisplayed string `json:"time_taken_displayed"`
	TotalResults       string `json:"total_results"`
}

type SecretsFile

type SecretsFile struct {
	Username string `json:"username"`
	Password string `json:"password"`
}
type SiteLink struct {
	Title string `json:"title"`
	Url   string `json:"url"`
}

type TokenResponse

type TokenResponse struct {
	Token string `json: "token"`
}

Jump to

Keyboard shortcuts

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