Documentation
¶
Overview ¶
Package karakeep implements the Karakeep bookmark provider.
Index ¶
- Constants
- func GetWebhookToken() string
- type ArchiveResponse
- type AttachTagsResponse
- type Bookmark
- type BookmarkContent
- type BookmarkTagRequest
- type BookmarkTagsInner
- type BookmarksBookmarkIdAssets
- type BookmarksQuery
- type BookmarksResponse
- type CheckUrlResponse
- type DetachTagsResponse
- type Karakeep
- func (i *Karakeep) ArchiveBookmark(ctx context.Context, id string) (bool, error)
- func (i *Karakeep) AttachTagsToBookmark(ctx context.Context, bookmarkId string, tags []string) ([]string, error)
- func (i *Karakeep) CheckUrlExists(ctx context.Context, url string) (*string, error)
- func (i *Karakeep) CreateBookmark(ctx context.Context, url string) (*Bookmark, error)
- func (i *Karakeep) DetachTagsToBookmark(ctx context.Context, bookmarkId string, tags []string) ([]string, error)
- func (i *Karakeep) GetAllBookmarks(ctx context.Context, query *BookmarksQuery) (*BookmarksResponse, error)
- func (i *Karakeep) GetAllTags(ctx context.Context) ([]Tag, error)
- func (i *Karakeep) GetBookmark(ctx context.Context, id string) (*Bookmark, error)
- func (i *Karakeep) SearchBookmarks(ctx context.Context, query *SearchBookmarksQuery) (*BookmarksResponse, error)
- type SearchBookmarksQuery
- type Tag
- type TagNumBookmarksByAttachedType
- type TagsResponse
- type WebhookPayload
Constants ¶
const ( ID = "karakeep" EndpointKey = "endpoint" ApikeyKey = "api_key" WebhookTokenKey = "webhook_token" )
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 ¶
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 BookmarksQuery ¶
type BookmarksResponse ¶
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 ¶
NewKarakeep creates a Karakeep client with the given endpoint and API key.
func (*Karakeep) ArchiveBookmark ¶
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 ¶
CheckUrlExists checks whether a bookmark already exists for the given URL.
func (*Karakeep) CreateBookmark ¶
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 ¶
GetAllTags lists all tags.
func (*Karakeep) GetBookmark ¶
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 Tag ¶
type Tag struct {
Id string `json:"id"`
Name string `json:"name"`
NumBookmarks float32 `json:"numBookmarks"`
NumBookmarksByAttachedType TagNumBookmarksByAttachedType `json:"numBookmarksByAttachedType"`
}
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.