semble-api 0.0.1__py3-none-any.whl
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.
- semble/__init__.py +33 -0
- semble/_client.py +204 -0
- semble/_exceptions.py +60 -0
- semble/_utils.py +9 -0
- semble/cli.py +158 -0
- semble/mcp.py +42 -0
- semble/py.typed +0 -0
- semble/records.py +82 -0
- semble/resources/__init__.py +8 -0
- semble/resources/_base.py +14 -0
- semble/resources/actors.py +35 -0
- semble/resources/cards.py +344 -0
- semble/resources/collections.py +447 -0
- semble/resources/connections.py +199 -0
- semble/resources/feeds.py +121 -0
- semble/resources/graph.py +155 -0
- semble/resources/notifications.py +87 -0
- semble/resources/search.py +135 -0
- semble/settings.py +26 -0
- semble/types.py +268 -0
- semble_api-0.0.1.dist-info/METADATA +165 -0
- semble_api-0.0.1.dist-info/RECORD +25 -0
- semble_api-0.0.1.dist-info/WHEEL +4 -0
- semble_api-0.0.1.dist-info/entry_points.txt +3 -0
- semble_api-0.0.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""network.cosmik.feed.* — global and following activity feeds."""
|
|
2
|
+
|
|
3
|
+
from semble._utils import drop_none
|
|
4
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
5
|
+
from semble.types import Activity, Page, SortOrder, URLType
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Feeds(SyncResource):
|
|
9
|
+
def get_global(
|
|
10
|
+
self,
|
|
11
|
+
*,
|
|
12
|
+
url_type: URLType | None = None,
|
|
13
|
+
source: str | None = None,
|
|
14
|
+
activity_types: list[str] | None = None,
|
|
15
|
+
include_known_bots: bool | None = None,
|
|
16
|
+
before_activity_id: str | None = None,
|
|
17
|
+
page: int | None = None,
|
|
18
|
+
limit: int | None = None,
|
|
19
|
+
sort_by: str | None = None,
|
|
20
|
+
sort_order: SortOrder | None = None,
|
|
21
|
+
) -> Page[Activity]:
|
|
22
|
+
params = drop_none(
|
|
23
|
+
urlType=url_type,
|
|
24
|
+
source=source,
|
|
25
|
+
activityTypes=activity_types,
|
|
26
|
+
includeKnownBots=include_known_bots,
|
|
27
|
+
beforeActivityId=before_activity_id,
|
|
28
|
+
page=page,
|
|
29
|
+
limit=limit,
|
|
30
|
+
sortBy=sort_by,
|
|
31
|
+
sortOrder=sort_order,
|
|
32
|
+
)
|
|
33
|
+
return self._client.get(
|
|
34
|
+
"network.cosmik.feed.getGlobal", params, cast_to=Page[Activity]
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def get_following(
|
|
38
|
+
self,
|
|
39
|
+
*,
|
|
40
|
+
url_type: URLType | None = None,
|
|
41
|
+
source: str | None = None,
|
|
42
|
+
activity_types: list[str] | None = None,
|
|
43
|
+
include_known_bots: bool | None = None,
|
|
44
|
+
before_activity_id: str | None = None,
|
|
45
|
+
page: int | None = None,
|
|
46
|
+
limit: int | None = None,
|
|
47
|
+
sort_by: str | None = None,
|
|
48
|
+
sort_order: SortOrder | None = None,
|
|
49
|
+
) -> Page[Activity]:
|
|
50
|
+
params = drop_none(
|
|
51
|
+
urlType=url_type,
|
|
52
|
+
source=source,
|
|
53
|
+
activityTypes=activity_types,
|
|
54
|
+
includeKnownBots=include_known_bots,
|
|
55
|
+
beforeActivityId=before_activity_id,
|
|
56
|
+
page=page,
|
|
57
|
+
limit=limit,
|
|
58
|
+
sortBy=sort_by,
|
|
59
|
+
sortOrder=sort_order,
|
|
60
|
+
)
|
|
61
|
+
return self._client.get(
|
|
62
|
+
"network.cosmik.feed.getFollowing", params, cast_to=Page[Activity]
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class AsyncFeeds(AsyncResource):
|
|
67
|
+
async def get_global(
|
|
68
|
+
self,
|
|
69
|
+
*,
|
|
70
|
+
url_type: URLType | None = None,
|
|
71
|
+
source: str | None = None,
|
|
72
|
+
activity_types: list[str] | None = None,
|
|
73
|
+
include_known_bots: bool | None = None,
|
|
74
|
+
before_activity_id: str | None = None,
|
|
75
|
+
page: int | None = None,
|
|
76
|
+
limit: int | None = None,
|
|
77
|
+
sort_by: str | None = None,
|
|
78
|
+
sort_order: SortOrder | None = None,
|
|
79
|
+
) -> Page[Activity]:
|
|
80
|
+
params = drop_none(
|
|
81
|
+
urlType=url_type,
|
|
82
|
+
source=source,
|
|
83
|
+
activityTypes=activity_types,
|
|
84
|
+
includeKnownBots=include_known_bots,
|
|
85
|
+
beforeActivityId=before_activity_id,
|
|
86
|
+
page=page,
|
|
87
|
+
limit=limit,
|
|
88
|
+
sortBy=sort_by,
|
|
89
|
+
sortOrder=sort_order,
|
|
90
|
+
)
|
|
91
|
+
return await self._client.get(
|
|
92
|
+
"network.cosmik.feed.getGlobal", params, cast_to=Page[Activity]
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
async def get_following(
|
|
96
|
+
self,
|
|
97
|
+
*,
|
|
98
|
+
url_type: URLType | None = None,
|
|
99
|
+
source: str | None = None,
|
|
100
|
+
activity_types: list[str] | None = None,
|
|
101
|
+
include_known_bots: bool | None = None,
|
|
102
|
+
before_activity_id: str | None = None,
|
|
103
|
+
page: int | None = None,
|
|
104
|
+
limit: int | None = None,
|
|
105
|
+
sort_by: str | None = None,
|
|
106
|
+
sort_order: SortOrder | None = None,
|
|
107
|
+
) -> Page[Activity]:
|
|
108
|
+
params = drop_none(
|
|
109
|
+
urlType=url_type,
|
|
110
|
+
source=source,
|
|
111
|
+
activityTypes=activity_types,
|
|
112
|
+
includeKnownBots=include_known_bots,
|
|
113
|
+
beforeActivityId=before_activity_id,
|
|
114
|
+
page=page,
|
|
115
|
+
limit=limit,
|
|
116
|
+
sortBy=sort_by,
|
|
117
|
+
sortOrder=sort_order,
|
|
118
|
+
)
|
|
119
|
+
return await self._client.get(
|
|
120
|
+
"network.cosmik.feed.getFollowing", params, cast_to=Page[Activity]
|
|
121
|
+
)
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"""network.cosmik.graph.* — following users and collections."""
|
|
2
|
+
|
|
3
|
+
from semble._utils import drop_none
|
|
4
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
5
|
+
from semble.types import Collection, CountResponse, IDResponse, Page, TargetType, User
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Graph(SyncResource):
|
|
9
|
+
def follow(self, target_id: str, target_type: TargetType) -> IDResponse:
|
|
10
|
+
return self._client.post(
|
|
11
|
+
"network.cosmik.graph.follow",
|
|
12
|
+
{"targetId": target_id, "targetType": target_type},
|
|
13
|
+
cast_to=IDResponse,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
def unfollow(self, target_id: str, target_type: TargetType) -> IDResponse:
|
|
17
|
+
return self._client.post(
|
|
18
|
+
"network.cosmik.graph.unfollow",
|
|
19
|
+
{"targetId": target_id, "targetType": target_type},
|
|
20
|
+
cast_to=IDResponse,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
def get_following(
|
|
24
|
+
self,
|
|
25
|
+
identifier: str,
|
|
26
|
+
*,
|
|
27
|
+
page: int | None = None,
|
|
28
|
+
limit: int | None = None,
|
|
29
|
+
) -> Page[User]:
|
|
30
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
31
|
+
return self._client.get(
|
|
32
|
+
"network.cosmik.graph.getFollowing", params, cast_to=Page[User]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def get_followers(
|
|
36
|
+
self,
|
|
37
|
+
identifier: str,
|
|
38
|
+
*,
|
|
39
|
+
page: int | None = None,
|
|
40
|
+
limit: int | None = None,
|
|
41
|
+
) -> Page[User]:
|
|
42
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
43
|
+
return self._client.get(
|
|
44
|
+
"network.cosmik.graph.getFollowers", params, cast_to=Page[User]
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def get_following_collections(
|
|
48
|
+
self,
|
|
49
|
+
identifier: str,
|
|
50
|
+
*,
|
|
51
|
+
page: int | None = None,
|
|
52
|
+
limit: int | None = None,
|
|
53
|
+
) -> Page[Collection]:
|
|
54
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
55
|
+
return self._client.get(
|
|
56
|
+
"network.cosmik.graph.getFollowingCollections",
|
|
57
|
+
params,
|
|
58
|
+
cast_to=Page[Collection],
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def get_following_count(self, identifier: str) -> CountResponse:
|
|
62
|
+
return self._client.get(
|
|
63
|
+
"network.cosmik.graph.getFollowingCount",
|
|
64
|
+
{"identifier": identifier},
|
|
65
|
+
cast_to=CountResponse,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
def get_followers_count(self, identifier: str) -> CountResponse:
|
|
69
|
+
return self._client.get(
|
|
70
|
+
"network.cosmik.graph.getFollowersCount",
|
|
71
|
+
{"identifier": identifier},
|
|
72
|
+
cast_to=CountResponse,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
def get_following_collections_count(self, identifier: str) -> CountResponse:
|
|
76
|
+
return self._client.get(
|
|
77
|
+
"network.cosmik.graph.getFollowingCollectionsCount",
|
|
78
|
+
{"identifier": identifier},
|
|
79
|
+
cast_to=CountResponse,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class AsyncGraph(AsyncResource):
|
|
84
|
+
async def follow(self, target_id: str, target_type: TargetType) -> IDResponse:
|
|
85
|
+
return await self._client.post(
|
|
86
|
+
"network.cosmik.graph.follow",
|
|
87
|
+
{"targetId": target_id, "targetType": target_type},
|
|
88
|
+
cast_to=IDResponse,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
async def unfollow(self, target_id: str, target_type: TargetType) -> IDResponse:
|
|
92
|
+
return await self._client.post(
|
|
93
|
+
"network.cosmik.graph.unfollow",
|
|
94
|
+
{"targetId": target_id, "targetType": target_type},
|
|
95
|
+
cast_to=IDResponse,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
async def get_following(
|
|
99
|
+
self,
|
|
100
|
+
identifier: str,
|
|
101
|
+
*,
|
|
102
|
+
page: int | None = None,
|
|
103
|
+
limit: int | None = None,
|
|
104
|
+
) -> Page[User]:
|
|
105
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
106
|
+
return await self._client.get(
|
|
107
|
+
"network.cosmik.graph.getFollowing", params, cast_to=Page[User]
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
async def get_followers(
|
|
111
|
+
self,
|
|
112
|
+
identifier: str,
|
|
113
|
+
*,
|
|
114
|
+
page: int | None = None,
|
|
115
|
+
limit: int | None = None,
|
|
116
|
+
) -> Page[User]:
|
|
117
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
118
|
+
return await self._client.get(
|
|
119
|
+
"network.cosmik.graph.getFollowers", params, cast_to=Page[User]
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
async def get_following_collections(
|
|
123
|
+
self,
|
|
124
|
+
identifier: str,
|
|
125
|
+
*,
|
|
126
|
+
page: int | None = None,
|
|
127
|
+
limit: int | None = None,
|
|
128
|
+
) -> Page[Collection]:
|
|
129
|
+
params = drop_none(identifier=identifier, page=page, limit=limit)
|
|
130
|
+
return await self._client.get(
|
|
131
|
+
"network.cosmik.graph.getFollowingCollections",
|
|
132
|
+
params,
|
|
133
|
+
cast_to=Page[Collection],
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
async def get_following_count(self, identifier: str) -> CountResponse:
|
|
137
|
+
return await self._client.get(
|
|
138
|
+
"network.cosmik.graph.getFollowingCount",
|
|
139
|
+
{"identifier": identifier},
|
|
140
|
+
cast_to=CountResponse,
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
async def get_followers_count(self, identifier: str) -> CountResponse:
|
|
144
|
+
return await self._client.get(
|
|
145
|
+
"network.cosmik.graph.getFollowersCount",
|
|
146
|
+
{"identifier": identifier},
|
|
147
|
+
cast_to=CountResponse,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
async def get_following_collections_count(self, identifier: str) -> CountResponse:
|
|
151
|
+
return await self._client.get(
|
|
152
|
+
"network.cosmik.graph.getFollowingCollectionsCount",
|
|
153
|
+
{"identifier": identifier},
|
|
154
|
+
cast_to=CountResponse,
|
|
155
|
+
)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""network.cosmik.notification.* — your notification inbox."""
|
|
2
|
+
|
|
3
|
+
# Sequence (not list) in mark_read: the `list` methods shadow the builtin
|
|
4
|
+
# inside these class bodies
|
|
5
|
+
from collections.abc import Sequence
|
|
6
|
+
|
|
7
|
+
from semble._utils import drop_none
|
|
8
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
9
|
+
from semble.types import CountResponse, IDResponse, Notification, Page, SortOrder
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Notifications(SyncResource):
|
|
13
|
+
def list(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
unread_only: bool | None = None,
|
|
17
|
+
page: int | None = None,
|
|
18
|
+
limit: int | None = None,
|
|
19
|
+
sort_by: str | None = None,
|
|
20
|
+
sort_order: SortOrder | None = None,
|
|
21
|
+
) -> Page[Notification]:
|
|
22
|
+
params = drop_none(
|
|
23
|
+
unreadOnly=unread_only,
|
|
24
|
+
page=page,
|
|
25
|
+
limit=limit,
|
|
26
|
+
sortBy=sort_by,
|
|
27
|
+
sortOrder=sort_order,
|
|
28
|
+
)
|
|
29
|
+
return self._client.get(
|
|
30
|
+
"network.cosmik.notification.list", params, cast_to=Page[Notification]
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def get_unread_count(self) -> CountResponse:
|
|
34
|
+
return self._client.get(
|
|
35
|
+
"network.cosmik.notification.getUnreadCount", cast_to=CountResponse
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def mark_read(self, notification_ids: Sequence[str]) -> IDResponse:
|
|
39
|
+
return self._client.post(
|
|
40
|
+
"network.cosmik.notification.markRead",
|
|
41
|
+
{"notificationIds": [*notification_ids]},
|
|
42
|
+
cast_to=IDResponse,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def mark_all_read(self) -> IDResponse:
|
|
46
|
+
return self._client.post(
|
|
47
|
+
"network.cosmik.notification.markAllRead", {}, cast_to=IDResponse
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class AsyncNotifications(AsyncResource):
|
|
52
|
+
async def list(
|
|
53
|
+
self,
|
|
54
|
+
*,
|
|
55
|
+
unread_only: bool | None = None,
|
|
56
|
+
page: int | None = None,
|
|
57
|
+
limit: int | None = None,
|
|
58
|
+
sort_by: str | None = None,
|
|
59
|
+
sort_order: SortOrder | None = None,
|
|
60
|
+
) -> Page[Notification]:
|
|
61
|
+
params = drop_none(
|
|
62
|
+
unreadOnly=unread_only,
|
|
63
|
+
page=page,
|
|
64
|
+
limit=limit,
|
|
65
|
+
sortBy=sort_by,
|
|
66
|
+
sortOrder=sort_order,
|
|
67
|
+
)
|
|
68
|
+
return await self._client.get(
|
|
69
|
+
"network.cosmik.notification.list", params, cast_to=Page[Notification]
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
async def get_unread_count(self) -> CountResponse:
|
|
73
|
+
return await self._client.get(
|
|
74
|
+
"network.cosmik.notification.getUnreadCount", cast_to=CountResponse
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
async def mark_read(self, notification_ids: Sequence[str]) -> IDResponse:
|
|
78
|
+
return await self._client.post(
|
|
79
|
+
"network.cosmik.notification.markRead",
|
|
80
|
+
{"notificationIds": [*notification_ids]},
|
|
81
|
+
cast_to=IDResponse,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
async def mark_all_read(self) -> IDResponse:
|
|
85
|
+
return await self._client.post(
|
|
86
|
+
"network.cosmik.notification.markAllRead", {}, cast_to=IDResponse
|
|
87
|
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"""network.cosmik.search.* — semantic and similarity search."""
|
|
2
|
+
|
|
3
|
+
from semble._utils import drop_none
|
|
4
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
5
|
+
from semble.types import Page, SortOrder, URLType, URLView, User
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Search(SyncResource):
|
|
9
|
+
def semantic(
|
|
10
|
+
self,
|
|
11
|
+
query: str,
|
|
12
|
+
*,
|
|
13
|
+
threshold: float | None = None,
|
|
14
|
+
url_type: URLType | None = None,
|
|
15
|
+
identifier: str | None = None,
|
|
16
|
+
page: int | None = None,
|
|
17
|
+
limit: int | None = None,
|
|
18
|
+
sort_by: str | None = None,
|
|
19
|
+
sort_order: SortOrder | None = None,
|
|
20
|
+
) -> Page[URLView]:
|
|
21
|
+
params = drop_none(
|
|
22
|
+
query=query,
|
|
23
|
+
threshold=threshold,
|
|
24
|
+
urlType=url_type,
|
|
25
|
+
identifier=identifier,
|
|
26
|
+
page=page,
|
|
27
|
+
limit=limit,
|
|
28
|
+
sortBy=sort_by,
|
|
29
|
+
sortOrder=sort_order,
|
|
30
|
+
)
|
|
31
|
+
return self._client.get(
|
|
32
|
+
"network.cosmik.search.semantic", params, cast_to=Page[URLView]
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
def get_similar_urls(
|
|
36
|
+
self,
|
|
37
|
+
url: str,
|
|
38
|
+
*,
|
|
39
|
+
threshold: float | None = None,
|
|
40
|
+
url_type: URLType | None = None,
|
|
41
|
+
page: int | None = None,
|
|
42
|
+
limit: int | None = None,
|
|
43
|
+
sort_by: str | None = None,
|
|
44
|
+
sort_order: SortOrder | None = None,
|
|
45
|
+
) -> Page[URLView]:
|
|
46
|
+
params = drop_none(
|
|
47
|
+
url=url,
|
|
48
|
+
threshold=threshold,
|
|
49
|
+
urlType=url_type,
|
|
50
|
+
page=page,
|
|
51
|
+
limit=limit,
|
|
52
|
+
sortBy=sort_by,
|
|
53
|
+
sortOrder=sort_order,
|
|
54
|
+
)
|
|
55
|
+
return self._client.get(
|
|
56
|
+
"network.cosmik.search.getSimilarUrls", params, cast_to=Page[URLView]
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
def get_accounts(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
term: str | None = None,
|
|
63
|
+
q: str | None = None,
|
|
64
|
+
limit: int | None = None,
|
|
65
|
+
cursor: str | None = None,
|
|
66
|
+
) -> Page[User]:
|
|
67
|
+
params = drop_none(term=term, q=q, limit=limit, cursor=cursor)
|
|
68
|
+
return self._client.get(
|
|
69
|
+
"network.cosmik.search.getAccounts", params, cast_to=Page[User]
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class AsyncSearch(AsyncResource):
|
|
74
|
+
async def semantic(
|
|
75
|
+
self,
|
|
76
|
+
query: str,
|
|
77
|
+
*,
|
|
78
|
+
threshold: float | None = None,
|
|
79
|
+
url_type: URLType | None = None,
|
|
80
|
+
identifier: str | None = None,
|
|
81
|
+
page: int | None = None,
|
|
82
|
+
limit: int | None = None,
|
|
83
|
+
sort_by: str | None = None,
|
|
84
|
+
sort_order: SortOrder | None = None,
|
|
85
|
+
) -> Page[URLView]:
|
|
86
|
+
params = drop_none(
|
|
87
|
+
query=query,
|
|
88
|
+
threshold=threshold,
|
|
89
|
+
urlType=url_type,
|
|
90
|
+
identifier=identifier,
|
|
91
|
+
page=page,
|
|
92
|
+
limit=limit,
|
|
93
|
+
sortBy=sort_by,
|
|
94
|
+
sortOrder=sort_order,
|
|
95
|
+
)
|
|
96
|
+
return await self._client.get(
|
|
97
|
+
"network.cosmik.search.semantic", params, cast_to=Page[URLView]
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
async def get_similar_urls(
|
|
101
|
+
self,
|
|
102
|
+
url: str,
|
|
103
|
+
*,
|
|
104
|
+
threshold: float | None = None,
|
|
105
|
+
url_type: URLType | None = None,
|
|
106
|
+
page: int | None = None,
|
|
107
|
+
limit: int | None = None,
|
|
108
|
+
sort_by: str | None = None,
|
|
109
|
+
sort_order: SortOrder | None = None,
|
|
110
|
+
) -> Page[URLView]:
|
|
111
|
+
params = drop_none(
|
|
112
|
+
url=url,
|
|
113
|
+
threshold=threshold,
|
|
114
|
+
urlType=url_type,
|
|
115
|
+
page=page,
|
|
116
|
+
limit=limit,
|
|
117
|
+
sortBy=sort_by,
|
|
118
|
+
sortOrder=sort_order,
|
|
119
|
+
)
|
|
120
|
+
return await self._client.get(
|
|
121
|
+
"network.cosmik.search.getSimilarUrls", params, cast_to=Page[URLView]
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
async def get_accounts(
|
|
125
|
+
self,
|
|
126
|
+
*,
|
|
127
|
+
term: str | None = None,
|
|
128
|
+
q: str | None = None,
|
|
129
|
+
limit: int | None = None,
|
|
130
|
+
cursor: str | None = None,
|
|
131
|
+
) -> Page[User]:
|
|
132
|
+
params = drop_none(term=term, q=q, limit=limit, cursor=cursor)
|
|
133
|
+
return await self._client.get(
|
|
134
|
+
"network.cosmik.search.getAccounts", params, cast_to=Page[User]
|
|
135
|
+
)
|
semble/settings.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from pydantic import Field, SecretStr
|
|
2
|
+
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
3
|
+
|
|
4
|
+
DEFAULT_BASE_URL = "https://api.semble.so/xrpc"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SembleSettings(BaseSettings):
|
|
8
|
+
"""client configuration from the environment and a local `.env` file.
|
|
9
|
+
|
|
10
|
+
every field reads `SEMBLE_`-prefixed sources: `SEMBLE_API_KEY`,
|
|
11
|
+
`SEMBLE_BASE_URL`, `SEMBLE_TIMEOUT`. explicit client kwargs win over
|
|
12
|
+
the environment, which wins over `.env`.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
model_config = SettingsConfigDict(
|
|
16
|
+
env_prefix="SEMBLE_",
|
|
17
|
+
env_file=".env",
|
|
18
|
+
env_file_encoding="utf-8",
|
|
19
|
+
extra="ignore",
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
api_key: SecretStr | None = Field(
|
|
23
|
+
default=None, description="API key for authentication"
|
|
24
|
+
)
|
|
25
|
+
base_url: str = Field(default=DEFAULT_BASE_URL, description="Base URL for the API")
|
|
26
|
+
timeout: float = Field(default=30.0, description="Timeout for API requests")
|