api

package
v0.0.0-...-ef078db Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2018 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasContentType

func HasContentType(r *http.Request, mimetype string) (bool, error)

HasContentType determines if http.Request has the content-type

Types

type Domain

type Domain struct {
	Domain string               `json:"domain"`
	Depth  int                  `json:"depth,omitempty"`
	Status crawler.WorkerStatus `json:"status,omitempty"`
}

Domain struct for using in request & response

type Handler

type Handler struct {
	Crawler *crawler.Crawler
}

Handler is used as api.handler

func (*Handler) CreateDomainHandler

func (h *Handler) CreateDomainHandler(ctx echo.Context) error

CreateDomainHandler is the api.Handler to register domains for crawling. payload is expected in application/json format and is expected to include the domain and depth attributes below is a sample payload with their data types included { "domain": "http://cloudflare.com", "depth": 3 }

domain - required, string depth - int, optional; defaults to 5

func (*Handler) GetDomainHandler

func (h *Handler) GetDomainHandler(ctx echo.Context) error

GetDomainHandler is the api.Handler to query domains crawl response tree and is expected to include the domain in the URL path parameter, such as /domains/https%3A%2F%2Fcloudflare.com

as noted in the above example, the domain in the path parameter is expected to include protocol and be a URL-encoded string most libraries perform the URL encoding before sending the request over the wire, but in some cases the user is required to explicitly perform the encoding before making the request; examples for such utilities are cURL / libcurl

func (*Handler) GetDomainStatusHandler

func (h *Handler) GetDomainStatusHandler(ctx echo.Context) error

GetDomainStatusHandler is the api.Handler to query domains crawl response status and is expected to include the domain in the URL path parameter, e.g. /domains/https%3A%2F%2Fcloudflare.com/status

as noted in the above example, the domain in the path parameter is expected to include protocol and be a URL-encoded string most libraries perform the URL encoding before sending the request over the wire, but in some cases the user is required to explicitly perform the encoding before making the request; examples for such utilities are cURL / libcurl

Jump to

Keyboard shortcuts

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