indico-cli 0.2.1__tar.gz → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: indico-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: CLI tool for interacting with Indico event management systems
5
5
  Project-URL: Repository, https://gitlab.cern.ch/cern-agent-skills/indico-cli
6
6
  License: MIT
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.2.1'
32
- __version_tuple__ = version_tuple = (0, 2, 1)
31
+ __version__ = version = '0.2.2'
32
+ __version_tuple__ = version_tuple = (0, 2, 2)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -113,11 +113,14 @@ def search_events(ctx, category_id, from_date, to_date, limit, only_public):
113
113
  @cli.command("search-by-term")
114
114
  @click.option("--term", required=True, help="Search term")
115
115
  @click.option("--limit", type=int, default=50, help="Maximum number of results")
116
+ @click.option("--type", "type_filter", default=None,
117
+ type=click.Choice(["category", "event", "contribution", "subcontribution", "attachment", "event_note"]),
118
+ help="Filter to a specific content type")
116
119
  @click.pass_context
117
- def search_by_term(ctx, term, limit):
120
+ def search_by_term(ctx, term, limit, type_filter):
118
121
  """Search for events by keyword/term."""
119
122
  client = get_client(ctx.obj["base_url"], ctx.obj["token"])
120
- result = run_async(client.search_events_by_term(term, limit))
123
+ result = run_async(client.search_events_by_term(term, limit, type_filter))
121
124
  click.echo(result)
122
125
 
123
126
 
@@ -365,13 +365,12 @@ class IndicoClient:
365
365
  return response
366
366
 
367
367
  async def search_events_by_term(
368
- self, search_term: str, limit: int = 50
368
+ self, search_term: str, limit: int = 50, type_filter: Optional[str] = None
369
369
  ) -> str:
370
370
  """Search for content by keyword/term using comprehensive Indico search API"""
371
371
  try:
372
- # URL-encode the search term to handle special characters
373
372
  # Define all search types to query
374
- search_types = [
373
+ all_search_types = [
375
374
  ("category", "Categories"),
376
375
  ("event", "Events"),
377
376
  ("contribution", "Contributions"),
@@ -380,6 +379,14 @@ class IndicoClient:
380
379
  ("event_note", "Event Notes")
381
380
  ]
382
381
 
382
+ # Filter to specific type if requested
383
+ if type_filter:
384
+ search_types = [(t, d) for t, d in all_search_types if t == type_filter]
385
+ if not search_types:
386
+ return f"Unknown search type '{type_filter}'. Valid types: category, event, contribution, subcontribution, attachment, event_note"
387
+ else:
388
+ search_types = all_search_types
389
+
383
390
  all_results = {}
384
391
  total_found = 0
385
392
 
@@ -1243,12 +1250,17 @@ class IndicoClient:
1243
1250
  else:
1244
1251
  path = download_url
1245
1252
 
1253
+ # Build legacy export path if the URL uses /event/... format
1254
+ legacy_path = path
1255
+ if path.startswith("/event/") and not path.startswith("/export/"):
1256
+ legacy_path = f"/export{path}"
1257
+
1246
1258
  # Use our download method
1247
1259
  fake_file_info = {
1248
1260
  "filename": filename or "downloaded_file",
1249
1261
  "download_url": download_url,
1250
1262
  "api_path": path,
1251
- "legacy_path": path,
1263
+ "legacy_path": legacy_path,
1252
1264
  }
1253
1265
 
1254
1266
  file_response = await self.download_file_with_auth(fake_file_info, "unknown")
@@ -71,13 +71,14 @@ The goal is to answer the user's question, not just list metadata. If slides wer
71
71
  ### search-by-term — Full-text search across all Indico content
72
72
 
73
73
  ```bash
74
- uvx indico-cli search-by-term --term "<query>" [--limit N]
74
+ uvx indico-cli search-by-term --term "<query>" [--limit N] [--type TYPE]
75
75
  ```
76
76
 
77
77
  | Parameter | Required | Description |
78
78
  |-----------|----------|-------------|
79
79
  | `--term` | Yes | Search keyword or phrase |
80
80
  | `--limit` | No | Max results per content type (default: 50) |
81
+ | `--type` | No | Filter to one content type: `event`, `contribution`, `subcontribution`, `attachment`, `event_note`, `category` |
81
82
 
82
83
  Searches categories, events, contributions, subcontributions, attachments, and notes.
83
84
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes