protocolsio

package module
v0.0.0-...-ccb06fb Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

README

Package cloudeng.io/webapi/protocolsio

import cloudeng.io/webapi/protocolsio

Constants

ContentType
ContentType = "protocols.io/protocol"

Functions

Func NewFetcher
func NewFetcher(fetcherOpts FetcherOptions, opts ...operations.Option) (operations.Fetcher[protocolsiosdk.ListProtocolsV3, protocolsiosdk.ProtocolPayload], error)

NewFetcher returns an instance of operations.Fetcher for protocols.io 'GetList' operation.

Func NewPaginator
func NewPaginator(ctx context.Context, cp Checkpoint, opts PaginatorOptions) (operations.Paginator[protocolsiosdk.ListProtocolsV3], error)

NewPaginator returns an instance of operations.Paginator for protocols.io 'GetList' operation.

Func NewProtocolCrawler
func NewProtocolCrawler(
	ctx context.Context, checkpoint Checkpoint,
	fopts FetcherOptions, popts PaginatorOptions, opts ...operations.Option) (*operations.Crawler[protocolsiosdk.ListProtocolsV3, protocolsiosdk.ProtocolPayload], error)

NewProtocolCrawler creates a new instance of operations.Crawler that can be used to crawl/download protocols on protocols.io.

Types

Type Checkpoint
type Checkpoint struct {
	CompletedPage int64 `json:"completed_page"`
	CurrentPage   int64 `json:"current_page"`
	TotalPages    int64 `json:"total_pages"`
}

Checkpoint represents the most recently completed page of the paginated crawl.

Type FetcherOptions
type FetcherOptions struct {
	EndpointURL string
	VersionMap  map[int64]int
}

FetcherOptions represent the options for creating a new Fetcher, including a VersionMap which allows for incremental downloading of Protocol objects. The VersionMap contains the version ID of a previously downloaded instance of that protocol, keyed by it's ID. The fetcher will only redownload a protocol object if its version ID has channged. The VersionMap is typically built by scanning all previously downloaded protocol objects.

Type PaginatorOptions
type PaginatorOptions struct {
	EndpointURL string
	Parameters  url.Values
	From, To    int
}
Type PublicBearerToken
type PublicBearerToken struct {
	Token string
}

PublicBearerToken is an implementation of operations.Authorizer for a protocols.io public bearer token.

Methods
func (pbt PublicBearerToken) WithAuthorization(ctx context.Context, req *http.Request) error

Documentation

Index

Constants

View Source
const ContentType = "protocols.io/protocol"

Variables

This section is empty.

Functions

func NewFetcher

NewFetcher returns an instance of operations.Fetcher for protocols.io 'GetList' operation.

func NewPaginator

NewPaginator returns an instance of operations.Paginator for protocols.io 'GetList' operation.

func NewProtocolCrawler

NewProtocolCrawler creates a new instance of operations.Crawler that can be used to crawl/download protocols on protocols.io.

Types

type Checkpoint

type Checkpoint struct {
	CompletedPage int64 `json:"completed_page"`
	CurrentPage   int64 `json:"current_page"`
	TotalPages    int64 `json:"total_pages"`
}

Checkpoint represents the most recently completed page of the paginated crawl.

type FetcherOptions

type FetcherOptions struct {
	EndpointURL string
	VersionMap  map[int64]int
}

FetcherOptions represent the options for creating a new Fetcher, including a VersionMap which allows for incremental downloading of Protocol objects. The VersionMap contains the version ID of a previously downloaded instance of that protocol, keyed by it's ID. The fetcher will only redownload a protocol object if its version ID has channged. The VersionMap is typically built by scanning all previously downloaded protocol objects.

type PaginatorOptions

type PaginatorOptions struct {
	EndpointURL string
	Parameters  url.Values
	From, To    int
}

type PublicBearerToken

type PublicBearerToken struct {
	Token string
}

PublicBearerToken is an implementation of operations.Authorizer for a protocols.io public bearer token.

func (PublicBearerToken) WithAuthorization

func (pbt PublicBearerToken) WithAuthorization(_ context.Context, req *http.Request) error

Directories

Path Synopsis
Package protocolsio provides support for working with the protocols.io API.
Package protocolsio provides support for working with the protocols.io API.
Package protocolsiosdk provides a minimal SDK for the protocols.io API.
Package protocolsiosdk provides a minimal SDK for the protocols.io API.

Jump to

Keyboard shortcuts

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