|
23 | 23 | agent_retrieve_usage_params, |
24 | 24 | ) |
25 | 25 | from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given |
26 | | -from ..._utils import maybe_transform, async_maybe_transform |
| 26 | +from ..._utils import path_template, maybe_transform, async_maybe_transform |
27 | 27 | from .api_keys import ( |
28 | 28 | APIKeysResource, |
29 | 29 | AsyncAPIKeysResource, |
@@ -325,9 +325,8 @@ def retrieve( |
325 | 325 | if not uuid: |
326 | 326 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
327 | 327 | return self._get( |
328 | | - f"/v2/gen-ai/agents/{uuid}" |
329 | | - if self._client._base_url_overridden |
330 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}", |
| 328 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 329 | + + path_template("/v2/gen-ai/agents/{uuid}", uuid=uuid), |
331 | 330 | options=make_request_options( |
332 | 331 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
333 | 332 | ), |
@@ -429,9 +428,8 @@ def update( |
429 | 428 | if not path_uuid: |
430 | 429 | raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}") |
431 | 430 | return self._put( |
432 | | - f"/v2/gen-ai/agents/{path_uuid}" |
433 | | - if self._client._base_url_overridden |
434 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{path_uuid}", |
| 431 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 432 | + + path_template("/v2/gen-ai/agents/{path_uuid}", path_uuid=path_uuid), |
435 | 433 | body=maybe_transform( |
436 | 434 | { |
437 | 435 | "agent_log_insights_enabled": agent_log_insights_enabled, |
@@ -540,9 +538,8 @@ def delete( |
540 | 538 | if not uuid: |
541 | 539 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
542 | 540 | return self._delete( |
543 | | - f"/v2/gen-ai/agents/{uuid}" |
544 | | - if self._client._base_url_overridden |
545 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}", |
| 541 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 542 | + + path_template("/v2/gen-ai/agents/{uuid}", uuid=uuid), |
546 | 543 | options=make_request_options( |
547 | 544 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
548 | 545 | ), |
@@ -583,9 +580,8 @@ def retrieve_usage( |
583 | 580 | if not uuid: |
584 | 581 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
585 | 582 | return self._get( |
586 | | - f"/v2/gen-ai/agents/{uuid}/usage" |
587 | | - if self._client._base_url_overridden |
588 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage", |
| 583 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 584 | + + path_template("/v2/gen-ai/agents/{uuid}/usage", uuid=uuid), |
589 | 585 | options=make_request_options( |
590 | 586 | extra_headers=extra_headers, |
591 | 587 | extra_query=extra_query, |
@@ -643,9 +639,8 @@ def update_status( |
643 | 639 | if not path_uuid: |
644 | 640 | raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}") |
645 | 641 | return self._put( |
646 | | - f"/v2/gen-ai/agents/{path_uuid}/deployment_visibility" |
647 | | - if self._client._base_url_overridden |
648 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{path_uuid}/deployment_visibility", |
| 642 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 643 | + + path_template("/v2/gen-ai/agents/{path_uuid}/deployment_visibility", path_uuid=path_uuid), |
649 | 644 | body=maybe_transform( |
650 | 645 | { |
651 | 646 | "body_uuid": body_uuid, |
@@ -953,9 +948,8 @@ async def retrieve( |
953 | 948 | if not uuid: |
954 | 949 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
955 | 950 | return await self._get( |
956 | | - f"/v2/gen-ai/agents/{uuid}" |
957 | | - if self._client._base_url_overridden |
958 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}", |
| 951 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 952 | + + path_template("/v2/gen-ai/agents/{uuid}", uuid=uuid), |
959 | 953 | options=make_request_options( |
960 | 954 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
961 | 955 | ), |
@@ -1057,9 +1051,8 @@ async def update( |
1057 | 1051 | if not path_uuid: |
1058 | 1052 | raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}") |
1059 | 1053 | return await self._put( |
1060 | | - f"/v2/gen-ai/agents/{path_uuid}" |
1061 | | - if self._client._base_url_overridden |
1062 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{path_uuid}", |
| 1054 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 1055 | + + path_template("/v2/gen-ai/agents/{path_uuid}", path_uuid=path_uuid), |
1063 | 1056 | body=await async_maybe_transform( |
1064 | 1057 | { |
1065 | 1058 | "agent_log_insights_enabled": agent_log_insights_enabled, |
@@ -1168,9 +1161,8 @@ async def delete( |
1168 | 1161 | if not uuid: |
1169 | 1162 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
1170 | 1163 | return await self._delete( |
1171 | | - f"/v2/gen-ai/agents/{uuid}" |
1172 | | - if self._client._base_url_overridden |
1173 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}", |
| 1164 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 1165 | + + path_template("/v2/gen-ai/agents/{uuid}", uuid=uuid), |
1174 | 1166 | options=make_request_options( |
1175 | 1167 | extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout |
1176 | 1168 | ), |
@@ -1211,9 +1203,8 @@ async def retrieve_usage( |
1211 | 1203 | if not uuid: |
1212 | 1204 | raise ValueError(f"Expected a non-empty value for `uuid` but received {uuid!r}") |
1213 | 1205 | return await self._get( |
1214 | | - f"/v2/gen-ai/agents/{uuid}/usage" |
1215 | | - if self._client._base_url_overridden |
1216 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{uuid}/usage", |
| 1206 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 1207 | + + path_template("/v2/gen-ai/agents/{uuid}/usage", uuid=uuid), |
1217 | 1208 | options=make_request_options( |
1218 | 1209 | extra_headers=extra_headers, |
1219 | 1210 | extra_query=extra_query, |
@@ -1271,9 +1262,8 @@ async def update_status( |
1271 | 1262 | if not path_uuid: |
1272 | 1263 | raise ValueError(f"Expected a non-empty value for `path_uuid` but received {path_uuid!r}") |
1273 | 1264 | return await self._put( |
1274 | | - f"/v2/gen-ai/agents/{path_uuid}/deployment_visibility" |
1275 | | - if self._client._base_url_overridden |
1276 | | - else f"https://api.digitalocean.com/v2/gen-ai/agents/{path_uuid}/deployment_visibility", |
| 1265 | + ("https://api.digitalocean.com" if not self._client._base_url_overridden else "") |
| 1266 | + + path_template("/v2/gen-ai/agents/{path_uuid}/deployment_visibility", path_uuid=path_uuid), |
1277 | 1267 | body=await async_maybe_transform( |
1278 | 1268 | { |
1279 | 1269 | "body_uuid": body_uuid, |
|
0 commit comments