input

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	// ID is a unique identifier for the Input. It is optional and helps
	// to find Input data on the client side.
	ID string `json:"id" example:"a1b2c3d4"`

	// Name provides data about a scientific name. Information can be
	// provided by a name-string or be split into separate fields.
	Name `json:"name"`

	// Reference provides data about a reference where the name was
	// mentioned. Information can be provided by a reference-string or
	// be split into separate fields.
	*Reference `json:"reference,omitempty"`

	Params `json:"params"`
}

@Description Input is used to pass data to the BHLnames API. It contains @Description infromation about a name and a reference where the name was @Description mentioned. Reference can point to a name usage or a @Description nomenclatural event.

func New

func New(parsers chan gnparser.GNparser, opts ...Option) Input

type Name

type Name struct {
	// NameString is a scientific name as a string. It might be enough to
	// provide only NameString without provided other fields.
	NameString string `json:"nameString,omitempty" example:"Canis lupus Linnaeus, 1758"`

	// CanonicalSimple is the canonical form of a name, meaning the name without
	// authorship or a year.
	CanonicalSimple string `json:"canonical,omitempty" example:"Canis lupus"`

	// CanonicalStem is the canonical form further normalized by removing
	// suffixes of specific and infraspecific epithets as well as normalizing
	// some interchangeable letters.
	CanonicalStem string `json:"canonicalStem,omitempty" example:"Canis lup"`

	// NameAuthors is the authorship of a name.
	NameAuthors string `json:"authors,omitempty" example:"Linnaeus"`

	// NameYear is the year of publication for a name.
	NameYear int `json:"year,omitempty" example:"1758"`
}

@Description Name provides data about a scientific name.

type Option

type Option func(*Input)

func OptID

func OptID(s string) Option

func OptNameString

func OptNameString(s string) Option

func OptNameYear

func OptNameYear(i int) Option

func OptRefString

func OptRefString(s string) Option

func OptRefsLimit added in v0.2.0

func OptRefsLimit(i int) Option

func OptSortDesc added in v0.2.0

func OptSortDesc(b bool) Option

func OptWithNomenEvent added in v0.2.0

func OptWithNomenEvent(b bool) Option

func OptWithShortenedOutput added in v0.2.0

func OptWithShortenedOutput(b bool) Option

func OptWithTaxon added in v0.2.0

func OptWithTaxon(b bool) Option

type Params added in v0.2.0

type Params struct {
	// RefsLimit provides the maximum number of references to return for each
	// name.
	RefsLimit int `json:"refsLimit,omitempty" example:"3"`

	// SortDesc determines the order of sorting the output data. If `true`
	// data are sorted by year from latest to earliest. If `false` then from
	// earliest to latest.
	SortDesc bool `json:"sortDesc,omitempty" example:"true"`

	// WithDetails is true when it is desirable to show more information in the
	// output.
	WithDetails bool `json:"showDetails,omitempty" example:"false"`

	// WithNomenEvent is true when the result tries to get a nomenclatural event
	// for the name.
	WithNomenEvent bool `json:"nomenEvent,omitempty" example:"false"`

	// WithShortenedOutput determines if references details will be provided.
	// If it is `true`, found references are not provided, only the metadata
	// about them.
	WithShortenedOutput bool `json:"shortenedOutput,omitempty" example:"false"`

	// WithTaxon is true when result includes data from all names that point to
	// a particular taxon, not only from the given name.
	WithTaxon bool `json:"taxon,omitempty" example:"false"`
}

@Description Params contain options used in the search and output.

type Reference

type Reference struct {
	// RefString is a reference as a string. It might be enough to
	// provide only RefString without provided other fields.
	RefString string `` /* 289-byte string literal not displayed */

	// RefYear is the year of publication for a reference.
	RefYearStart int `json:"yearStart,omitempty" example:"1758"`

	// RefYear is the year of publication for a reference.
	RefYearEnd int `json:"yearEnd,omitempty" example:"1758"`

	// RefAuthors is the authorship of a reference.
	RefAuthors string `json:"authors,omitempty" example:"Linnaeus"`

	// Journal is the title of the journal where the reference was
	// published.
	Journal string `` /* 169-byte string literal not displayed */

	// Volume is the volume of the journal where the reference was
	// published.
	Volume int `json:"volume,omitempty" example:"1"`

	// PageStart is the first page of the reference.
	PageStart int `json:"pageStart,omitempty" example:"24"`

	// PageEnd is the last page of the reference.
	PageEnd int `json:"pageEnd,omitempty" example:"24"`
}

@Description Reference provides data about a reference where the name was @Description mentioned.

Jump to

Keyboard shortcuts

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