Documentation
¶
Overview ¶
Package organize implements reviewable, account-bound cleanup plans.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreatePlan ¶
type CreatePlan struct {
Version int `json:"version"`
Action string `json:"action"`
AccountID int64 `json:"accountId"`
CreatedAt string `json:"createdAt"`
Items []raindrop.CreateItem `json:"items"`
Digest string `json:"digest"`
}
func NewCreatePlan ¶
func NewCreatePlan(ctx context.Context, api *raindrop.Client, items []raindrop.CreateItem) (CreatePlan, error)
type CreateResult ¶
type CreateResult struct {
Status string `json:"status"`
Requested int `json:"requested"`
Items []raindrop.Raindrop `json:"items,omitempty"`
}
func ApplyCreatePlan ¶
func ApplyCreatePlan(ctx context.Context, api *raindrop.Client, plan CreatePlan, confirm bool) (CreateResult, error)
type LibraryContext ¶
type LibraryContext struct {
Version int `json:"version"`
AccountID int64 `json:"accountId"`
CreatedAt string `json:"createdAt"`
Scope Scope `json:"scope"`
Policy Policy `json:"policy"`
Tags []raindrop.Tag `json:"tags"`
Collections []raindrop.CollectionPath `json:"collections"`
Bookmarks []Bookmark `json:"bookmarks"`
Snapshots []raindrop.Raindrop `json:"snapshots,omitempty"`
Digest string `json:"digest"`
}
func NewContext ¶
func (LibraryContext) ModelView ¶
func (c LibraryContext) ModelView() LibraryContext
ModelView omits private notes and full apply preconditions. Retain the local context file (or server cache) to build a plan from the model's response.
type Plan ¶
type Plan struct {
Version int `json:"version"`
AccountID int64 `json:"accountId"`
CreatedAt string `json:"createdAt"`
Action string `json:"action"`
CollectionID int64 `json:"collectionId"`
Tags []string `json:"tags,omitempty"`
To int64 `json:"to,omitempty"`
Changes []Change `json:"changes,omitempty"`
Items []raindrop.Raindrop `json:"items"`
Digest string `json:"digest"`
}
type PlannedProposal ¶
type PlannedProposal struct {
ContextDigest string `json:"contextDigest"`
Plan *Plan `json:"plan,omitempty"`
NeedsReview []Suggestion `json:"needsReview"`
Unchanged []int64 `json:"unchanged"`
Unmentioned []int64 `json:"unmentioned"`
}
func PlanProposal ¶
func PlanProposal(c LibraryContext, proposal Proposal) (PlannedProposal, error)
PlanProposal validates all suggestions before constructing any apply file. Validation is structural, not a guarantee that a model's judgement is correct.
type Policy ¶
type Policy struct {
Instructions string `json:"instructions,omitempty"`
TagRules map[string]string `json:"tagRules,omitempty"`
CollectionRules map[string]string `json:"collectionRules,omitempty"`
AllowNewTags bool `json:"allowNewTags"`
}
Policy adds meanings to existing names. New names must be explicitly enabled and declared in TagRules; models cannot create arbitrary names.
type Proposal ¶
type Proposal struct {
ContextDigest string `json:"contextDigest"`
Suggestions []Suggestion `json:"suggestions"`
}