Skip to content

Commit a1d1025

Browse files
committed
✨ Add raindrop plugin
1 parent 7d6911f commit a1d1025

12 files changed

+1056
-0
lines changed

plugins/raindrop/.gitignore

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# Go template downloaded with gut
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
*.test
9+
*.out
10+
go.work
11+
.gut
12+
13+
# Dev files
14+
*.log
15+
devManifest.*
16+
.init
17+
18+
dist/

plugins/raindrop/.goreleaser.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
version: 2
3+
4+
before:
5+
hooks:
6+
# You may remove this if you don't use go modules.
7+
- go mod tidy
8+
9+
builds:
10+
- env:
11+
- CGO_ENABLED=0
12+
goos:
13+
- linux
14+
- windows
15+
- darwin
16+
17+
goarch:
18+
- amd64
19+
- arm64
20+
21+
archives:
22+
- format: binary
23+
24+
changelog:
25+
sort: asc
26+
filters:
27+
exclude:
28+
- "^docs:"
29+
- "^test:"

plugins/raindrop/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
files := $(wildcard *.go)
3+
4+
all: $(files)
5+
go build -o raindrop.out $(files)
6+
7+
prod: $(files)
8+
go build -o raindrop.out -ldflags "-s -w" $(files)
9+
10+
clean:
11+
rm -f notion.out
12+
13+
.PHONY: all clean

plugins/raindrop/README.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Raindrop
2+
3+
Insert/delete and query your raindrop.io bookmarks with SQL.
4+
5+
## Installation
6+
7+
```bash
8+
anyquery install raindrop
9+
```
10+
11+
## Configuration
12+
13+
1. Go to [https://app.raindrop.io/settings/integrations](https://app.raindrop.io/settings/integrations)
14+
2. Click on "Create new app"
15+
![alt text](https://github.com/julien040/anyquery/blob/main/plugins/raindrop/newApp.png)
16+
3. Give it the name you want and click on "Create"
17+
4. Click on the app you just created
18+
5. Click "Create test token" and copy the token
19+
![alt text](https://github.com/julien040/anyquery/blob/main/plugins/raindrop/newTestToken.png)
20+
6. Fill it in when requested by `anyquery` in the installation process
21+
22+
## Usage
23+
24+
```sql
25+
-- Insert a bookmark
26+
INSERT INTO raindrop_items(title, link, created_at, reminder) VALUES ('A cool SQL tool', 'https://anyquery.dev', '2024-07-10', '2024-07-20');
27+
-- Delete a bookmark
28+
DELETE FROM raindrop_items WHERE title = 'A cool SQL tool';
29+
-- Query all bookmarks
30+
SELECT * FROM raindrop_items;
31+
```
32+
33+
## Schema
34+
35+
| Column index | Column name | type |
36+
| ------------ | --------------- | ------- |
37+
| 0 | id | INTEGER |
38+
| 1 | link | TEXT |
39+
| 2 | title | TEXT |
40+
| 3 | excerpt | TEXT |
41+
| 4 | note | TEXT |
42+
| 5 | user_id | TEXT |
43+
| 6 | cover | TEXT |
44+
| 7 | tags | TEXT |
45+
| 8 | important | INTEGER |
46+
| 9 | removed | INTEGER |
47+
| 10 | created_at | TEXT |
48+
| 11 | last_updated_at | TEXT |
49+
| 12 | domain | TEXT |
50+
| 13 | collection_id | INTEGER |
51+
| 14 | reminder | TEXT |
52+
53+
## Known limitations
54+
55+
- The plugin does not support the `UPDATE` operation due to rate limiting issues with the Raindrop API. See items.go:377 in the source code for more information.
56+
- The plugin caches your bookmarks for an hour. If you want to clear the cache, you can run `SELECT clear_plugin_cache('raindrop')`, and then restart `anyquery`.
57+
- The plugin buffers the INSERT/DELETE operations and sends them in batches to the Raindrop API. This can lead to a delay in the changes appearing in your Raindrop account. If you want to flush the buffer, run a simple SELECT query like `SELECT * FROM raindrop_items LIMIT 1`.
58+
- When you insert a row, not all fields will be populated in [raindrop.io](https://raindrop.io). For example, id, user_id, removed, domain, etc.
59+
- Tags are represented as a JSON array in the database. You can use the [JSON operator](https://www.sqlite.org/json1.html#the_and_operators) like in PostgreSQL to query the data. For example, `SELECT tags ->> '$[0]' FROM raindrop_items;` will return the first tag. When inserting data, it is expected that you provide a JSON array of tags.
60+
- Date are flexible. While they are always returned as [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) strings, you can insert them in the following formats : YYYY-MM-DD, YYYY-MM-DDTHH:MM:SSZ, HH:MM:SS, or a Unix timestamp.

plugins/raindrop/go.mod

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module github.com/julien040/anyquery/plugins/raindrop
2+
3+
go 1.22.5
4+
5+
require (
6+
github.com/adrg/xdg v0.5.0
7+
github.com/dgraph-io/badger/v4 v4.2.0
8+
github.com/go-resty/resty/v2 v2.13.1
9+
github.com/hashicorp/go-retryablehttp v0.7.7
10+
github.com/julien040/anyquery v0.0.0-20240715193453-4c0338a83307
11+
)
12+
13+
require (
14+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
15+
github.com/dgraph-io/ristretto v0.1.1 // indirect
16+
github.com/dustin/go-humanize v1.0.1 // indirect
17+
github.com/fatih/color v1.17.0 // indirect
18+
github.com/gogo/protobuf v1.3.2 // indirect
19+
github.com/golang/glog v1.2.1 // indirect
20+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
21+
github.com/golang/protobuf v1.5.4 // indirect
22+
github.com/golang/snappy v0.0.3 // indirect
23+
github.com/google/flatbuffers v1.12.1 // indirect
24+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
25+
github.com/hashicorp/go-hclog v1.6.3 // indirect
26+
github.com/hashicorp/go-plugin v1.6.1 // indirect
27+
github.com/hashicorp/yamux v0.1.1 // indirect
28+
github.com/klauspost/compress v1.17.9 // indirect
29+
github.com/mattn/go-colorable v0.1.13 // indirect
30+
github.com/mattn/go-isatty v0.0.20 // indirect
31+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
32+
github.com/oklog/run v1.1.0 // indirect
33+
github.com/pkg/errors v0.9.1 // indirect
34+
go.opencensus.io v0.24.0 // indirect
35+
golang.org/x/net v0.27.0 // indirect
36+
golang.org/x/sys v0.22.0 // indirect
37+
golang.org/x/text v0.16.0 // indirect
38+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect
39+
google.golang.org/grpc v1.65.0 // indirect
40+
google.golang.org/protobuf v1.34.2 // indirect
41+
)

0 commit comments

Comments
 (0)