Documentation
¶
Index ¶
- Constants
- Variables
- func ApplicationCmd() *cobra.Command
- func FolderCmd() *cobra.Command
- func FolderRename(baseUrl string, folderId string, newName string) error
- func FolderUpdate(baseUrl string, folderId string, newName string, newDescription string, ...) error
- func GetCurrentLibraryIsAlreadyTargetError(currLib string) error
- func IsEagleNotOpenOrUnavailableError(err error) bool
- func IsValidItemID(id string) bool
- func ItemAddBookmark(baseUrl string, item ItemAddBookmarkOptions) error
- func ItemAddFromPath(baseUrl string, item ItemAddFromPathOptions) error
- func ItemAddFromPaths(baseUrl string, items []ItemAddFromPathOptions) error
- func ItemAddFromUrl(baseUrl string, item ItemAddFromUrlOptions) error
- func ItemAddFromUrls(baseUrl string, items []ItemAddFromUrlOptions, folderId string) error
- func ItemCmd() *cobra.Command
- func ItemMoveToTrash(baseUrl string, ids []string) error
- func ItemRefreshPalette(baseUrl string, id string) error
- func ItemRefreshThumbnail(baseUrl string, id string) error
- func ItemThumbnail(baseUrl string, id string) (string, error)
- func LibraryCmd() *cobra.Command
- func LibraryHistory(baseURL string) ([]string, error)
- func LibraryIcon(baseURL string) (string, error)
- func LibrarySwitch(baseURL string, libraryPath string) error
- func RegisterGroupRoutes(g *echo.Group)
- func RegisterRootRoutes(server *echo.Echo)
- func Request[T any](method string, url string, body io.Reader, urlParam *url.Values, v *T) error
- type ApiItem
- type ApiKeyErr
- type ApplicationInfoData
- type BaseItem
- type BulkItem
- type Condition
- type EagleApiErr
- type EagleApiResponse
- type EagleArray
- type EagleMessage
- type EagleResponse
- type Folder
- type FolderCreateResponse
- type FolderDetailOverview
- type FolderRenameResponse
- type FolderStyles
- type FolderUpdateResponse
- type Item
- type ItemAddBookmarkOptions
- type ItemAddFromPathOptions
- type ItemAddFromUrlOptions
- type ItemListOptions
- type ItemUpdateOptions
- type Library
- type LibraryData
- type LibraryInfoResponse
- type ListItem
- type Palette
- type QuickAccess
- type Rule
- type SmartFolder
- type TagsGroup
- type ThumbnailData
Constants ¶
const (
MaxEagleItemIDLength = 15
)
Variables ¶
var (
ErrStatusErr = fmt.Errorf("response key 'status' was not 'success'")
)
var LibraryIsAlreadyTargetErr = errors.New("Library is already active")
sentinel errors
Functions ¶
func FolderUpdate ¶
func FolderUpdate(baseUrl string, folderId string, newName string, newDescription string, newColor string) error
colors
func GetCurrentLibraryIsAlreadyTargetError ¶ added in v0.0.7
constructor
func IsEagleNotOpenOrUnavailableError ¶ added in v0.1.0
func ItemAddBookmark ¶
func ItemAddBookmark(baseUrl string, item ItemAddBookmarkOptions) error
endpoint only returns `status`
func ItemAddFromPath ¶
func ItemAddFromPath(baseUrl string, item ItemAddFromPathOptions) error
returns status only. TODO: endpoint which adds item & returns itemId
func ItemAddFromPaths ¶
func ItemAddFromPaths(baseUrl string, items []ItemAddFromPathOptions) error
func ItemAddFromUrl ¶
func ItemAddFromUrl(baseUrl string, item ItemAddFromUrlOptions) error
endpoint only returns `status`
func ItemAddFromUrls ¶
func ItemAddFromUrls(baseUrl string, items []ItemAddFromUrlOptions, folderId string) error
endpoint only returns `status`
func ItemMoveToTrash ¶
func ItemRefreshPalette ¶
func ItemRefreshThumbnail ¶
func ItemThumbnail ¶
returns thumbnail path and error
func LibraryCmd ¶ added in v0.1.0
func LibraryHistory ¶
returns []string paths to libraries /api/library/history
func LibraryIcon ¶
returns string iconpath (broken)
func LibrarySwitch ¶
cleans libraryPath and tries to switch. /api/library/switch endpoint only returns `status`
func RegisterGroupRoutes ¶
func RegisterRootRoutes ¶
Types ¶
type ApiItem ¶
type ApiItem struct {
ID string `json:"id"`
Name string `json:"name"`
Size int `json:"size"`
Ext string `json:"ext"`
Tags []string `json:"tags"`
Folders []string `json:"folders"`
IsDeleted bool `json:"isDeleted"`
URL string `json:"url"`
Annotation string `json:"annotation"`
ModificationTime int64 `json:"modificationTime"`
Width int `json:"width"`
Height int `json:"height"`
NoThumbnail *bool `json:"noThumbnail,omitempty"`
LastModified int64 `json:"lastModified"`
Palettes []Palette `json:"palettes"`
Star *int `json:"star,omitempty"`
}
Fields returned by Eagle API endpoints (item/list, item/info, item/update).
NOTE:
- item/info includes the optional key `noThumbnail`.
- item/update includes `noThumbnail` and the optional key `star`.
- For optional keys null represents unset
func ItemUpdate ¶
func ItemUpdate(baseUrl string, item ItemUpdateOptions) (respItem ApiItem, err error)
type ApplicationInfoData ¶
type ApplicationInfoData struct {
Version string `json:"version"`
PreReleaseVersion string `json:"preReleaseVersion,omitempty"`
BuildVersion string `json:"buildVersion"`
ExecPath string `json:"execPath"`
Platform string `json:"platform"`
}
func ApplicationInfo ¶
func ApplicationInfo(baseUrl string) (ApplicationInfoData, error)
GET Get detailed information on the Eagle App currently running. In most cases, this could be used to determine whether certain functions are available on the user's device. <https://api.eagle.cool/application/info>
type EagleApiErr ¶
func (*EagleApiErr) Error ¶
func (e *EagleApiErr) Error() string
type EagleApiResponse ¶
type EagleApiResponse struct {
Status string
Data []interface{} // optional
}
type EagleArray ¶
type EagleArray struct {
EagleResponse
Data []string
}
for endpoints that return an array of strings.
type EagleMessage ¶
type EagleMessage struct {
EagleResponse
Data any
}
type EagleResponse ¶
type EagleResponse struct {
Status string `json:"status"`
}
maybe? func (data EagleResponse) GetData() {}
type Folder ¶
type Folder struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Children []Folder `json:"children"`
ModificationTime int64 `json:"modificationTime,omitempty"`
Tags []string `json:"tags,omitempty"`
IconColor string `json:"iconColor,omitempty"`
Password string `json:"password,omitempty"`
PasswordTips string `json:"passwordTips,omitempty"`
CoverID string `json:"coverId,omitempty"`
OrderBy string `json:"orderBy,omitempty"`
SortIncrease bool `json:"sortIncrease,omitempty"`
Icon string `json:"icon,omitempty"`
}
type FolderCreateResponse ¶
type FolderCreateResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ModificationTime int `json:"modificationTime"`
}
todo rename
func FolderCreate ¶
func FolderCreate(baseUrl string, folderName string) (FolderCreateResponse, error)
type FolderDetailOverview ¶
type FolderDetailOverview struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Children []any `json:"children"`
ModificationTime int `json:"modificationTime"`
Tags []string `json:"tags"`
Password *string `json:"password"` // optional
PasswordTips *string `json:"passwordTips"` // optional
Images *[]string `json:"images"` // optional
IsExpand bool `json:"isExpand"`
ImageCount int `json:"imageCount"`
DescendantImageCount int `json:"descendantImageCount"`
Pinyin string `json:"pinyin"`
ExtendTags []string `json:"extendTags"`
}
overview information of a folder. for some reason, listrecent has more fields... pointers are optional fields
func FolderList ¶
func FolderList(baseUrl string) ([]FolderDetailOverview, error)
func FolderListRecent ¶
func FolderListRecent(baseUrl string) ([]FolderDetailOverview, error)
type FolderRenameResponse ¶
type FolderRenameResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ModificationTime int `json:"modificationTime"`
IsExpand bool `json:"isExpand"`
Size int `json:"size"`
Vstype string `json:"vstype"`
IsVisible bool `json:"isVisible"`
HashKey string `json:"$$hashKey"`
NewFolderName string `json:"newFolderName"`
Editable bool `json:"editable"`
Pinyin string `json:"pinyin"`
}
type FolderStyles ¶
type FolderUpdateResponse ¶
type FolderUpdateResponse struct {
ID string `json:"id"`
Name string `json:"name"`
ModificationTime int `json:"modificationTime"`
IsExpand bool `json:"isExpand"`
Size int `json:"size"`
Vstype string `json:"vstype"`
IsVisible bool `json:"isVisible"`
HashKey string `json:"$$hashKey"`
NewFolderName string `json:"newFolderName"`
Editable bool `json:"editable"`
Pinyin string `json:"pinyin"`
}
type ItemAddBookmarkOptions ¶
type ItemAddBookmarkOptions struct {
URL string `json:"url" flag:"URL of the bookmark"`
Name string `json:"name" flag:"Display name for the bookmark"`
Base64 string `json:"base64,omitempty" flag:"Optional base64-encoded data"`
Tags []string `json:"tags,omitempty" flag:"Optional list of tag names"`
ModificationTime string `json:"modificationTime,omitempty" flag:"DESC TODO"`
FolderID string `json:"folderId,omitempty" flag:"Optional ID of target folder to place the bookmark"`
}
give better name
func (ItemAddBookmarkOptions) Validate ¶ added in v0.1.0
func (o ItemAddBookmarkOptions) Validate() error
func (ItemAddBookmarkOptions) WithDefaults ¶ added in v0.1.0
func (o ItemAddBookmarkOptions) WithDefaults() ItemAddBookmarkOptions
type ItemAddFromPathOptions ¶
type ItemAddFromPathOptions struct {
Path string `json:"path" flag:"Required, the path of the local file."`
Name string `json:"name,omitempty" flag:"Required, the name of the image to be added. (not really req)"`
Website string `json:"website,omitempty" flag:"The Address of the source of the image."`
Annotation string `json:"annotation,omitempty" flag:"The annotation for the image."`
Tags []string `json:"tags,omitempty" flag:"Tags for the image."`
FolderId string `json:"folderId,omitempty" flag:"If this parameter is defined, the image will be added to the corresponding folder."`
}
func (ItemAddFromPathOptions) Validate ¶ added in v0.1.0
func (o ItemAddFromPathOptions) Validate() error
type ItemAddFromUrlOptions ¶
type ItemAddFromUrlOptions struct {
URL string `json:"url" flag:"url to item to add"`
Name string `json:"name" flag:"name to use for item"`
Website string `json:"website,omitempty" flag:"associated website of item"`
Tags []string `json:"tags,omitempty" flag:"tags to apply to item"`
Star *int `json:"star,omitempty" flag:"star rating of the item"`
Annotation string `json:"annotation,omitempty" flag:"annotation text for the item"`
ModificationTime int `json:"modificationTime,omitempty" flag:"modification time in epoch milliseconds"`
FolderID *string `json:"folderId,omitempty" flag:"folder id to place the item in"`
Headers map[string]string `json:"headers,omitempty" flag:"http headers to be sent with requests"`
}
give a better name defaults to use url as item name in eagle bulk (addFromUrls) does not include `star` or `folderId` pointers represent optional keys and null represents unset
func (ItemAddFromUrlOptions) Validate ¶ added in v0.1.0
func (o ItemAddFromUrlOptions) Validate() error
func (ItemAddFromUrlOptions) WithDefaults ¶ added in v0.1.0
func (o ItemAddFromUrlOptions) WithDefaults() ItemAddFromUrlOptions
type ItemListOptions ¶
type ItemListOptions struct {
Limit int `json:"limit" flag:"The number of items to be displayed. the default number is 200"`
Offset int `json:"offset,omitempty" flag:"Offset a collection of results from the api. Start with 0."`
OrderBy string `` /* 143-byte string literal not displayed */
Keyword string `json:"keyword,omitempty" flag:"Filter by the keyword"`
Ext string `json:"ext,omitempty" flag:"Filter by the extension type, e.g.: jpg , png"`
Tags string `json:"tags,omitempty" flag:"Filter by tags. Use , to divide different tags. E.g.: Design, Poster"`
Folders string `json:"folders,omitempty" flag:"Filter by Folders. Use , to divide folder IDs. E.g.: KAY6NTU6UYI5Q,KBJ8Z60O88VMG"`
}
func (ItemListOptions) WithDefaults ¶ added in v0.1.0
func (o ItemListOptions) WithDefaults() ItemListOptions
type ItemUpdateOptions ¶
type ItemUpdateOptions struct {
ID string `json:"id" flag:"unique identifier"`
Tags *[]string `json:"tags" flag:"list of tags associated with the item"`
Annotation *string `json:"annotation" flag:"user-provided annotation or note"`
URL *string `json:"url" flag:"web URL associated with the item"`
Star *int `json:"star" flag:"star rating from 1-5, nil for no rating"`
}
pointers represent optional keys and null represents unset
func (ItemUpdateOptions) Validate ¶ added in v0.1.0
func (o ItemUpdateOptions) Validate() error
type LibraryData ¶
type LibraryData struct {
Folders []Folder `json:"folders"`
SmartFolders []SmartFolder `json:"smartFolders"`
QuickAccess []QuickAccess `json:"quickAccess"`
TagsGroups []TagsGroup `json:"tagsGroups"`
ModificationTime int64 `json:"modificationTime"`
ApplicationVersion string `json:"applicationVersion"`
Library Library `json:"library"`
}
func LibraryInfo ¶
func LibraryInfo(baseURL string) (*LibraryData, error)
type LibraryInfoResponse ¶
type LibraryInfoResponse struct {
Data LibraryData `json:"data"`
Status string `json:"status"`
}
type ListItem ¶
type ListItem struct {
Id string `json:"id"`
Name string `json:"name"`
// Size
// ext
Tags []string `json:"tags"`
Folders []string `json:"folders"`
// isDeleted
URL string `json:"url"`
Annotation string `json:"annotation"`
ModificationTime int64 `json:"modificationTime"`
// height
// width
// lastModified
// palettes
Website string `json:"website"`
}
type QuickAccess ¶
type SmartFolder ¶
type SmartFolder struct {
ID string `json:"id"`
Icon string `json:"icon"`
Name string `json:"name"`
Description string `json:"description"`
ModificationTime int64 `json:"modificationTime"`
Conditions []Condition `json:"conditions"`
OrderBy string `json:"orderBy,omitempty"`
SortIncrease bool `json:"sortIncrease,omitempty"`
}