karakeep

package
v0.98.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package karakeep implements the Karakeep bookmark provider.

Index

Constants

View Source
const (
	ID              = "karakeep"
	EndpointKey     = "endpoint"
	ApikeyKey       = "api_key"
	WebhookTokenKey = "webhook_token"
)
View Source
const (
	MaxPageSize = 100
)

Variables

This section is empty.

Functions

func GetWebhookToken

func GetWebhookToken() string

GetWebhookToken reads the webhook Bearer token from the karakeep provider config.

Types

type ArchiveResponse

type ArchiveResponse struct {
	Archived bool `json:"archived"`
}

type AttachTagsResponse

type AttachTagsResponse struct {
	Attached []string `json:"attached"`
}

type Bookmark

type Bookmark struct {
	Id            string  `json:"id"`
	CreatedAt     string  `json:"createdAt"`
	ModifiedAt    *string `json:"modifiedAt,omitzero"`
	Title         *string `json:"title,omitzero"`
	Archived      bool    `json:"archived"`
	Favourited    bool    `json:"favourited"`
	TaggingStatus *string `json:"taggingStatus,omitzero"`
	// summarization status was added in API responses starting
	// with the new /bookmarks/:id endpoint and is not returned
	// by the older list call.  Use a pointer to distinguish
	// missing values.
	SummarizationStatus *string                     `json:"summarizationStatus,omitzero"`
	Source              *string                     `json:"source,omitzero"`
	UserId              *string                     `json:"userId,omitzero"`
	Note                *string                     `json:"note,omitzero"`
	Summary             *string                     `json:"summary,omitzero"`
	Tags                []BookmarkTagsInner         `json:"tags"`
	Assets              []BookmarksBookmarkIdAssets `json:"assets"`
	Content             BookmarkContent             `json:"content"`
}

func (Bookmark) GetSummary

func (b Bookmark) GetSummary() string

func (Bookmark) GetTitle

func (b Bookmark) GetTitle() string

type BookmarkContent

type BookmarkContent struct {
	Type                     string  `json:"type"`
	Url                      string  `json:"url"`
	Title                    *string `json:"title,omitzero"`
	Description              *string `json:"description,omitzero"`
	ImageUrl                 *string `json:"imageUrl,omitzero"`
	ImageAssetId             *string `json:"imageAssetId,omitzero"`
	ScreenshotAssetId        *string `json:"screenshotAssetId,omitzero"`
	FullPageArchiveAssetId   *string `json:"fullPageArchiveAssetId,omitzero"`
	PrecrawledArchiveAssetId *string `json:"precrawledArchiveAssetId,omitzero"`
	VideoAssetId             *string `json:"videoAssetId,omitzero"`
	Favicon                  *string `json:"favicon,omitzero"`
	HtmlContent              *string `json:"htmlContent,omitzero"`
	CrawledAt                *string `json:"crawledAt,omitzero"`
}

type BookmarkTagRequest

type BookmarkTagRequest struct {
	TagName string `json:"tag_name"`
}

type BookmarkTagsInner

type BookmarkTagsInner struct {
	Id         string `json:"id"`
	Name       string `json:"name"`
	AttachedBy string `json:"attachedBy"`
}

type BookmarksBookmarkIdAssets

type BookmarksBookmarkIdAssets struct {
	Id        string `json:"id"`
	AssetType string `json:"assetType"`
	FileName  string `json:"fileName"`
}

type BookmarksQuery

type BookmarksQuery struct {
	Limit      int    `json:"limit"`
	Archived   bool   `json:"archived"`
	Favourited bool   `json:"favourited"`
	Cursor     string `json:"cursor"`
}

type BookmarksResponse

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

type CheckUrlResponse

type CheckUrlResponse struct {
	BookmarkId *string `json:"bookmarkId"`
}

type DetachTagsResponse

type DetachTagsResponse struct {
	Detached []string `json:"detached"`
}

type Karakeep

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

Karakeep is an HTTP client for the Karakeep bookmark API.

func GetClient

func GetClient() *Karakeep

GetClient builds a Karakeep client from providers.karakeep config.

func NewKarakeep

func NewKarakeep(endpoint, apiKey string) *Karakeep

NewKarakeep creates a Karakeep client with the given endpoint and API key.

func (*Karakeep) ArchiveBookmark

func (i *Karakeep) ArchiveBookmark(ctx context.Context, id string) (bool, error)

ArchiveBookmark marks a bookmark as archived.

func (*Karakeep) AttachTagsToBookmark

func (i *Karakeep) AttachTagsToBookmark(ctx context.Context, bookmarkId string, tags []string) ([]string, error)

AttachTagsToBookmark attaches the given tag names to a bookmark.

func (*Karakeep) CheckUrlExists

func (i *Karakeep) CheckUrlExists(ctx context.Context, url string) (*string, error)

CheckUrlExists checks whether a bookmark already exists for the given URL.

func (*Karakeep) CreateBookmark

func (i *Karakeep) CreateBookmark(ctx context.Context, url string) (*Bookmark, error)

CreateBookmark creates a link bookmark for the given URL.

func (*Karakeep) DetachTagsToBookmark

func (i *Karakeep) DetachTagsToBookmark(ctx context.Context, bookmarkId string, tags []string) ([]string, error)

DetachTagsToBookmark detaches the given tag names from a bookmark.

func (*Karakeep) GetAllBookmarks

func (i *Karakeep) GetAllBookmarks(ctx context.Context, query *BookmarksQuery) (*BookmarksResponse, error)

GetAllBookmarks lists bookmarks with optional filters and cursor pagination.

func (*Karakeep) GetAllTags

func (i *Karakeep) GetAllTags(ctx context.Context) ([]Tag, error)

GetAllTags lists all tags.

func (*Karakeep) GetBookmark

func (i *Karakeep) GetBookmark(ctx context.Context, id string) (*Bookmark, error)

GetBookmark retrieves a single bookmark by its ID. This corresponds to GET /bookmarks/:bookmarkId in the karakeep API and returns the full bookmark object, including fields that are not present in the list response (summarizationStatus, source, userId, etc.).

The caller is responsible for handling a nil result or any error produced by the underlying HTTP client.

func (*Karakeep) SearchBookmarks

func (i *Karakeep) SearchBookmarks(ctx context.Context, query *SearchBookmarksQuery) (*BookmarksResponse, error)

SearchBookmarks searches bookmarks with optional filters and cursor pagination.

type SearchBookmarksQuery

type SearchBookmarksQuery struct {
	Q              string `json:"q"`
	SortOrder      string `json:"sortOrder"`
	Limit          int    `json:"limit"`
	Cursor         string `json:"cursor"`
	IncludeContent bool   `json:"includeContent"`
}

type Tag

type Tag struct {
	Id                         string                        `json:"id"`
	Name                       string                        `json:"name"`
	NumBookmarks               float32                       `json:"numBookmarks"`
	NumBookmarksByAttachedType TagNumBookmarksByAttachedType `json:"numBookmarksByAttachedType"`
}

type TagNumBookmarksByAttachedType

type TagNumBookmarksByAttachedType struct {
	Ai    *float32 `json:"ai,omitzero"`
	Human *float32 `json:"human,omitzero"`
}

type TagsResponse

type TagsResponse struct {
	Tags []Tag `json:"tags"`
}

type WebhookPayload

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

WebhookPayload is the incoming Karakeep webhook request body. Shape matches apps/workers/workers/webhookWorker.ts in karakeep-app/karakeep.

Jump to

Keyboard shortcuts

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