Skip to content

Commit 356a011

Browse files
kdrclaude
andauthored
Add data connectors resource and scope filter support (#51)
## Summary - Regenerate SDK from updated API spec (data connectors endpoint, scope on filter models) - Add `DataConnectors` client resource with `list()` method - Add `scope` parameter to `_create_video_info_filter()` in both search and chat resources - Update `create_filter()` docstrings to document `scope` support ## Test plan - [x] `pip install -e .` succeeds - [x] `from cloudglue import Cloudglue` imports cleanly - [x] `DataConnectors` resource accessible at `client.data_connectors` - [x] `scope` parameter present on `Search._create_video_info_filter()` and `Completions._create_video_info_filter()` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a6bc1b0 commit 356a011

240 files changed

Lines changed: 931 additions & 256 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ GENERATE_OP := openapi-generator generate \
1313
-o temp-sdk \
1414
--additional-properties=packageName=cloudglue.sdk
1515

16+
.PHONY: default help setup submodule-init submodule-update generate build publish clean
17+
1618
# Default target when just running `make`
1719
default: help
1820

cloudglue/client/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from cloudglue.sdk.api.file_segments_api import FileSegmentsApi
2121
from cloudglue.sdk.api.response_api import ResponseApi
2222
from cloudglue.sdk.api.share_api import ShareApi
23+
from cloudglue.sdk.api.data_connectors_api import DataConnectorsApi
2324
from cloudglue.sdk.configuration import Configuration
2425
from cloudglue.sdk.api_client import ApiClient
2526

@@ -42,6 +43,7 @@
4243
FileSegments,
4344
Responses,
4445
Share,
46+
DataConnectors,
4547
)
4648
from cloudglue._version import __version__
4749

@@ -93,6 +95,7 @@ def __init__(
9395
self.file_segments_api = FileSegmentsApi(self.api_client)
9496
self.response_api = ResponseApi(self.api_client)
9597
self.share_api = ShareApi(self.api_client)
98+
self.data_connectors_api = DataConnectorsApi(self.api_client)
9699

97100
# Set up resources with their respective API clients
98101
self.chat = Chat(self.chat_api)
@@ -112,6 +115,7 @@ def __init__(
112115
self.file_segments = FileSegments(self.file_segments_api)
113116
self.responses = Responses(self.response_api)
114117
self.share = Share(self.share_api)
118+
self.data_connectors = DataConnectors(self.data_connectors_api)
115119

116120
def close(self):
117121
"""Close the API client."""

cloudglue/client/resources/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from cloudglue.client.resources.file_segments import FileSegments
2020
from cloudglue.client.resources.responses import Responses
2121
from cloudglue.client.resources.share import Share
22+
from cloudglue.client.resources.data_connectors import DataConnectors
2223

2324
__all__ = [
2425
"CloudglueError",
@@ -40,5 +41,6 @@
4041
"FileSegments",
4142
"Responses",
4243
"Share",
44+
"DataConnectors",
4345
]
4446

cloudglue/client/resources/chat.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cloudglue/client/resources/chat.py
22
"""Chat and Completions resources for Cloudglue API."""
3-
from typing import List, Dict, Any, Optional, Union
3+
from typing import List, Dict, Any, Optional, Union, Literal
44

55
from cloudglue.sdk.models.chat_completion_request import ChatCompletionRequest
66
from cloudglue.sdk.models.chat_completion_request_filter import ChatCompletionRequestFilter
@@ -50,15 +50,19 @@ def _create_video_info_filter(
5050
operator: str,
5151
value_text: Optional[str] = None,
5252
value_text_array: Optional[List[str]] = None,
53+
scope: Optional[Literal['file', 'segment']] = None,
5354
) -> ChatCompletionRequestFilterVideoInfoInner:
5455
"""Create a video info filter.
55-
56+
5657
Args:
5758
path: JSON path on video_info object (e.g. 'has_audio', 'duration_seconds')
5859
operator: Comparison operator ('NotEqual', 'Equal', 'LessThan', 'GreaterThan', 'In', 'ContainsAny', 'ContainsAll')
5960
value_text: Text value for scalar comparison (used with NotEqual, Equal, LessThan, GreaterThan, In)
6061
value_text_array: Array of values for array comparisons (used with ContainsAny, ContainsAll)
61-
62+
scope: Scope of the filter. 'file' filters by source video properties,
63+
'segment' filters by segment properties. Only duration_seconds is
64+
supported with segment scope. Defaults to 'file'.
65+
6266
Returns:
6367
ChatCompletionRequestFilterVideoInfoInner object
6468
"""
@@ -67,6 +71,7 @@ def _create_video_info_filter(
6771
operator=operator,
6872
value_text=value_text,
6973
value_text_array=value_text_array,
74+
scope=scope,
7075
)
7176

7277
@staticmethod
@@ -133,8 +138,9 @@ def create_filter(
133138
- 'operator': Comparison operator
134139
- 'value_text': (optional) Text value for scalar comparison
135140
- 'value_text_array': (optional) Array of values for array comparisons
136-
video_info_filters: List of video info filter dictionaries (same structure)
137-
file_filters: List of file filter dictionaries (same structure)
141+
video_info_filters: List of video info filter dictionaries. Same structure as metadata_filters,
142+
plus optional 'scope' ('file' or 'segment'). Defaults to 'file'.
143+
file_filters: List of file filter dictionaries (same structure as metadata_filters)
138144
139145
Returns:
140146
ChatCompletionRequestFilter object
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# cloudglue/client/resources/data_connectors.py
2+
"""Data Connectors resource for Cloudglue API."""
3+
from typing import Optional
4+
5+
from cloudglue.sdk.rest import ApiException
6+
7+
from cloudglue.client.resources.base import CloudglueError
8+
9+
10+
class DataConnectors:
11+
"""Client for the Cloudglue Data Connectors API."""
12+
13+
def __init__(self, api):
14+
"""Initialize the DataConnectors client.
15+
16+
Args:
17+
api: The DataConnectorsApi instance.
18+
"""
19+
self.api = api
20+
21+
def list(self):
22+
"""List all active data connectors configured for your account.
23+
24+
Returns:
25+
DataConnectorList object
26+
27+
Raises:
28+
CloudglueError: If there is an error listing data connectors.
29+
"""
30+
try:
31+
return self.api.list_data_connectors()
32+
except ApiException as e:
33+
raise CloudglueError(str(e), e.status, e.data, e.headers, e.reason)
34+
except Exception as e:
35+
raise CloudglueError(str(e))

cloudglue/client/resources/search.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,19 @@ def _create_video_info_filter(
6363
operator: str,
6464
value_text: Optional[str] = None,
6565
value_text_array: Optional[List[str]] = None,
66+
scope: Optional[Literal['file', 'segment']] = None,
6667
) -> SearchFilterVideoInfoInner:
6768
"""Create a video info filter for search.
68-
69+
6970
Args:
7071
path: Video info field ('duration_seconds', 'has_audio')
7172
operator: Comparison operator ('NotEqual', 'Equal', 'LessThan', 'GreaterThan', 'In', 'ContainsAny', 'ContainsAll', 'Like')
7273
value_text: Text value for scalar comparison (used with NotEqual, Equal, LessThan, GreaterThan, Like)
7374
value_text_array: Array of values for array comparisons (used with ContainsAny, ContainsAll, In)
74-
75+
scope: Scope of the filter. 'file' filters by source video properties,
76+
'segment' filters by segment properties. Only duration_seconds is
77+
supported with segment scope. Defaults to 'file'.
78+
7579
Returns:
7680
SearchFilterVideoInfoInner object
7781
"""
@@ -80,6 +84,7 @@ def _create_video_info_filter(
8084
operator=operator,
8185
value_text=value_text,
8286
value_text_array=value_text_array,
87+
scope=scope,
8388
)
8489

8590
@staticmethod
@@ -125,7 +130,8 @@ def create_filter(
125130
- 'value_text': (optional) Text value for scalar comparison
126131
- 'value_text_array': (optional) Array of values for array comparisons
127132
- 'scope': (optional) Scope of eligible search items ('file' or 'segment'). Defaults to 'file'.
128-
video_info_filters: List of video info filter dictionaries (same structure, without scope)
133+
video_info_filters: List of video info filter dictionaries. Same structure as metadata_filters,
134+
plus optional 'scope' ('file' or 'segment'). Defaults to 'file'.
129135
file_filters: List of file filter dictionaries (same structure, without scope)
130136
131137
Returns:

cloudglue/sdk/README.md

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudglue/sdk/__init__.py

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudglue/sdk/api/__init__.py

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloudglue/sdk/api/chat_api.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)