karakeep-python-api 1.0.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (18) hide show
  1. {karakeep_python_api-1.0.0/karakeep_python_api.egg-info → karakeep_python_api-1.2.0}/PKG-INFO +24 -18
  2. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/README.md +23 -17
  3. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api/__main__.py +14 -12
  4. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api/datatypes.py +10 -2
  5. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api/karakeep_api.py +221 -64
  6. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api/openapi_reference.json +113 -14
  7. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0/karakeep_python_api.egg-info}/PKG-INFO +24 -18
  8. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/setup.py +1 -1
  9. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/tests/test_karakeep_api.py +91 -6
  10. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/LICENSE +0 -0
  11. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/MANIFEST.in +0 -0
  12. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api/__init__.py +0 -0
  13. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api.egg-info/SOURCES.txt +0 -0
  14. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api.egg-info/dependency_links.txt +0 -0
  15. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api.egg-info/entry_points.txt +0 -0
  16. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api.egg-info/requires.txt +0 -0
  17. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/karakeep_python_api.egg-info/top_level.txt +0 -0
  18. {karakeep_python_api-1.0.0 → karakeep_python_api-1.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: karakeep_python_api
3
- Version: 1.0.0
3
+ Version: 1.2.0
4
4
  Summary: Community python client for the Karakeep API.
5
5
  Home-page: https://github.com/thiswillbeyourgithub/karakeep_python_api/
6
6
  License: GPLv3
@@ -81,7 +81,7 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
81
81
  | Method Name | Pytest | CLI | Remarks |
82
82
  | -------------------------------- | :----: | :--: | -------------------------------------------- |
83
83
  | `get_all_bookmarks` | ✅ | ✅ | Tested with pagination. |
84
- | `create_a_new_bookmark` | ✅ | ❌ | Pytest for `type="link"` via fixture. CLI not directly tested. |
84
+ | `create_a_new_bookmark` | ✅ | ❌ | Pytest for `type="link"` via fixture and `type="asset"` via PDF test. CLI not directly tested. |
85
85
  | `search_bookmarks` | ✅ | ✅ | Seems to be nondeterministic and fails if using more than 3 words |
86
86
  | `get_a_single_bookmark` | ✅ | ❌ | |
87
87
  | `delete_a_bookmark` | ✅ | ❌ | |
@@ -112,6 +112,8 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
112
112
  | `get_a_single_highlight` | ❌ | ❌ | |
113
113
  | `delete_a_highlight` | ❌ | ❌ | Works from the CLI; not yet added to Pytest. |
114
114
  | `update_a_highlight` | ❌ | ❌ | |
115
+ | `upload_a_new_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
116
+ | `get_a_single_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
115
117
  | `get_current_user_info` | ✅ | ❌ | Pytest: Tested indirectly during client init. CLI not directly tested. |
116
118
  | `get_current_user_stats` | ✅ | ✅ | |
117
119
 
@@ -137,7 +139,7 @@ This package can be used as a Python library or as a command-line interface (CLI
137
139
 
138
140
  The client can be configured using the following environment variables:
139
141
 
140
- * `KARAKEEP_PYTHON_API_BASE_URL`: **Required**. The full base URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://your-karakeep.example.com/api/v1/` or `https://try.karakeep.app/api/v1/`).
142
+ * `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.app/api/v1/`).
141
143
  * `KARAKEEP_PYTHON_API_KEY`: **Required**. Your Karakeep API key (Bearer token).
142
144
  * `KARAKEEP_PYTHON_API_VERIFY_SSL`: Set to `false` to disable SSL certificate verification (default: `true`).
143
145
  * `KARAKEEP_PYTHON_API_VERBOSE`: Set to `true` to enable verbose debug logging for the client and CLI (default: `false`).
@@ -146,7 +148,7 @@ The client can be configured using the following environment variables:
146
148
 
147
149
  ### Command Line Interface (CLI)
148
150
 
149
- The CLI dynamically generates commands based on the API methods. You need to provide your API key and base URL either via environment variables (recommended) or command-line options.
151
+ The CLI dynamically generates commands based on the API methods. You need to provide your API key and endpoint either via environment variables (recommended) or command-line options.
150
152
 
151
153
  **Basic Structure:**
152
154
 
@@ -171,8 +173,8 @@ python -m karakeep_python_api get-all-bookmarks --help
171
173
  python -m karakeep_python_api get-all-tags
172
174
 
173
175
  # Get the first page of bookmarks with a limit, overriding env vars if needed
174
- # Note: Ensure the base URL includes the /api/v1/ path
175
- python -m karakeep_python_api --base-url https://my.karakeep.com/api/v1/ --api-key YOUR_API_KEY get-all-bookmarks --limit 10
176
+ # Note: The /api/v1/ path will be automatically appended if not present
177
+ python -m karakeep_python_api --base-url https://karakeep.domain.com/api/v1/ --api-key YOUR_API_KEY get-all-bookmarks --limit 10
176
178
 
177
179
  # Get all lists and pipe the JSON output to jq to extract the first list
178
180
  python -m karakeep_python_api get-all-lists | jq '.[0]'
@@ -196,14 +198,14 @@ import os
196
198
  from karakeep_python_api import KarakeepAPI, APIError, AuthenticationError, datatypes
197
199
 
198
200
  # Ensure required environment variables are set
199
- # Example: os.environ["KARAKEEP_PYTHON_API_BASE_URL"] = "https://your-karakeep.example.com/api/v1/"
201
+ # Example: os.environ["KARAKEEP_PYTHON_API_ENDPOINT"] = "https://karakeep.domain.com/api/v1/"
200
202
  # Example: os.environ["KARAKEEP_PYTHON_API_KEY"] = "your_secret_api_key"
201
203
 
202
204
  try:
203
205
  # Initialize the client (reads from env vars by default)
204
206
  client = KarakeepAPI(
205
207
  # Optionally override env vars:
206
- # base_url="https://another.karakeep.com",
208
+ # api_endpoint="https://karakeep.domain.com/api/v1/",
207
209
  # api_key="another_key",
208
210
  # verbose=True,
209
211
  # disable_response_validation=False
@@ -233,7 +235,7 @@ except AuthenticationError as e:
233
235
  except APIError as e:
234
236
  print(f"An API error occurred: {e}")
235
237
  except ValueError as e:
236
- # Handles missing API key/base URL during initialization
238
+ # Handles missing API key/endpoint during initialization
237
239
  print(f"Configuration error: {e}")
238
240
  except Exception as e:
239
241
  print(f"An unexpected error occurred: {e}")
@@ -242,15 +244,19 @@ except Exception as e:
242
244
 
243
245
  ## Community Scripts
244
246
 
245
- Examples of the API being used can be found in the [`./examples`](./examples) folder. Don't hesitate to submit yours!
247
+ Community Scripts are a bunch of scripts made to solve specific issues. They are made by the community so don't hesitate to submit yours or open an issue if you have a bug. They also serve as example of how to use the API.
246
248
 
247
- | Example Script | Description | Documentation |
248
- |----------------|-------------|---------------|
249
- | **Add Time-to-Read Tags** | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. | [`README.md`](./examples/add_time_to_read_tag/README.md) |
250
- | **List to Tag Converter** | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. | [`README.md`](./examples/list_to_tag/README.md) |
251
- | **Omnivore Highlights Importer** | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. | [`README.md`](./examples/omnivore_highlights_importer/README.md) |
252
- | **Omnivore Archiving Status Updater** | Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. | [`README.md`](./examples/omnivore_archiving_status_updater/README.md) |
253
- | **Pocket Archiving Status Updater** | Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. | [`README.md`](./examples/pocket_archiving_status_updater/README.md) |
249
+ They can be found in the [./community_scripts](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts) folder. Don't hesitate to submit yours, the contribution guidelines are in the community_scripts directory README.md file.
250
+
251
+ | Community Script | Description | Documentation |
252
+ |----------------|--------------------------------------------------------------------------------------------------------------|---------------|
253
+ | **Karakeep-Time-Tagger** | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-time-tagger) |
254
+ | **Karakeep-List-To-Tag** | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-list-to-tag) |
255
+ | **Omnivore2Karakeep-Highlights** | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-highlights) |
256
+ | **Omnivore2Karakeep-Archived** | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-archived) |
257
+ | **pocket2karakeep-archived** by [@youenchene](https://github.com/youenchene) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/pocket2karakeep-archived) |
258
+ | **Karakeep-Archive-Before-Date** by [@youenchene](https://github.com/youenchene) | Allow you to archive all not archived post before a given date | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-archive-before-date) |
259
+ | **Freshrss-To-Karakeep** | Syncs some links from Freshrss to Karakeep | [`Link`](https://github.com/thiswillbeyourgithub/freshrss_to_karakeep) |
254
260
 
255
261
  ## Development
256
262
 
@@ -261,7 +267,7 @@ Examples of the API being used can be found in the [`./examples`](./examples) fo
261
267
  ```bash
262
268
  uv pip install -e ".[dev]"
263
269
  ```
264
- 4. Set the required environment variables (`KARAKEEP_PYTHON_API_BASE_URL`, `KARAKEEP_PYTHON_API_KEY`) for running tests against a live instance.
270
+ 4. Set the required environment variables (`KARAKEEP_PYTHON_API_ENDPOINT`, `KARAKEEP_PYTHON_API_KEY`) for running tests against a live instance.
265
271
  5. Run tests:
266
272
 
267
273
  ```bash
@@ -46,7 +46,7 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
46
46
  | Method Name | Pytest | CLI | Remarks |
47
47
  | -------------------------------- | :----: | :--: | -------------------------------------------- |
48
48
  | `get_all_bookmarks` | ✅ | ✅ | Tested with pagination. |
49
- | `create_a_new_bookmark` | ✅ | ❌ | Pytest for `type="link"` via fixture. CLI not directly tested. |
49
+ | `create_a_new_bookmark` | ✅ | ❌ | Pytest for `type="link"` via fixture and `type="asset"` via PDF test. CLI not directly tested. |
50
50
  | `search_bookmarks` | ✅ | ✅ | Seems to be nondeterministic and fails if using more than 3 words |
51
51
  | `get_a_single_bookmark` | ✅ | ❌ | |
52
52
  | `delete_a_bookmark` | ✅ | ❌ | |
@@ -77,6 +77,8 @@ Methods or CLI commands marked with ❌ should be used with caution as their beh
77
77
  | `get_a_single_highlight` | ❌ | ❌ | |
78
78
  | `delete_a_highlight` | ❌ | ❌ | Works from the CLI; not yet added to Pytest. |
79
79
  | `update_a_highlight` | ❌ | ❌ | |
80
+ | `upload_a_new_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
81
+ | `get_a_single_asset` | ✅ | ❌ | Tested in PDF asset lifecycle test. |
80
82
  | `get_current_user_info` | ✅ | ❌ | Pytest: Tested indirectly during client init. CLI not directly tested. |
81
83
  | `get_current_user_stats` | ✅ | ✅ | |
82
84
 
@@ -102,7 +104,7 @@ This package can be used as a Python library or as a command-line interface (CLI
102
104
 
103
105
  The client can be configured using the following environment variables:
104
106
 
105
- * `KARAKEEP_PYTHON_API_BASE_URL`: **Required**. The full base URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://your-karakeep.example.com/api/v1/` or `https://try.karakeep.app/api/v1/`).
107
+ * `KARAKEEP_PYTHON_API_ENDPOINT`: **Required**. The full URL of your Karakeep API, including the `/api/v1/` path (e.g., `https://karakeep.domain.com/api/v1/` or `https://try.karakeep.app/api/v1/`).
106
108
  * `KARAKEEP_PYTHON_API_KEY`: **Required**. Your Karakeep API key (Bearer token).
107
109
  * `KARAKEEP_PYTHON_API_VERIFY_SSL`: Set to `false` to disable SSL certificate verification (default: `true`).
108
110
  * `KARAKEEP_PYTHON_API_VERBOSE`: Set to `true` to enable verbose debug logging for the client and CLI (default: `false`).
@@ -111,7 +113,7 @@ The client can be configured using the following environment variables:
111
113
 
112
114
  ### Command Line Interface (CLI)
113
115
 
114
- The CLI dynamically generates commands based on the API methods. You need to provide your API key and base URL either via environment variables (recommended) or command-line options.
116
+ The CLI dynamically generates commands based on the API methods. You need to provide your API key and endpoint either via environment variables (recommended) or command-line options.
115
117
 
116
118
  **Basic Structure:**
117
119
 
@@ -136,8 +138,8 @@ python -m karakeep_python_api get-all-bookmarks --help
136
138
  python -m karakeep_python_api get-all-tags
137
139
 
138
140
  # Get the first page of bookmarks with a limit, overriding env vars if needed
139
- # Note: Ensure the base URL includes the /api/v1/ path
140
- python -m karakeep_python_api --base-url https://my.karakeep.com/api/v1/ --api-key YOUR_API_KEY get-all-bookmarks --limit 10
141
+ # Note: The /api/v1/ path will be automatically appended if not present
142
+ python -m karakeep_python_api --base-url https://karakeep.domain.com/api/v1/ --api-key YOUR_API_KEY get-all-bookmarks --limit 10
141
143
 
142
144
  # Get all lists and pipe the JSON output to jq to extract the first list
143
145
  python -m karakeep_python_api get-all-lists | jq '.[0]'
@@ -161,14 +163,14 @@ import os
161
163
  from karakeep_python_api import KarakeepAPI, APIError, AuthenticationError, datatypes
162
164
 
163
165
  # Ensure required environment variables are set
164
- # Example: os.environ["KARAKEEP_PYTHON_API_BASE_URL"] = "https://your-karakeep.example.com/api/v1/"
166
+ # Example: os.environ["KARAKEEP_PYTHON_API_ENDPOINT"] = "https://karakeep.domain.com/api/v1/"
165
167
  # Example: os.environ["KARAKEEP_PYTHON_API_KEY"] = "your_secret_api_key"
166
168
 
167
169
  try:
168
170
  # Initialize the client (reads from env vars by default)
169
171
  client = KarakeepAPI(
170
172
  # Optionally override env vars:
171
- # base_url="https://another.karakeep.com",
173
+ # api_endpoint="https://karakeep.domain.com/api/v1/",
172
174
  # api_key="another_key",
173
175
  # verbose=True,
174
176
  # disable_response_validation=False
@@ -198,7 +200,7 @@ except AuthenticationError as e:
198
200
  except APIError as e:
199
201
  print(f"An API error occurred: {e}")
200
202
  except ValueError as e:
201
- # Handles missing API key/base URL during initialization
203
+ # Handles missing API key/endpoint during initialization
202
204
  print(f"Configuration error: {e}")
203
205
  except Exception as e:
204
206
  print(f"An unexpected error occurred: {e}")
@@ -207,15 +209,19 @@ except Exception as e:
207
209
 
208
210
  ## Community Scripts
209
211
 
210
- Examples of the API being used can be found in the [`./examples`](./examples) folder. Don't hesitate to submit yours!
212
+ Community Scripts are a bunch of scripts made to solve specific issues. They are made by the community so don't hesitate to submit yours or open an issue if you have a bug. They also serve as example of how to use the API.
211
213
 
212
- | Example Script | Description | Documentation |
213
- |----------------|-------------|---------------|
214
- | **Add Time-to-Read Tags** | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. | [`README.md`](./examples/add_time_to_read_tag/README.md) |
215
- | **List to Tag Converter** | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. | [`README.md`](./examples/list_to_tag/README.md) |
216
- | **Omnivore Highlights Importer** | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. | [`README.md`](./examples/omnivore_highlights_importer/README.md) |
217
- | **Omnivore Archiving Status Updater** | Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. | [`README.md`](./examples/omnivore_archiving_status_updater/README.md) |
218
- | **Pocket Archiving Status Updater** | Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. | [`README.md`](./examples/pocket_archiving_status_updater/README.md) |
214
+ They can be found in the [./community_scripts](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts) folder. Don't hesitate to submit yours, the contribution guidelines are in the community_scripts directory README.md file.
215
+
216
+ | Community Script | Description | Documentation |
217
+ |----------------|--------------------------------------------------------------------------------------------------------------|---------------|
218
+ | **Karakeep-Time-Tagger** | Automatically adds time-to-read tags (`0-5m`, `5-10m`, etc.) to bookmarks based on content length analysis. Includes systemd service and timer files for automated periodic execution. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-time-tagger) |
219
+ | **Karakeep-List-To-Tag** | Converts a Karakeep list into tags by adding a specified tag to all bookmarks within that list. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-list-to-tag) |
220
+ | **Omnivore2Karakeep-Highlights** | Imports highlights from Omnivore export data to Karakeep, with intelligent position detection and bookmark matching. Supports dry-run mode for testing. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-highlights) |
221
+ | **Omnivore2Karakeep-Archived** | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Omnivore by reading export data and updating Karakeep accordingly. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/omnivore2karakeep-archived) |
222
+ | **pocket2karakeep-archived** by [@youenchene](https://github.com/youenchene) | (Should not be needed anymore) Fixes the archived status of bookmarks imported from Pocket by reading export data and updating Karakeep accordingly. | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/pocket2karakeep-archived) |
223
+ | **Karakeep-Archive-Before-Date** by [@youenchene](https://github.com/youenchene) | Allow you to archive all not archived post before a given date | [`Link`](https://github.com/thiswillbeyourgithub/karakeep_python_api/tree/main/community_scripts/karakeep-archive-before-date) |
224
+ | **Freshrss-To-Karakeep** | Syncs some links from Freshrss to Karakeep | [`Link`](https://github.com/thiswillbeyourgithub/freshrss_to_karakeep) |
219
225
 
220
226
  ## Development
221
227
 
@@ -226,7 +232,7 @@ Examples of the API being used can be found in the [`./examples`](./examples) fo
226
232
  ```bash
227
233
  uv pip install -e ".[dev]"
228
234
  ```
229
- 4. Set the required environment variables (`KARAKEEP_PYTHON_API_BASE_URL`, `KARAKEEP_PYTHON_API_KEY`) for running tests against a live instance.
235
+ 4. Set the required environment variables (`KARAKEEP_PYTHON_API_ENDPOINT`, `KARAKEEP_PYTHON_API_KEY`) for running tests against a live instance.
230
236
  5. Run tests:
231
237
 
232
238
  ```bash
@@ -59,9 +59,9 @@ def serialize_output(data: Any) -> Any:
59
59
  # Shared options for the API client
60
60
  shared_options = [
61
61
  click.option(
62
- "--base-url",
63
- envvar="KARAKEEP_PYTHON_API_BASE_URL",
64
- help="Full Karakeep API base URL, including /api/v1/ (e.g., https://instance.com/api/v1/).",
62
+ "--api-endpoint",
63
+ envvar="KARAKEEP_PYTHON_API_ENDPOINT",
64
+ help="Full Karakeep API endpoint URL, including /api/v1/ (e.g., https://instance.com/api/v1/).",
65
65
  ),
66
66
  click.option(
67
67
  "--api-key",
@@ -151,7 +151,7 @@ def print_openapi_spec(ctx, param, value):
151
151
  @click.pass_context
152
152
  def cli(
153
153
  ctx,
154
- base_url,
154
+ api_endpoint,
155
155
  api_key,
156
156
  verify_ssl,
157
157
  verbose,
@@ -167,7 +167,7 @@ def cli(
167
167
  # Ensure the context object exists
168
168
  ctx.ensure_object(dict)
169
169
 
170
- # --- Strict Check for API Key and Base URL ---
170
+ # --- Strict Check for API Key and Endpoint ---
171
171
  # Check for API key (must be provided via arg or env)
172
172
  resolved_api_key = api_key or os.environ.get("KARAKEEP_PYTHON_API_KEY")
173
173
  if not resolved_api_key:
@@ -175,16 +175,18 @@ def cli(
175
175
  "API Key is required. Provide --api-key option or set KARAKEEP_PYTHON_API_KEY environment variable."
176
176
  )
177
177
 
178
- # Check for Base URL (must be provided via arg or env)
179
- resolved_base_url = base_url or os.environ.get("KARAKEEP_PYTHON_API_BASE_URL")
180
- if not resolved_base_url:
178
+ # Check for API endpoint (must be provided via arg or env)
179
+ resolved_api_endpoint = api_endpoint or os.environ.get(
180
+ "KARAKEEP_PYTHON_API_ENDPOINT"
181
+ )
182
+ if not resolved_api_endpoint:
181
183
  raise click.UsageError(
182
- "API Base URL is required. Provide --base-url option or set KARAKEEP_PYTHON_API_BASE_URL environment variable. "
184
+ "API endpoint is required. Provide --api-endpoint option or set KARAKEEP_PYTHON_API_ENDPOINT environment variable. "
183
185
  "The URL must include the API path, e.g., 'https://your-instance.com/api/v1/'."
184
186
  )
185
187
 
186
188
  # Store common API parameters in the context for commands to use
187
- ctx.obj["BASE_URL"] = resolved_base_url # Store the resolved URL
189
+ ctx.obj["API_ENDPOINT"] = resolved_api_endpoint # Store the resolved endpoint
188
190
  ctx.obj["API_KEY"] = resolved_api_key # Store the resolved key
189
191
  ctx.obj["VERIFY_SSL"] = verify_ssl
190
192
  ctx.obj["VERBOSE"] = verbose
@@ -231,7 +233,7 @@ def create_click_command(
231
233
  def command_func(ctx, **kwargs):
232
234
  """Dynamically generated command function wrapper."""
233
235
  # Retrieve API parameters from context, ensuring API key is present now
234
- base_url = ctx.obj["BASE_URL"]
236
+ api_endpoint = ctx.obj["API_ENDPOINT"]
235
237
  api_key = ctx.obj["API_KEY"]
236
238
  verify_ssl = ctx.obj["VERIFY_SSL"]
237
239
  verbose = ctx.obj["VERBOSE"]
@@ -250,7 +252,7 @@ def create_click_command(
250
252
  # Method generation already happened during inspection phase or initial load
251
253
  api = KarakeepAPI(
252
254
  api_key=api_key,
253
- base_url=base_url,
255
+ api_endpoint=api_endpoint,
254
256
  verify_ssl=verify_ssl,
255
257
  verbose=verbose,
256
258
  disable_response_validation=disable_validation, # Pass flag to constructor
@@ -78,7 +78,7 @@ class ContentTypeAsset(BaseModel):
78
78
  content: Optional[str] = None
79
79
 
80
80
 
81
- class Asset(BaseModel):
81
+ class BookmarkAsset(BaseModel):
82
82
  id: str
83
83
  assetType: Literal[
84
84
  "screenshot",
@@ -92,6 +92,13 @@ class Asset(BaseModel):
92
92
  ]
93
93
 
94
94
 
95
+ class Asset(BaseModel):
96
+ assetId: str
97
+ contentType: str
98
+ size: float
99
+ fileName: str
100
+
101
+
95
102
  class Bookmark(BaseModel):
96
103
  id: str
97
104
  createdAt: str
@@ -107,7 +114,7 @@ class Bookmark(BaseModel):
107
114
  content: Union[
108
115
  ContentTypeLink, ContentTypeText, ContentTypeAsset, ContentTypeUnknown
109
116
  ]
110
- assets: List[Asset]
117
+ assets: List[BookmarkAsset]
111
118
 
112
119
 
113
120
  class PaginatedBookmarks(BaseModel):
@@ -135,6 +142,7 @@ class ListModel(BaseModel):
135
142
  parentId: Optional[str]
136
143
  type: Optional[Literal["manual", "smart"]] = "manual"
137
144
  query: Optional[str] = None
145
+ public: bool
138
146
 
139
147
 
140
148
  class PaginatedHighlights(BaseModel):