api

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PaginationPageHeader is the header to determinate current page in paginated endpoint
	PaginationPageHeader = "X-Pagination-Page"
	// PaginationSizeHeader is the header to determinate page size in paginated endpoint
	PaginationSizeHeader = "X-Pagination-Size"
	// PaginationCountHeader is the header to determinate total count of element in paginated endpoint
	PaginationCountHeader = "X-Pagination-Count"
	// PaginationPageQueryParam is the query parameter used to set current page in paginated endpoint
	PaginationPageQueryParam = "pagination-page"
	// PaginationSizeQueryParam is the query parameter used to set page size in paginated endpoint
	PaginationSizeQueryParam = "pagination-size"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.7.0

type API interface {
	SearchResources(params *ResSearchParams) ([]ResourceDto, int64, error)
	AddResource(res ResourceDto) (ResourceDto, error)
	ScheduleURL(url string) error
}

API is the interface to interact with the API component

func NewClient

func NewClient(baseURL, token string) API

NewClient create a new API client using given details

type CredentialsDto added in v0.5.0

type CredentialsDto struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

CredentialsDto represent the credential when logging in the API

type ResSearchParams added in v0.7.0

type ResSearchParams struct {
	URL        string
	Keyword    string
	StartDate  time.Time
	EndDate    time.Time
	WithBody   bool
	PageSize   int
	PageNumber int
}

ResSearchParams is the search params used

type ResourceDto

type ResourceDto struct {
	URL         string            `json:"url"`
	Body        string            `json:"body"`
	Time        time.Time         `json:"time"`
	Title       string            `json:"title"`
	Meta        map[string]string `json:"meta"`
	Description string            `json:"description"`
	Headers     map[string]string `json:"headers"`
}

ResourceDto represent a resource as given by the API

Jump to

Keyboard shortcuts

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