Documentation
¶
Overview ¶
Package metacpan_client is a client for the MetaCPAN API, equivalent to MetaCPAN::Client. It is written to mirror the API and behavior as closely as possible, although the implementation varies in some places.
Index ¶
- Constants
- type Author
- type Client
- func (mc *Client) AllAuthors() (ResultSet[*Author], error)
- func (mc *Client) AllDistributions() (ResultSet[*Distribution], error)
- func (mc *Client) AllFavorites() (ResultSet[*Favorite], error)
- func (mc *Client) AllModules() (ResultSet[*Module], error)
- func (mc *Client) AllReleases() (ResultSet[*Release], error)
- func (mc *Client) Author(s string) (*Author, error)
- func (mc *Client) AuthorSearch(args map[string]interface{}) (ResultSet[*Author], error)
- func (mc *Client) Autocomplete(s string) ([]*File, error)
- func (mc *Client) AutocompleteSuggest(s string) ([]*File, error)
- func (mc *Client) Close() error
- func (mc *Client) Cover(s string) (*Cover, error)
- func (mc *Client) Debug() bool
- func (mc *Client) Distribution(s string) (*Distribution, error)
- func (mc *Client) DistributionSearch(args map[string]interface{}) (ResultSet[*Distribution], error)
- func (mc *Client) Domains() []string
- func (mc *Client) DownloadURL(release string, r *version.Range, dev bool) (*DownloadURL, error)
- func (mc *Client) Favorite(args map[string]interface{}) (ResultSet[*Favorite], error)
- func (mc *Client) File(s string) (*File, error)
- func (mc *Client) Mirror(s string) (*Mirror, error)
- func (mc *Client) Module(s string) (*Module, error)
- func (mc *Client) ModuleSearch(args map[string]interface{}) (ResultSet[*Module], error)
- func (mc *Client) Package(s string) (*Package, error)
- func (mc *Client) Permission(s string) (*Permission, error)
- func (mc *Client) Pod(s string) (*Pod, error)
- func (mc *Client) Rating(args map[string]interface{}) (ResultSet[*Rating], error)
- func (mc *Client) Recent(count int) (ResultSet[*Release], error)
- func (mc *Client) Release(s string) (*Release, error)
- func (mc *Client) ReleaseSearch(args map[string]interface{}) (ResultSet[*Release], error)
- func (mc *Client) ReleasedToday() (ResultSet[*Release], error)
- func (mc *Client) ReverseDependencies(s string) (ResultSet[*Release], error)
- func (mc *Client) UserAgent() string
- type Cover
- type Distribution
- type DownloadURL
- type Favorite
- type File
- type Maturity
- type Mirror
- type Module
- type Package
- type Permission
- type Phase
- type Pod
- type Rating
- type Relationship
- type Release
- type Request
- func (r *Request[T]) DisableDebug()
- func (r *Request[T]) EnableDebug()
- func (r *Request[T]) Fetch(s string, m map[string]interface{}) (T, error)
- func (r *Request[T]) IsDebug() bool
- func (r *Request[T]) SSearch(params map[string]interface{}) (*Scroll[T], error)
- func (r *Request[T]) SetClient(mc *Client) error
- type ResultSet
- type Scroll
- type Stat
- type Status
- type Type
Constants ¶
View Source
const ( DefaultScrollSize = 100 DefaultScrollTime = 5 * time.Minute APIVersion = "v1" UserAgent = "perl_utils.metacpan.client/" + pui.PackageVersion MetaCPANURL = "https://metacpan.org" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Author ¶
type Author struct { Blog []struct { URL string `json:"url"` Feed string `json:"feed"` } `json:"blog"` Donation []struct { Name string `json:"name"` ID string `json:"id"` } `json:"donation"` Links struct { BackCPANDirectory string `json:"backpan_directory"` CPANDirectory string `json:"cpan_directory"` CPANTS string `json:"cpants"` CPANTestersMatrix string `json:"cpantesters_matrix"` CPANTestersReports string `json:"cpantesters_reports"` MetaCPANExplorer string `json:"metacpan_explorer"` } `json:"links"` PerlMongers []struct { Name string `json:"name"` ID string `json:"id"` } `json:"perl_mongers"` Profile []struct { Name string `json:"name"` ID string `json:"id"` } `json:"profile"` ASCIIName string `json:"ascii_name"` City string `json:"city"` Country string `json:"country"` Directory string `json:"dir"` Email []string `json:"email"` Extra map[string]string `json:"extra"` GravatarUrl string `json:"gravatar_url"` Name string `json:"name"` PauseID string `json:"pauseid"` Region string `json:"region"` ReleaseCount map[string]int `json:"release_count"` Updated string `json:"updated"` User string `json:"user"` Website []string `json:"website"` // contains filtered or unexported fields }
func (*Author) MetaCPANURL ¶
func (*Author) UnmarshalJSON ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main interface to the MetaCPAN API. It is equivalent to MetaCPAN::Client in Perl. It is thread-safe.
func NewClient ¶
func NewClient(scrollSize uint16, scrollTime time.Duration, debug bool, domains []string) (*Client, error)
NewClient returns a new MetaCPAN client. If domain is empty, the default domain is used ("https://fastapi.metacpan.org").
func (*Client) AllDistributions ¶
func (mc *Client) AllDistributions() (ResultSet[*Distribution], error)
func (*Client) AuthorSearch ¶
func (*Client) AutocompleteSuggest ¶
func (*Client) Distribution ¶
func (mc *Client) Distribution(s string) (*Distribution, error)
func (*Client) DistributionSearch ¶
func (mc *Client) DistributionSearch(args map[string]interface{}) ( ResultSet[*Distribution], error)
func (*Client) DownloadURL ¶
func (*Client) ModuleSearch ¶
func (*Client) Permission ¶
func (mc *Client) Permission(s string) (*Permission, error)
func (*Client) ReleaseSearch ¶
func (*Client) ReverseDependencies ¶
type Cover ¶
type Cover struct { Criteria struct { Branch string `json:"branch"` Condition string `json:"condition"` Statement string `json:"statement"` Subroutine string `json:"subroutine"` Total string `json:"total"` } `json:"criteria"` Distribution string `json:"Distribution"` Release string `json:"release"` Version version.JSON `json:"version"` }
type Distribution ¶
type Distribution struct { Name string `json:"name"` Bugs map[string]map[string]interface{} `json:"bugs"` River struct { Bucket int `json:"bucket"` Immediate int `json:"storm"` Total int `json:"total"` } `json:"river"` // contains filtered or unexported fields }
func (*Distribution) Github ¶
func (d *Distribution) Github() map[string]interface{}
func (*Distribution) RT ¶
func (d *Distribution) RT() map[string]interface{}
type DownloadURL ¶
type File ¶
type File struct { Module []struct { Name string `json:"name"` Indexed bool `json:"indexed"` Authorized bool `json:"authorized"` Version version.JSON `json:"version"` VersionNumified float64 `json:"version_numified"` AssociatedPod string `json:"associated_pod"` } `json:"module"` Stat struct { MTime int `json:"mtime"` Mode int `json:"mode"` Size int `json:"size"` } `json:"stat"` Abstract string `json:"abstract"` Author string `json:"author"` Authorized bool `json:"authorized"` Binary bool `json:"binary"` Date iso8601.Time `json:"date"` Deprecated bool `json:"deprecated"` Description string `json:"description"` Directory bool `json:"directory"` Distribution string `json:"distribution"` Documentation string `json:"documentation"` DownloadURL string `json:"download_url"` ID string `json:"id"` Indexed bool `json:"indexed"` Level int `json:"level"` Maturity Maturity `json:"maturity"` Mime string `json:"mime"` Name string `json:"name"` Path string `json:"path"` PodLines [][]int `json:"pod_lines"` Release string `json:"release"` SLOC int `json:"sloc"` Status string `json:"status"` Version version.JSON `json:"version"` VersionNumified float64 `json:"version_numified"` // contains filtered or unexported fields }
func (*File) MetaCPANURL ¶
type Mirror ¶
type Mirror struct { AKAName string `json:"aka_name"` AOrCName string `json:"A_or_CNAME"` CCode string `json:"ccode"` City string `json:"city"` Contact []string `json:"contact"` Country string `json:"country"` DNSRR string `json:"dnsrr"` FTP string `json:"ftp"` Freq string `json:"freq"` HTTP string `json:"http"` InceptDate time.Time `json:"inceptdate"` Location []string `json:"location"` Name string `json:"name"` Note string `json:"note"` Organization string `json:"org"` RSync string `json:"rsync"` Region string `json:"region"` ReitreDate time.Time `json:"reitredate"` Src string `json:"src"` Tz string `json:"tz"` }
type Module ¶
type Module File
func (*Module) MetaCPANURL ¶
func (*Module) Permission ¶
func (m *Module) Permission() (*Permission, error)
type Permission ¶
type Pod ¶
type Rating ¶
type Rating struct { Date string `json:"date"` Release string `json:"release"` Author string `json:"author"` Details string `json:"details"` Rating string `json:"rating"` Distribution string `json:"distribution"` Helpful int `json:"helpful"` User string `json:"user"` // contains filtered or unexported fields }
type Relationship ¶
type Relationship int
const ( RelationshipUndef Relationship = iota RelationshipRequires RelationshipRecommends RelationshipSuggests RelationshipConflicts RelationshipXSpec RelationshipXMentions )
func (*Relationship) MarshalJSON ¶
func (r *Relationship) MarshalJSON() ([]byte, error)
func (*Relationship) String ¶
func (r *Relationship) String() string
func (*Relationship) UnmarshalJSON ¶
func (r *Relationship) UnmarshalJSON(b []byte) error
type Release ¶
type Release struct { Dependency []struct { Phase Phase `json:"phase"` Relationship Relationship `json:"relationship"` Module string `json:"module"` Version version.JSON `json:"version"` } `json:"dependency"` Stat struct { MTime int `json:"mtime"` Mode int `json:"mode"` Size int `json:"size"` } `json:"stat"` Tests struct { Unknown int `json:"unknown"` Pass int `json:"pass"` Fail int `json:"fail"` NA int `json:"na"` } `json:"tests"` Abstract string `json:"abstract"` Archive string `json:"archive"` Author string `json:"author"` Authorized bool `json:"authorized"` ChecksumMD5 string `json:"checksum_md5"` ChecksumSHA256 string `json:"checksum_sha256"` Date string `json:"date"` Deprecated bool `json:"deprecated"` Distribution string `json:"Distribution"` DownloadURL string `json:"download_url"` First bool `json:"first"` License []string `json:"license"` MainModule string `json:"main_module"` Maturity Maturity `json:"maturity"` Metadata cm.Spec `json:"metadata"` Name string `json:"name"` Provides []string `json:"provides"` Resources cm.Resources `json:"resources"` Status Status `json:"status"` Version version.JSON `json:"version"` VersionNumified float64 `json:"version_numified"` // contains filtered or unexported fields }
func (*Release) MetaCPANURL ¶
func (*Release) UnmarshalJSON ¶
type Request ¶
type Request[T result] struct {
// contains filtered or unexported fields
}
func NewRequest ¶
func (*Request[T]) DisableDebug ¶
func (r *Request[T]) DisableDebug()
func (*Request[T]) EnableDebug ¶
func (r *Request[T]) EnableDebug()
type Scroll ¶
type Scroll[T result] struct {
// contains filtered or unexported fields
}
func (*Scroll[T]) UnmarshalJSON ¶
type Stat ¶
func (*Stat) UnmarshalJSON ¶
Source Files
¶
- author.go
- client.go
- cover.go
- distribution.go
- doc.go
- download_url.go
- enum.go
- favorite.go
- file.go
- maturity.go
- mirror.go
- module.go
- package.go
- permission.go
- phase.go
- pod.go
- rating.go
- relationship.go
- release.go
- request.go
- result.go
- result_set.go
- scroll.go
- status.go
- transport.go
- type.go
- util.go
- wrapper.go
Click to show internal directories.
Click to hide internal directories.