Documentation
¶
Index ¶
- Constants
- Variables
- func FolderRename(baseUrl string, folderId string, newName string) error
- func FolderUpdate(baseUrl string, folderId string, newName string, newDescription string, ...) error
- func InvokeEagleAPIV2[T any](req *http.Request, v *T) error
- func IsEagleNotOpenErr(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 ItemMoveToTrash(baseUrl string, ids []string) error
- func ItemRefreshPalette(baseUrl string, id string) error
- func ItemRefreshThumbnail(baseUrl string, id string) error
- func ItemThumbnail(baseUrl string, itemId string) (string, error)
- 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
- func StructToURLValues(data interface{}) (url.Values, 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 EagleNotOpenErr = fmt.Errorf("Eagle is not open.")
var (
ErrStatusErr = fmt.Errorf("response key 'status' was not 'success'")
)
Functions ¶
func FolderUpdate ¶
func FolderUpdate(baseUrl string, folderId string, newName string, newDescription string, newColor string) error
colors
func InvokeEagleAPIV2 ¶
all responses have a `status` field (excl. /api/library/icon) populates pointer v with response from req
func IsEagleNotOpenErr ¶
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.
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 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 ¶
func StructToURLValues ¶ added in v0.0.4
StructToURLValues converts a struct to a url.Values map based on its json tags. This allows you to easily serialize a struct into URL query parameters.
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 []string `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"`
Name string `json:"name"`
Base64 string `json:"base64,omitempty"`
Tags []string `json:"tags,omitempty"`
ModificationTime string `json:"modificationTime,omitempty"`
FolderID string `json:"folderId,omitempty"`
}
give better name
type ItemAddFromPathOptions ¶
type ItemAddFromPathOptions struct {
Path string `json:"path"` // Required, the path of the local file.
Name string `json:"name,omitempty"` // Required, the name of the image to be added. (not really req)
Website string `json:"website,omitempty"` // The Address of the source of the image.
Annotation string `json:"annotation,omitempty"` // The annotation for the image.
Tags []string `json:"tags,omitempty"` // Tags for the image.
FolderId string `json:"folderId,omitempty"` // If this parameter is defined, the image will be added to the corresponding folder.
}
type ItemAddFromUrlOptions ¶
type ItemAddFromUrlOptions struct {
URL string `json:"url"`
Name string `json:"name"`
Website string `json:"website,omitempty"`
Tags []string `json:"tags,omitempty"`
Star *int `json:"star,omitempty"`
Annotation string `json:"annotation,omitempty"`
ModificationTime int `json:"modificationTime,omitempty"`
FolderID *string `json:"folderId,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
give a better name bulk (addFromUrls) does not include `star` or `folderId` pointers represent optional keys and null represents unset
type ItemListOptions ¶
type ItemListOptions struct {
Limit int `json:"limit"` // The number of items to be displayed. the default number is 200
Offset int `json:"offset,omitempty"` // Offset a collection of results from the api. Start with 0.
OrderBy string `json:"orderBy,omitempty"` // The sorting order.CREATEDATE , FILESIZE , NAME , RESOLUTION , add a minus sign for descending order: -FILESIZE
Keyword string `json:"keyword,omitempty"` // Filter by the keyword
Ext string `json:"ext,omitempty"` // Filter by the extension type, e.g.: jpg , png
Tags string `json:"tags,omitempty"` // Filter by tags. Use , to divide different tags. E.g.: Design, Poster
Folders string `json:"folders,omitempty"` // Filter by Folders. Use , to divide folder IDs. E.g.: KAY6NTU6UYI5Q,KBJ8Z60O88VMG
}
type ItemUpdateOptions ¶
type ItemUpdateOptions struct {
ID string `json:"id"`
Tags *[]string `json:"tags"`
Annotation *string `json:"annotation"`
URL *string `json:"url"`
Star *int `json:"star"`
}
pointers represent optional keys and null represents unset
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"`
}