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,447 @@
|
|
|
1
|
+
"""network.cosmik.collection.* — named groups of cards."""
|
|
2
|
+
|
|
3
|
+
from semble._utils import drop_none
|
|
4
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
5
|
+
from semble.types import (
|
|
6
|
+
AccessType,
|
|
7
|
+
Collection,
|
|
8
|
+
CollectionDetail,
|
|
9
|
+
CountResponse,
|
|
10
|
+
IDResponse,
|
|
11
|
+
Page,
|
|
12
|
+
SortOrder,
|
|
13
|
+
URLType,
|
|
14
|
+
User,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Collections(SyncResource):
|
|
19
|
+
def create(
|
|
20
|
+
self,
|
|
21
|
+
name: str,
|
|
22
|
+
*,
|
|
23
|
+
description: str | None = None,
|
|
24
|
+
access_type: AccessType | None = None,
|
|
25
|
+
) -> IDResponse:
|
|
26
|
+
body = drop_none(name=name, description=description, accessType=access_type)
|
|
27
|
+
return self._client.post(
|
|
28
|
+
"network.cosmik.collection.create", body, cast_to=IDResponse
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def get(
|
|
32
|
+
self,
|
|
33
|
+
collection_id: str,
|
|
34
|
+
*,
|
|
35
|
+
page: int | None = None,
|
|
36
|
+
limit: int | None = None,
|
|
37
|
+
sort_by: str | None = None,
|
|
38
|
+
sort_order: SortOrder | None = None,
|
|
39
|
+
url_type: URLType | None = None,
|
|
40
|
+
) -> CollectionDetail:
|
|
41
|
+
params = drop_none(
|
|
42
|
+
collectionId=collection_id,
|
|
43
|
+
page=page,
|
|
44
|
+
limit=limit,
|
|
45
|
+
sortBy=sort_by,
|
|
46
|
+
sortOrder=sort_order,
|
|
47
|
+
urlType=url_type,
|
|
48
|
+
)
|
|
49
|
+
return self._client.get(
|
|
50
|
+
"network.cosmik.collection.get", params, cast_to=CollectionDetail
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
def get_by_at_uri(
|
|
54
|
+
self,
|
|
55
|
+
handle: str,
|
|
56
|
+
record_key: str,
|
|
57
|
+
*,
|
|
58
|
+
page: int | None = None,
|
|
59
|
+
limit: int | None = None,
|
|
60
|
+
sort_by: str | None = None,
|
|
61
|
+
sort_order: SortOrder | None = None,
|
|
62
|
+
url_type: URLType | None = None,
|
|
63
|
+
) -> CollectionDetail:
|
|
64
|
+
params = drop_none(
|
|
65
|
+
handle=handle,
|
|
66
|
+
recordKey=record_key,
|
|
67
|
+
page=page,
|
|
68
|
+
limit=limit,
|
|
69
|
+
sortBy=sort_by,
|
|
70
|
+
sortOrder=sort_order,
|
|
71
|
+
urlType=url_type,
|
|
72
|
+
)
|
|
73
|
+
return self._client.get(
|
|
74
|
+
"network.cosmik.collection.getByAtUri", params, cast_to=CollectionDetail
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
def update(
|
|
78
|
+
self,
|
|
79
|
+
collection_id: str,
|
|
80
|
+
*,
|
|
81
|
+
name: str | None = None,
|
|
82
|
+
description: str | None = None,
|
|
83
|
+
access_type: AccessType | None = None,
|
|
84
|
+
) -> None:
|
|
85
|
+
body = drop_none(
|
|
86
|
+
collectionId=collection_id,
|
|
87
|
+
name=name,
|
|
88
|
+
description=description,
|
|
89
|
+
accessType=access_type,
|
|
90
|
+
)
|
|
91
|
+
self._client.post("network.cosmik.collection.update", body)
|
|
92
|
+
|
|
93
|
+
def delete(self, collection_id: str) -> None:
|
|
94
|
+
self._client.post(
|
|
95
|
+
"network.cosmik.collection.delete", {"collectionId": collection_id}
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def list_mine(
|
|
99
|
+
self,
|
|
100
|
+
*,
|
|
101
|
+
search_text: str | None = None,
|
|
102
|
+
page: int | None = None,
|
|
103
|
+
limit: int | None = None,
|
|
104
|
+
sort_by: str | None = None,
|
|
105
|
+
sort_order: SortOrder | None = None,
|
|
106
|
+
) -> Page[Collection]:
|
|
107
|
+
params = drop_none(
|
|
108
|
+
searchText=search_text,
|
|
109
|
+
page=page,
|
|
110
|
+
limit=limit,
|
|
111
|
+
sortBy=sort_by,
|
|
112
|
+
sortOrder=sort_order,
|
|
113
|
+
)
|
|
114
|
+
return self._client.get(
|
|
115
|
+
"network.cosmik.collection.listMine", params, cast_to=Page[Collection]
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
def list_by_user(
|
|
119
|
+
self,
|
|
120
|
+
identifier: str,
|
|
121
|
+
*,
|
|
122
|
+
search_text: str | None = None,
|
|
123
|
+
page: int | None = None,
|
|
124
|
+
limit: int | None = None,
|
|
125
|
+
sort_by: str | None = None,
|
|
126
|
+
sort_order: SortOrder | None = None,
|
|
127
|
+
) -> Page[Collection]:
|
|
128
|
+
params = drop_none(
|
|
129
|
+
identifier=identifier,
|
|
130
|
+
searchText=search_text,
|
|
131
|
+
page=page,
|
|
132
|
+
limit=limit,
|
|
133
|
+
sortBy=sort_by,
|
|
134
|
+
sortOrder=sort_order,
|
|
135
|
+
)
|
|
136
|
+
return self._client.get(
|
|
137
|
+
"network.cosmik.collection.listByUser", params, cast_to=Page[Collection]
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def list_contributed(
|
|
141
|
+
self,
|
|
142
|
+
identifier: str,
|
|
143
|
+
*,
|
|
144
|
+
page: int | None = None,
|
|
145
|
+
limit: int | None = None,
|
|
146
|
+
sort_by: str | None = None,
|
|
147
|
+
sort_order: SortOrder | None = None,
|
|
148
|
+
) -> Page[Collection]:
|
|
149
|
+
params = drop_none(
|
|
150
|
+
identifier=identifier,
|
|
151
|
+
page=page,
|
|
152
|
+
limit=limit,
|
|
153
|
+
sortBy=sort_by,
|
|
154
|
+
sortOrder=sort_order,
|
|
155
|
+
)
|
|
156
|
+
return self._client.get(
|
|
157
|
+
"network.cosmik.collection.listContributed",
|
|
158
|
+
params,
|
|
159
|
+
cast_to=Page[Collection],
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
def get_for_url(
|
|
163
|
+
self,
|
|
164
|
+
url: str,
|
|
165
|
+
*,
|
|
166
|
+
page: int | None = None,
|
|
167
|
+
limit: int | None = None,
|
|
168
|
+
sort_by: str | None = None,
|
|
169
|
+
sort_order: SortOrder | None = None,
|
|
170
|
+
) -> Page[Collection]:
|
|
171
|
+
params = drop_none(
|
|
172
|
+
url=url, page=page, limit=limit, sortBy=sort_by, sortOrder=sort_order
|
|
173
|
+
)
|
|
174
|
+
return self._client.get(
|
|
175
|
+
"network.cosmik.collection.getForUrl", params, cast_to=Page[Collection]
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
def search(
|
|
179
|
+
self,
|
|
180
|
+
*,
|
|
181
|
+
search_text: str | None = None,
|
|
182
|
+
identifier: str | None = None,
|
|
183
|
+
access_type: AccessType | None = None,
|
|
184
|
+
page: int | None = None,
|
|
185
|
+
limit: int | None = None,
|
|
186
|
+
sort_by: str | None = None,
|
|
187
|
+
sort_order: SortOrder | None = None,
|
|
188
|
+
) -> Page[Collection]:
|
|
189
|
+
params = drop_none(
|
|
190
|
+
searchText=search_text,
|
|
191
|
+
identifier=identifier,
|
|
192
|
+
accessType=access_type,
|
|
193
|
+
page=page,
|
|
194
|
+
limit=limit,
|
|
195
|
+
sortBy=sort_by,
|
|
196
|
+
sortOrder=sort_order,
|
|
197
|
+
)
|
|
198
|
+
return self._client.get(
|
|
199
|
+
"network.cosmik.collection.search", params, cast_to=Page[Collection]
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def get_followers(
|
|
203
|
+
self,
|
|
204
|
+
collection_id: str,
|
|
205
|
+
*,
|
|
206
|
+
page: int | None = None,
|
|
207
|
+
limit: int | None = None,
|
|
208
|
+
) -> Page[User]:
|
|
209
|
+
params = drop_none(collectionId=collection_id, page=page, limit=limit)
|
|
210
|
+
return self._client.get(
|
|
211
|
+
"network.cosmik.collection.getFollowers", params, cast_to=Page[User]
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
def get_follower_count(self, collection_id: str) -> CountResponse:
|
|
215
|
+
return self._client.get(
|
|
216
|
+
"network.cosmik.collection.getFollowerCount",
|
|
217
|
+
{"collectionId": collection_id},
|
|
218
|
+
cast_to=CountResponse,
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
def get_contributors(
|
|
222
|
+
self,
|
|
223
|
+
collection_id: str,
|
|
224
|
+
*,
|
|
225
|
+
page: int | None = None,
|
|
226
|
+
limit: int | None = None,
|
|
227
|
+
) -> Page[User]:
|
|
228
|
+
params = drop_none(collectionId=collection_id, page=page, limit=limit)
|
|
229
|
+
return self._client.get(
|
|
230
|
+
"network.cosmik.collection.getContributors", params, cast_to=Page[User]
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class AsyncCollections(AsyncResource):
|
|
235
|
+
async def create(
|
|
236
|
+
self,
|
|
237
|
+
name: str,
|
|
238
|
+
*,
|
|
239
|
+
description: str | None = None,
|
|
240
|
+
access_type: AccessType | None = None,
|
|
241
|
+
) -> IDResponse:
|
|
242
|
+
body = drop_none(name=name, description=description, accessType=access_type)
|
|
243
|
+
return await self._client.post(
|
|
244
|
+
"network.cosmik.collection.create", body, cast_to=IDResponse
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
async def get(
|
|
248
|
+
self,
|
|
249
|
+
collection_id: str,
|
|
250
|
+
*,
|
|
251
|
+
page: int | None = None,
|
|
252
|
+
limit: int | None = None,
|
|
253
|
+
sort_by: str | None = None,
|
|
254
|
+
sort_order: SortOrder | None = None,
|
|
255
|
+
url_type: URLType | None = None,
|
|
256
|
+
) -> CollectionDetail:
|
|
257
|
+
params = drop_none(
|
|
258
|
+
collectionId=collection_id,
|
|
259
|
+
page=page,
|
|
260
|
+
limit=limit,
|
|
261
|
+
sortBy=sort_by,
|
|
262
|
+
sortOrder=sort_order,
|
|
263
|
+
urlType=url_type,
|
|
264
|
+
)
|
|
265
|
+
return await self._client.get(
|
|
266
|
+
"network.cosmik.collection.get", params, cast_to=CollectionDetail
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
async def get_by_at_uri(
|
|
270
|
+
self,
|
|
271
|
+
handle: str,
|
|
272
|
+
record_key: str,
|
|
273
|
+
*,
|
|
274
|
+
page: int | None = None,
|
|
275
|
+
limit: int | None = None,
|
|
276
|
+
sort_by: str | None = None,
|
|
277
|
+
sort_order: SortOrder | None = None,
|
|
278
|
+
url_type: URLType | None = None,
|
|
279
|
+
) -> CollectionDetail:
|
|
280
|
+
params = drop_none(
|
|
281
|
+
handle=handle,
|
|
282
|
+
recordKey=record_key,
|
|
283
|
+
page=page,
|
|
284
|
+
limit=limit,
|
|
285
|
+
sortBy=sort_by,
|
|
286
|
+
sortOrder=sort_order,
|
|
287
|
+
urlType=url_type,
|
|
288
|
+
)
|
|
289
|
+
return await self._client.get(
|
|
290
|
+
"network.cosmik.collection.getByAtUri", params, cast_to=CollectionDetail
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
async def update(
|
|
294
|
+
self,
|
|
295
|
+
collection_id: str,
|
|
296
|
+
*,
|
|
297
|
+
name: str | None = None,
|
|
298
|
+
description: str | None = None,
|
|
299
|
+
access_type: AccessType | None = None,
|
|
300
|
+
) -> None:
|
|
301
|
+
body = drop_none(
|
|
302
|
+
collectionId=collection_id,
|
|
303
|
+
name=name,
|
|
304
|
+
description=description,
|
|
305
|
+
accessType=access_type,
|
|
306
|
+
)
|
|
307
|
+
await self._client.post("network.cosmik.collection.update", body)
|
|
308
|
+
|
|
309
|
+
async def delete(self, collection_id: str) -> None:
|
|
310
|
+
await self._client.post(
|
|
311
|
+
"network.cosmik.collection.delete", {"collectionId": collection_id}
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
async def list_mine(
|
|
315
|
+
self,
|
|
316
|
+
*,
|
|
317
|
+
search_text: str | None = None,
|
|
318
|
+
page: int | None = None,
|
|
319
|
+
limit: int | None = None,
|
|
320
|
+
sort_by: str | None = None,
|
|
321
|
+
sort_order: SortOrder | None = None,
|
|
322
|
+
) -> Page[Collection]:
|
|
323
|
+
params = drop_none(
|
|
324
|
+
searchText=search_text,
|
|
325
|
+
page=page,
|
|
326
|
+
limit=limit,
|
|
327
|
+
sortBy=sort_by,
|
|
328
|
+
sortOrder=sort_order,
|
|
329
|
+
)
|
|
330
|
+
return await self._client.get(
|
|
331
|
+
"network.cosmik.collection.listMine", params, cast_to=Page[Collection]
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
async def list_by_user(
|
|
335
|
+
self,
|
|
336
|
+
identifier: str,
|
|
337
|
+
*,
|
|
338
|
+
search_text: str | None = None,
|
|
339
|
+
page: int | None = None,
|
|
340
|
+
limit: int | None = None,
|
|
341
|
+
sort_by: str | None = None,
|
|
342
|
+
sort_order: SortOrder | None = None,
|
|
343
|
+
) -> Page[Collection]:
|
|
344
|
+
params = drop_none(
|
|
345
|
+
identifier=identifier,
|
|
346
|
+
searchText=search_text,
|
|
347
|
+
page=page,
|
|
348
|
+
limit=limit,
|
|
349
|
+
sortBy=sort_by,
|
|
350
|
+
sortOrder=sort_order,
|
|
351
|
+
)
|
|
352
|
+
return await self._client.get(
|
|
353
|
+
"network.cosmik.collection.listByUser", params, cast_to=Page[Collection]
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
async def list_contributed(
|
|
357
|
+
self,
|
|
358
|
+
identifier: str,
|
|
359
|
+
*,
|
|
360
|
+
page: int | None = None,
|
|
361
|
+
limit: int | None = None,
|
|
362
|
+
sort_by: str | None = None,
|
|
363
|
+
sort_order: SortOrder | None = None,
|
|
364
|
+
) -> Page[Collection]:
|
|
365
|
+
params = drop_none(
|
|
366
|
+
identifier=identifier,
|
|
367
|
+
page=page,
|
|
368
|
+
limit=limit,
|
|
369
|
+
sortBy=sort_by,
|
|
370
|
+
sortOrder=sort_order,
|
|
371
|
+
)
|
|
372
|
+
return await self._client.get(
|
|
373
|
+
"network.cosmik.collection.listContributed",
|
|
374
|
+
params,
|
|
375
|
+
cast_to=Page[Collection],
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
async def get_for_url(
|
|
379
|
+
self,
|
|
380
|
+
url: str,
|
|
381
|
+
*,
|
|
382
|
+
page: int | None = None,
|
|
383
|
+
limit: int | None = None,
|
|
384
|
+
sort_by: str | None = None,
|
|
385
|
+
sort_order: SortOrder | None = None,
|
|
386
|
+
) -> Page[Collection]:
|
|
387
|
+
params = drop_none(
|
|
388
|
+
url=url, page=page, limit=limit, sortBy=sort_by, sortOrder=sort_order
|
|
389
|
+
)
|
|
390
|
+
return await self._client.get(
|
|
391
|
+
"network.cosmik.collection.getForUrl", params, cast_to=Page[Collection]
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
async def search(
|
|
395
|
+
self,
|
|
396
|
+
*,
|
|
397
|
+
search_text: str | None = None,
|
|
398
|
+
identifier: str | None = None,
|
|
399
|
+
access_type: AccessType | None = None,
|
|
400
|
+
page: int | None = None,
|
|
401
|
+
limit: int | None = None,
|
|
402
|
+
sort_by: str | None = None,
|
|
403
|
+
sort_order: SortOrder | None = None,
|
|
404
|
+
) -> Page[Collection]:
|
|
405
|
+
params = drop_none(
|
|
406
|
+
searchText=search_text,
|
|
407
|
+
identifier=identifier,
|
|
408
|
+
accessType=access_type,
|
|
409
|
+
page=page,
|
|
410
|
+
limit=limit,
|
|
411
|
+
sortBy=sort_by,
|
|
412
|
+
sortOrder=sort_order,
|
|
413
|
+
)
|
|
414
|
+
return await self._client.get(
|
|
415
|
+
"network.cosmik.collection.search", params, cast_to=Page[Collection]
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
async def get_followers(
|
|
419
|
+
self,
|
|
420
|
+
collection_id: str,
|
|
421
|
+
*,
|
|
422
|
+
page: int | None = None,
|
|
423
|
+
limit: int | None = None,
|
|
424
|
+
) -> Page[User]:
|
|
425
|
+
params = drop_none(collectionId=collection_id, page=page, limit=limit)
|
|
426
|
+
return await self._client.get(
|
|
427
|
+
"network.cosmik.collection.getFollowers", params, cast_to=Page[User]
|
|
428
|
+
)
|
|
429
|
+
|
|
430
|
+
async def get_follower_count(self, collection_id: str) -> CountResponse:
|
|
431
|
+
return await self._client.get(
|
|
432
|
+
"network.cosmik.collection.getFollowerCount",
|
|
433
|
+
{"collectionId": collection_id},
|
|
434
|
+
cast_to=CountResponse,
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
async def get_contributors(
|
|
438
|
+
self,
|
|
439
|
+
collection_id: str,
|
|
440
|
+
*,
|
|
441
|
+
page: int | None = None,
|
|
442
|
+
limit: int | None = None,
|
|
443
|
+
) -> Page[User]:
|
|
444
|
+
params = drop_none(collectionId=collection_id, page=page, limit=limit)
|
|
445
|
+
return await self._client.get(
|
|
446
|
+
"network.cosmik.collection.getContributors", params, cast_to=Page[User]
|
|
447
|
+
)
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"""network.cosmik.connection.* — typed links between urls."""
|
|
2
|
+
|
|
3
|
+
from semble._utils import drop_none
|
|
4
|
+
from semble.resources._base import AsyncResource, SyncResource
|
|
5
|
+
from semble.types import ConnectionType, ConnectionView, IDResponse, Page, SortOrder
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Connections(SyncResource):
|
|
9
|
+
def create(
|
|
10
|
+
self,
|
|
11
|
+
*,
|
|
12
|
+
source_type: str | None = None,
|
|
13
|
+
source_value: str | None = None,
|
|
14
|
+
target_type: str | None = None,
|
|
15
|
+
target_value: str | None = None,
|
|
16
|
+
connection_type: ConnectionType | None = None,
|
|
17
|
+
note: str | None = None,
|
|
18
|
+
) -> IDResponse:
|
|
19
|
+
body = drop_none(
|
|
20
|
+
sourceType=source_type,
|
|
21
|
+
sourceValue=source_value,
|
|
22
|
+
targetType=target_type,
|
|
23
|
+
targetValue=target_value,
|
|
24
|
+
connectionType=connection_type,
|
|
25
|
+
note=note,
|
|
26
|
+
)
|
|
27
|
+
return self._client.post(
|
|
28
|
+
"network.cosmik.connection.create", body, cast_to=IDResponse
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
def update(
|
|
32
|
+
self,
|
|
33
|
+
connection_id: str,
|
|
34
|
+
*,
|
|
35
|
+
connection_type: ConnectionType | None = None,
|
|
36
|
+
note: str | None = None,
|
|
37
|
+
remove_note: bool | None = None,
|
|
38
|
+
swap: bool | None = None,
|
|
39
|
+
) -> IDResponse:
|
|
40
|
+
body = drop_none(
|
|
41
|
+
connectionId=connection_id,
|
|
42
|
+
connectionType=connection_type,
|
|
43
|
+
note=note,
|
|
44
|
+
removeNote=remove_note,
|
|
45
|
+
swap=swap,
|
|
46
|
+
)
|
|
47
|
+
return self._client.post(
|
|
48
|
+
"network.cosmik.connection.update", body, cast_to=IDResponse
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def delete(self, connection_id: str) -> IDResponse:
|
|
52
|
+
return self._client.post(
|
|
53
|
+
"network.cosmik.connection.delete",
|
|
54
|
+
{"connectionId": connection_id},
|
|
55
|
+
cast_to=IDResponse,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
def get_for_url(
|
|
59
|
+
self,
|
|
60
|
+
url: str,
|
|
61
|
+
*,
|
|
62
|
+
direction: str | None = None,
|
|
63
|
+
connection_types: list[ConnectionType] | None = None,
|
|
64
|
+
page: int | None = None,
|
|
65
|
+
limit: int | None = None,
|
|
66
|
+
sort_by: str | None = None,
|
|
67
|
+
sort_order: SortOrder | None = None,
|
|
68
|
+
) -> Page[ConnectionView]:
|
|
69
|
+
params = drop_none(
|
|
70
|
+
url=url,
|
|
71
|
+
direction=direction,
|
|
72
|
+
connectionTypes=connection_types,
|
|
73
|
+
page=page,
|
|
74
|
+
limit=limit,
|
|
75
|
+
sortBy=sort_by,
|
|
76
|
+
sortOrder=sort_order,
|
|
77
|
+
)
|
|
78
|
+
return self._client.get(
|
|
79
|
+
"network.cosmik.connection.getForUrl", params, cast_to=Page[ConnectionView]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def list_by_user(
|
|
83
|
+
self,
|
|
84
|
+
identifier: str,
|
|
85
|
+
*,
|
|
86
|
+
connection_types: list[ConnectionType] | None = None,
|
|
87
|
+
page: int | None = None,
|
|
88
|
+
limit: int | None = None,
|
|
89
|
+
sort_by: str | None = None,
|
|
90
|
+
sort_order: SortOrder | None = None,
|
|
91
|
+
) -> Page[ConnectionView]:
|
|
92
|
+
params = drop_none(
|
|
93
|
+
identifier=identifier,
|
|
94
|
+
connectionTypes=connection_types,
|
|
95
|
+
page=page,
|
|
96
|
+
limit=limit,
|
|
97
|
+
sortBy=sort_by,
|
|
98
|
+
sortOrder=sort_order,
|
|
99
|
+
)
|
|
100
|
+
return self._client.get(
|
|
101
|
+
"network.cosmik.connection.listByUser", params, cast_to=Page[ConnectionView]
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class AsyncConnections(AsyncResource):
|
|
106
|
+
async def create(
|
|
107
|
+
self,
|
|
108
|
+
*,
|
|
109
|
+
source_type: str | None = None,
|
|
110
|
+
source_value: str | None = None,
|
|
111
|
+
target_type: str | None = None,
|
|
112
|
+
target_value: str | None = None,
|
|
113
|
+
connection_type: ConnectionType | None = None,
|
|
114
|
+
note: str | None = None,
|
|
115
|
+
) -> IDResponse:
|
|
116
|
+
body = drop_none(
|
|
117
|
+
sourceType=source_type,
|
|
118
|
+
sourceValue=source_value,
|
|
119
|
+
targetType=target_type,
|
|
120
|
+
targetValue=target_value,
|
|
121
|
+
connectionType=connection_type,
|
|
122
|
+
note=note,
|
|
123
|
+
)
|
|
124
|
+
return await self._client.post(
|
|
125
|
+
"network.cosmik.connection.create", body, cast_to=IDResponse
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
async def update(
|
|
129
|
+
self,
|
|
130
|
+
connection_id: str,
|
|
131
|
+
*,
|
|
132
|
+
connection_type: ConnectionType | None = None,
|
|
133
|
+
note: str | None = None,
|
|
134
|
+
remove_note: bool | None = None,
|
|
135
|
+
swap: bool | None = None,
|
|
136
|
+
) -> IDResponse:
|
|
137
|
+
body = drop_none(
|
|
138
|
+
connectionId=connection_id,
|
|
139
|
+
connectionType=connection_type,
|
|
140
|
+
note=note,
|
|
141
|
+
removeNote=remove_note,
|
|
142
|
+
swap=swap,
|
|
143
|
+
)
|
|
144
|
+
return await self._client.post(
|
|
145
|
+
"network.cosmik.connection.update", body, cast_to=IDResponse
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
async def delete(self, connection_id: str) -> IDResponse:
|
|
149
|
+
return await self._client.post(
|
|
150
|
+
"network.cosmik.connection.delete",
|
|
151
|
+
{"connectionId": connection_id},
|
|
152
|
+
cast_to=IDResponse,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
async def get_for_url(
|
|
156
|
+
self,
|
|
157
|
+
url: str,
|
|
158
|
+
*,
|
|
159
|
+
direction: str | None = None,
|
|
160
|
+
connection_types: list[ConnectionType] | None = None,
|
|
161
|
+
page: int | None = None,
|
|
162
|
+
limit: int | None = None,
|
|
163
|
+
sort_by: str | None = None,
|
|
164
|
+
sort_order: SortOrder | None = None,
|
|
165
|
+
) -> Page[ConnectionView]:
|
|
166
|
+
params = drop_none(
|
|
167
|
+
url=url,
|
|
168
|
+
direction=direction,
|
|
169
|
+
connectionTypes=connection_types,
|
|
170
|
+
page=page,
|
|
171
|
+
limit=limit,
|
|
172
|
+
sortBy=sort_by,
|
|
173
|
+
sortOrder=sort_order,
|
|
174
|
+
)
|
|
175
|
+
return await self._client.get(
|
|
176
|
+
"network.cosmik.connection.getForUrl", params, cast_to=Page[ConnectionView]
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
async def list_by_user(
|
|
180
|
+
self,
|
|
181
|
+
identifier: str,
|
|
182
|
+
*,
|
|
183
|
+
connection_types: list[ConnectionType] | None = None,
|
|
184
|
+
page: int | None = None,
|
|
185
|
+
limit: int | None = None,
|
|
186
|
+
sort_by: str | None = None,
|
|
187
|
+
sort_order: SortOrder | None = None,
|
|
188
|
+
) -> Page[ConnectionView]:
|
|
189
|
+
params = drop_none(
|
|
190
|
+
identifier=identifier,
|
|
191
|
+
connectionTypes=connection_types,
|
|
192
|
+
page=page,
|
|
193
|
+
limit=limit,
|
|
194
|
+
sortBy=sort_by,
|
|
195
|
+
sortOrder=sort_order,
|
|
196
|
+
)
|
|
197
|
+
return await self._client.get(
|
|
198
|
+
"network.cosmik.connection.listByUser", params, cast_to=Page[ConnectionView]
|
|
199
|
+
)
|