|
1 | 1 | # This file was auto-generated by Fern from our API Definition. |
2 | 2 |
|
| 3 | +import datetime as dt |
3 | 4 | import typing |
4 | 5 | import uuid |
5 | 6 |
|
|
11 | 12 | from .types.create_conversation_response import CreateConversationResponse |
12 | 13 | from .types.create_copilot_response import CreateCopilotResponse |
13 | 14 | from .types.delete_copilot_response import DeleteCopilotResponse |
| 15 | +from .types.export_copilots_response import ExportCopilotsResponse |
14 | 16 | from .types.input_variable import InputVariable |
15 | 17 | from .types.message_feedback import MessageFeedback |
16 | 18 | from .types.send_agent_message_response import SendAgentMessageResponse |
@@ -552,6 +554,82 @@ def delete_copilot( |
552 | 554 | _response = self._raw_client.delete_copilot(id=id, request_options=request_options) |
553 | 555 | return _response.data |
554 | 556 |
|
| 557 | + def export( |
| 558 | + self, |
| 559 | + *, |
| 560 | + agent_created_from: typing.Optional[dt.datetime] = OMIT, |
| 561 | + agent_created_to: typing.Optional[dt.datetime] = OMIT, |
| 562 | + version_created_from: typing.Optional[dt.datetime] = OMIT, |
| 563 | + version_created_to: typing.Optional[dt.datetime] = OMIT, |
| 564 | + limit: typing.Optional[int] = OMIT, |
| 565 | + cursor: typing.Optional[str] = OMIT, |
| 566 | + request_options: typing.Optional[RequestOptions] = None, |
| 567 | + ) -> ExportCopilotsResponse: |
| 568 | + """ |
| 569 | + Export copilot configurations for backup or migration purposes. |
| 570 | +
|
| 571 | + **IMPORTANT**: This endpoint requires: |
| 572 | + - Admin privileges |
| 573 | + - The 'ai-usage-analytics-log.export' scope on the API key |
| 574 | +
|
| 575 | + Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results. |
| 576 | +
|
| 577 | + Parameters |
| 578 | + ---------- |
| 579 | + agent_created_from : typing.Optional[dt.datetime] |
| 580 | + Filter copilots created on or after this datetime (ISO 8601 format). |
| 581 | +
|
| 582 | + agent_created_to : typing.Optional[dt.datetime] |
| 583 | + Filter copilots created before or on this datetime (ISO 8601 format). |
| 584 | +
|
| 585 | + version_created_from : typing.Optional[dt.datetime] |
| 586 | + Filter copilot versions created on or after this datetime (ISO 8601 format). |
| 587 | +
|
| 588 | + version_created_to : typing.Optional[dt.datetime] |
| 589 | + Filter copilot versions created before or on this datetime (ISO 8601 format). |
| 590 | +
|
| 591 | + limit : typing.Optional[int] |
| 592 | + Maximum number of copilots to return. Must be a positive integer with a maximum value of 1000. Defaults to 100. |
| 593 | +
|
| 594 | + cursor : typing.Optional[str] |
| 595 | + Cursor for pagination. Use the cursor returned in the previous response to fetch the next page of results. If not provided, returns the first page. |
| 596 | +
|
| 597 | + request_options : typing.Optional[RequestOptions] |
| 598 | + Request-specific configuration. |
| 599 | +
|
| 600 | + Returns |
| 601 | + ------- |
| 602 | + ExportCopilotsResponse |
| 603 | +
|
| 604 | + Examples |
| 605 | + -------- |
| 606 | + import datetime |
| 607 | +
|
| 608 | + from credal import CredalApi |
| 609 | +
|
| 610 | + client = CredalApi( |
| 611 | + api_key="YOUR_API_KEY", |
| 612 | + ) |
| 613 | + client.copilots.export( |
| 614 | + agent_created_from=datetime.datetime.fromisoformat( |
| 615 | + "2024-01-01 00:00:00+00:00", |
| 616 | + ), |
| 617 | + agent_created_to=datetime.datetime.fromisoformat( |
| 618 | + "2024-12-31 23:59:59+00:00", |
| 619 | + ), |
| 620 | + ) |
| 621 | + """ |
| 622 | + _response = self._raw_client.export( |
| 623 | + agent_created_from=agent_created_from, |
| 624 | + agent_created_to=agent_created_to, |
| 625 | + version_created_from=version_created_from, |
| 626 | + version_created_to=version_created_to, |
| 627 | + limit=limit, |
| 628 | + cursor=cursor, |
| 629 | + request_options=request_options, |
| 630 | + ) |
| 631 | + return _response.data |
| 632 | + |
555 | 633 |
|
556 | 634 | class AsyncCopilotsClient: |
557 | 635 | def __init__(self, *, client_wrapper: AsyncClientWrapper): |
@@ -1149,3 +1227,86 @@ async def main() -> None: |
1149 | 1227 | """ |
1150 | 1228 | _response = await self._raw_client.delete_copilot(id=id, request_options=request_options) |
1151 | 1229 | return _response.data |
| 1230 | + |
| 1231 | + async def export( |
| 1232 | + self, |
| 1233 | + *, |
| 1234 | + agent_created_from: typing.Optional[dt.datetime] = OMIT, |
| 1235 | + agent_created_to: typing.Optional[dt.datetime] = OMIT, |
| 1236 | + version_created_from: typing.Optional[dt.datetime] = OMIT, |
| 1237 | + version_created_to: typing.Optional[dt.datetime] = OMIT, |
| 1238 | + limit: typing.Optional[int] = OMIT, |
| 1239 | + cursor: typing.Optional[str] = OMIT, |
| 1240 | + request_options: typing.Optional[RequestOptions] = None, |
| 1241 | + ) -> ExportCopilotsResponse: |
| 1242 | + """ |
| 1243 | + Export copilot configurations for backup or migration purposes. |
| 1244 | +
|
| 1245 | + **IMPORTANT**: This endpoint requires: |
| 1246 | + - Admin privileges |
| 1247 | + - The 'ai-usage-analytics-log.export' scope on the API key |
| 1248 | +
|
| 1249 | + Returns all deployed copilots with their full configuration including model settings, tools, and deployment details. Optional date filters can be applied to narrow down results. |
| 1250 | +
|
| 1251 | + Parameters |
| 1252 | + ---------- |
| 1253 | + agent_created_from : typing.Optional[dt.datetime] |
| 1254 | + Filter copilots created on or after this datetime (ISO 8601 format). |
| 1255 | +
|
| 1256 | + agent_created_to : typing.Optional[dt.datetime] |
| 1257 | + Filter copilots created before or on this datetime (ISO 8601 format). |
| 1258 | +
|
| 1259 | + version_created_from : typing.Optional[dt.datetime] |
| 1260 | + Filter copilot versions created on or after this datetime (ISO 8601 format). |
| 1261 | +
|
| 1262 | + version_created_to : typing.Optional[dt.datetime] |
| 1263 | + Filter copilot versions created before or on this datetime (ISO 8601 format). |
| 1264 | +
|
| 1265 | + limit : typing.Optional[int] |
| 1266 | + Maximum number of copilots to return. Must be a positive integer with a maximum value of 1000. Defaults to 100. |
| 1267 | +
|
| 1268 | + cursor : typing.Optional[str] |
| 1269 | + Cursor for pagination. Use the cursor returned in the previous response to fetch the next page of results. If not provided, returns the first page. |
| 1270 | +
|
| 1271 | + request_options : typing.Optional[RequestOptions] |
| 1272 | + Request-specific configuration. |
| 1273 | +
|
| 1274 | + Returns |
| 1275 | + ------- |
| 1276 | + ExportCopilotsResponse |
| 1277 | +
|
| 1278 | + Examples |
| 1279 | + -------- |
| 1280 | + import asyncio |
| 1281 | + import datetime |
| 1282 | +
|
| 1283 | + from credal import AsyncCredalApi |
| 1284 | +
|
| 1285 | + client = AsyncCredalApi( |
| 1286 | + api_key="YOUR_API_KEY", |
| 1287 | + ) |
| 1288 | +
|
| 1289 | +
|
| 1290 | + async def main() -> None: |
| 1291 | + await client.copilots.export( |
| 1292 | + agent_created_from=datetime.datetime.fromisoformat( |
| 1293 | + "2024-01-01 00:00:00+00:00", |
| 1294 | + ), |
| 1295 | + agent_created_to=datetime.datetime.fromisoformat( |
| 1296 | + "2024-12-31 23:59:59+00:00", |
| 1297 | + ), |
| 1298 | + ) |
| 1299 | +
|
| 1300 | +
|
| 1301 | + asyncio.run(main()) |
| 1302 | + """ |
| 1303 | + _response = await self._raw_client.export( |
| 1304 | + agent_created_from=agent_created_from, |
| 1305 | + agent_created_to=agent_created_to, |
| 1306 | + version_created_from=version_created_from, |
| 1307 | + version_created_to=version_created_to, |
| 1308 | + limit=limit, |
| 1309 | + cursor=cursor, |
| 1310 | + request_options=request_options, |
| 1311 | + ) |
| 1312 | + return _response.data |
0 commit comments