api

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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 Client

type Client interface {
	SearchResources(url, keyword string, startDate, endDate time.Time,
		paginationPage, paginationSize int) ([]ResourceDto, int64, error)
	AddResource(res ResourceDto) (ResourceDto, error)
	ScheduleURL(url string) error
	Authenticate(credentials CredentialsDto) (string, error)
}

Client is the interface to interact with the API component

func NewAuthenticatedClient added in v0.5.0

func NewAuthenticatedClient(baseURL string, credentials CredentialsDto) (Client, error)

NewAuthenticatedClient create a new Client & authenticate it against the API

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 ResourceDto

type ResourceDto struct {
	URL   string    `json:"url"`
	Body  string    `json:"body"`
	Title string    `json:"title"`
	Time  time.Time `json:"time"`
}

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