karakeep

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractYouTubeID

func ExtractYouTubeID(url string) string

ExtractYouTubeID extracts the YouTube video ID from a URL.

func WebhookHandler

func WebhookHandler(processor WebhookProcessor, tokenResolver TokenResolver) http.HandlerFunc

WebhookHandler returns an HTTP handler for Karakeep webhooks. The tokenResolver maps a Bearer token to a user ID.

Types

type Bookmark

type Bookmark struct {
	ID      string `json:"id"`
	Content struct {
		Type string `json:"type"`
		URL  string `json:"url"`
	} `json:"content"`
	Tags []struct {
		Name string `json:"name"`
	} `json:"tags"`
}

Bookmark represents a Karakeep bookmark.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client interacts with the Karakeep REST API.

func NewClient

func NewClient(baseURL, apiKey string) *Client

NewClient creates a Karakeep API client.

func (*Client) AddTag

func (c *Client) AddTag(ctx context.Context, bookmarkID, tagName string) error

AddTag attaches a tag to a bookmark. Karakeep's POST endpoint is additive, so existing tags are preserved automatically.

func (*Client) GetBookmark

func (c *Client) GetBookmark(ctx context.Context, id string) (*Bookmark, error)

GetBookmark retrieves a bookmark by ID.

func (*Client) ListBookmarks

func (c *Client) ListBookmarks(ctx context.Context) ([]Bookmark, error)

ListBookmarks retrieves all bookmarks, paginating through all results.

func (*Client) UpdateNote

func (c *Client) UpdateNote(ctx context.Context, bookmarkID, note string) error

UpdateNote sets the note on a bookmark.

type ListBookmarksResponse

type ListBookmarksResponse struct {
	Bookmarks  []Bookmark `json:"bookmarks"`
	NextCursor *string    `json:"nextCursor"`
}

ListBookmarksResponse is the paginated response from the Karakeep bookmarks API.

type TokenResolver

type TokenResolver func(ctx context.Context, token string) (int, error)

TokenResolver resolves a Bearer token to a user ID.

type WebhookPayload

type WebhookPayload struct {
	BookmarkID string `json:"bookmarkId"`
	URL        string `json:"url"`
	Type       string `json:"type"`
	Operation  string `json:"operation"`
}

WebhookPayload is the payload sent by Karakeep webhooks.

type WebhookProcessor

type WebhookProcessor interface {
	ProcessVideoAsync(userID int, youtubeID, bookmarkID string)
	DeleteByBookmarkID(ctx context.Context, userID int, bookmarkID string) error
}

WebhookProcessor handles webhook events from Karakeep.

Jump to

Keyboard shortcuts

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