responses

package
v0.0.0-...-376a21c Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisSuccessResponse

type AnalysisSuccessResponse struct {
	HtmlVersion    string    `json:"htmlVersion"`
	Title          string    `json:"title"`
	ServiceTime    int64     `json:"serviceTime"`
	WebExtractTime int64     `json:"webExtractTime"`
	Headings       []Heading `json:"headings"`
	Urls           []Url     `json:"urls"`
	HasLogin       bool      `json:"hasLogin"`
}

type ErrorResponse

type ErrorResponse struct {
	Message          string `json:"message"`
	DeveloperMessage string `json:"developerMessage"`
}

func NewErrorResponse

func NewErrorResponse(message string, err error) ErrorResponse

NewErrorResponse function is responsible to create and return a new ErrorResponse object.

type Heading

type Heading struct {
	TagName string   `json:"tagName"`
	Levels  []string `json:"levels"`
}

type Url

type Url struct {
	Url     string `json:"url"`
	Type    string `json:"type"`
	Status  int    `json:"status"`
	Latency int64  `json:"latency"`
}

type WebPageAnalyzerResponseManager

type WebPageAnalyzerResponseManager interface {

	// SetHtmlVersion function is responsible for setting the html
	// version.
	SetHtmlVersion(htmlVersion string)

	// SetTitle function is responsible for setting the page title.
	SetTitle(title string)

	// SetServiceTime function is responsible for setting the service
	// time.
	SetServiceTime(serviceTime int64)

	// SetExtractTime function is responsible for setting the web page
	// extracting time.
	SetExtractTime(extractTime int64)

	// AddHeadingLevel function is responsible for adding the headers
	// as well append the levels.
	AddHeadingLevel(tag string, level string)

	// AddUrlInfo function is responsible for adding the URL information.
	AddUrlInfo(url string, urlType int, status int, latency int64)

	// SetHasLogin function is responsible for setting the login is
	//available or not.
	SetHasLogin(hasLogin bool)

	// ToString  function is responsible for getting the string
	//representation of the response.
	ToString() string

	// To function is responsible for generating the response object.
	To() AnalysisSuccessResponse
}

WebPageAnalyzerResponseManager interface contains the functions to be implemented in setting the required items to the response that it supposes to provide.

func NewWebPageAnalyzerResponseManager

func NewWebPageAnalyzerResponseManager() WebPageAnalyzerResponseManager

NewWebPageAnalyzerResponseManager function is responsible to create an object of WebPageAnalyzerResponseManager.

Jump to

Keyboard shortcuts

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