Documentation
¶
Overview ¶
Package resolver owns the command-scoped semantic resolution of Pixiv targets. It does not open a client or perform network I/O except through an explicitly supplied bare-ID probe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BareIDPolicy ¶
type BareIDPolicy struct {
Candidates []string
Probe func(context.Context, int64, TypeSpec) ProbeOutcome
}
BareIDPolicy enables a controlled probe only for a contract that explicitly freezes its candidate namespaces. A probe must report whether each candidate was found, absent, forbidden, or unavailable; the resolver never guesses a type from an unclassified error.
type Contract ¶
type Contract struct {
Operation string
DefaultType string
Types []TypeSpec
URLKinds map[pixiv.ReferenceKind]URLTypeRelation
BareID *BareIDPolicy
}
Contract contains the command-specific input and conflict rules. It is a policy value rather than a universal entity union: every command declares only the type values, URL kinds, and optional probe candidates it supports.
type Input ¶
Input is the value accepted by a command resolver. Exactly one of Value and Record must be supplied. Type is the command's already-parsed type selector; an empty Type uses Contract.DefaultType or URL inference.
type ProbeOutcome ¶
type ProbeOutcome struct {
Status ProbeStatus
Err error
}
ProbeOutcome is returned by BareIDPolicy.Probe. Err should be a classified SDK error for forbidden or network outcomes; the status remains authoritative and prevents the resolver from silently trying another namespace.
type ProbeStatus ¶
type ProbeStatus string
ProbeStatus is the outcome class returned by a controlled bare-ID probe.
const ( ProbeFound ProbeStatus = "found" ProbeNotFound ProbeStatus = "not_found" ProbeForbidden ProbeStatus = "forbidden" ProbeNetworkError ProbeStatus = "network_error" ProbeIndeterminate ProbeStatus = "indeterminate" )
type ResultKind ¶
type ResultKind string
ResultKind identifies the content returned or mutated by a command.
const ( ResultKindArtwork ResultKind = "artwork" ResultKindNovel ResultKind = "novel" ResultKindUser ResultKind = "user" ResultKindSeries ResultKind = "series" ResultKindComment ResultKind = "comment" ResultKindTag ResultKind = "tag" )
type Subtype ¶
type Subtype string
Subtype is an endpoint-specific content subtype. It is deliberately separate from both the input target namespace and the result kind.
type Target ¶
type Target struct {
ID int64
TargetKind TargetKind
ResultKind ResultKind
Subtype Subtype
ReferenceKind pixiv.ReferenceKind
OwnerUserID int64
All bool
Source Source
}
Target is the resolved identity consumed by a command owner. TargetKind is the input namespace, ResultKind is the selected operation content, and ReferenceKind preserves URL-specific distinctions such as user bookmarks or artwork series. All is a selector and is never represented as a Subtype.
type TargetKind ¶
type TargetKind string
TargetKind identifies the input namespace selected by a command contract. URL-specific identities such as user_bookmarks and artwork_series remain in Target.ReferenceKind rather than being collapsed into a new global kind.
const ( TargetKindArtwork TargetKind = "artwork" TargetKindNovel TargetKind = "novel" TargetKindUser TargetKind = "user" TargetKindSeries TargetKind = "series" TargetKindComment TargetKind = "comment" )
type TypeSpec ¶
type TypeSpec struct {
Name string
ResultKind ResultKind
Subtype Subtype
BareReferenceKind pixiv.ReferenceKind
// BareTargetKind represents an input identity that has no supported Pixiv
// page reference, such as a comment ID. When set, it must agree with the
// target kind derived from BareReferenceKind, if one is also provided.
BareTargetKind TargetKind
All bool
}
TypeSpec describes one type value that a particular command contract accepts. BareReferenceKind is the namespace used when the same type is supplied with a numeric ID. Bookmark list, for example, maps artwork and novel result selectors to a user bare-ID namespace.
type URLTypeRelation ¶
type URLTypeRelation string
URLTypeRelation controls whether a parsed URL's declared namespace must agree with the command's selected result type.
const ( // URLTypeMustMatchResult is used by detail, series, and work mutations. URLTypeMustMatchResult URLTypeRelation = "must_match_result" // URLTypeIndependent allows an owner URL to select a different result kind, // such as a user URL with bookmark --type novel. URLTypeIndependent URLTypeRelation = "independent" )