organize

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Bookmark

type Bookmark struct {
	ID           int64    `json:"id"`
	Title        string   `json:"title"`
	Link         string   `json:"link"`
	Excerpt      string   `json:"excerpt"`
	Tags         []string `json:"tags"`
	CollectionID int64    `json:"collectionId"`
}

type Change

type Change struct {
	ID   int64    `json:"id"`
	Tags []string `json:"tags,omitempty"`
	To   *int64   `json:"collectionId,omitempty"`
}

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 NewContext(ctx context.Context, api *raindrop.Client, ids []int64, scope Scope, policy Policy) (LibraryContext, error)

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"`
}

func NewPlan

func NewPlan(ctx context.Context, api *raindrop.Client, action string, collection int64, ids []int64, tags []string, to int64) (Plan, error)

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"`
}

type Result

type Result struct {
	Status      string  `json:"status"`
	Applied     []int64 `json:"applied"`
	Remaining   []int64 `json:"remaining"`
	UncertainID int64   `json:"uncertainId,omitempty"`
	Error       string  `json:"error,omitempty"`
}

func Apply

func Apply(ctx context.Context, api *raindrop.Client, plan Plan, yes bool) (Result, error)

Apply verifies every precondition before the first write. Raindrop has no transaction for this workflow: a later failure may leave earlier changes applied.

type Scope

type Scope struct {
	CollectionID int64  `json:"collectionId"`
	Search       string `json:"search,omitempty"`
	Page         int    `json:"page"`
	PerPage      int    `json:"perPage"`
	ExplicitIDs  bool   `json:"explicitIds"`
}

type Suggestion

type Suggestion struct {
	Change
	Reason      string `json:"reason"`
	NeedsReview *bool  `json:"needsReview"`
}

Jump to

Keyboard shortcuts

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