protocolsiocmd

package
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: 22 Imported by: 1

README

Package cloudeng.io/webapi/protocolsio/protocolsiocmd

import cloudeng.io/webapi/protocolsio/protocolsiocmd

Package protocolsiocmd provides support for building command line tools that access protocols.io.

Package protocolsio provides support for working with the protocols.io API. It currently provides the ability to crawl public protocols.

Types

Type Auth
type Auth struct {
	PublicToken  string `yaml:"public_token"`
	ClientID     string `yaml:"public_clientid"`
	ClientSecret string `yaml:"public_secret"`
}

Auth represents the authentication information required to access protocols.io.

Type Command
type Command struct {
	Auth
	Config
}

Çommand implements the command line operations available for protocols.io.

Functions
func NewCommand(ctx context.Context, crawls apicrawlcmd.Crawls, name, authFilename string) (*Command, error)

NewCommand returns a new Command instance for the specified API crawl with API authentication information read from the specified file or from the context.

Methods
func (c *Command) Crawl(ctx context.Context, cacheRoot string, fv *CrawlFlags) error
func (c *Command) Get(ctx context.Context, fv *GetFlags, args []string) error
func (c *Command) ScanDownloaded(ctx context.Context, root string, fv *ScanFlags) error
Type CommonFlags
type CommonFlags struct {
	ProtocolsConfig string `subcmd:"protocolsio-config,$HOME/.protocolsio.yaml,'protocols.io auth config file'"`
}
Type Config
type Config apicrawlcmd.Crawl[Service]

Config represents the configuration information required to access and crawl the protocols.io API.

Methods
func (c Config) NewProtocolCrawler(ctx context.Context, op checkpoint.Operation, fv *CrawlFlags, auth Auth) (*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.

func (c Config) OptionsForEndpoint(auth Auth) ([]operations.Option, error)
Type CrawlFlags
type CrawlFlags struct {
	CommonFlags
	Save             bool               `subcmd:"save,true,'save downloaded protocols to disk'"`
	IgnoreCheckpoint bool               `subcmd:"ignore-checkpoint,false,'ignore the checkpoint files'"`
	Pages            flags.IntRangeSpec `subcmd:"pages,,page range to return"`
	PageSize         int                `subcmd:"size,50,number of items in each page"`
	Key              string             `subcmd:"key,,'string may contain any characters, numbers and special symbols. System will search around protocol name, description, authors. If the search keywords are enclosed in double quotes, then result contains only the exact match of the combined term'"`
}
Type GetFlags
type GetFlags struct {
	CommonFlags
}
Type ScanFlags
type ScanFlags struct {
	CommonFlags
	Template string `subcmd:"template,'{{.ID}}',template to use for printing fields in the downloaded Protocol objects"`
}
Type Service
type Service struct {
	Filter         string `yaml:"filter"`
	OrderField     string `yaml:"order_field"`
	OrderDirection string `yaml:"order_direction"`
	Incremental    bool   `yaml:"incremental"`
}

Service represents the protocols.io specific confiugaration options.

Documentation

Overview

Package protocolsio provides support for working with the protocols.io API. It currently provides the ability to crawl public protocols.

Package protocolsiocmd provides support for building command line tools that access protocols.io.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OptionsForEndpoint

func OptionsForEndpoint(cfg apicrawlcmd.Crawl[Service], token *apitokens.T) ([]operations.Option, error)

Types

type Command

type Command struct {
	// contains filtered or unexported fields
}

Çommand implements the command line operations available for protocols.io.

func NewCommand

func NewCommand(ctx context.Context, config apicrawlcmd.Crawl[yaml.Node], resources apicrawlcmd.Resources) (*Command, error)

NewCommand returns a new Command instance for protocols.io API related commands.

func (*Command) Crawl

func (c *Command) Crawl(ctx context.Context, fv *CrawlFlags) error

func (*Command) Get

func (c *Command) Get(ctx context.Context, _ *GetFlags, args []string) error

func (*Command) ScanDownloaded

func (c *Command) ScanDownloaded(ctx context.Context, fv *ScanFlags) error

type CrawlFlags

type CrawlFlags struct {
	Save             bool               `subcmd:"save,true,'save downloaded protocols to disk'"`
	IgnoreCheckpoint bool               `subcmd:"ignore-checkpoint,false,'ignore the checkpoint files'"`
	Pages            flags.IntRangeSpec `subcmd:"pages,,page range to return"`
	PageSize         int                `subcmd:"size,50,number of items in each page"`
	Key              string             `` /* 259-byte string literal not displayed */
}

type GetFlags

type GetFlags struct{}

type ScanFlags

type ScanFlags struct {
	Template string `subcmd:"template,'{{.ID}}',template to use for printing fields in the downloaded Protocol objects"`
}

type Service

type Service struct {
	Filter         string `yaml:"filter" cmd:"filter to apply to protocols.io API calls, typically public"`
	OrderField     string `yaml:"order_field" cmd:"field used to order API responses, typically id"`
	OrderDirection string `yaml:"order_direction" cmd:"order direction to apply to protocols.io API calls, typically asc"`
	Incremental    bool   `yaml:"incremental" cmd:"if true, only download new or updated protocols"`
}

Service represents the protocols.io specific confiugaration options.

Jump to

Keyboard shortcuts

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