Skip to content

Commit f21ac18

Browse files
committed
Undo server_url changes for platform
1 parent bb503ba commit f21ac18

File tree

6 files changed

+249
-333
lines changed

6 files changed

+249
-333
lines changed

.genignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,5 @@ _test_unstructured_client
99
# ignore Makefile
1010
Makefile
1111

12-
# Ignore the endpoint files until we can fix the base_url issue
13-
src/unstructured_client/destinations.py
12+
# Ignore the general.partition code until we can fix the base_url issue
1413
src/unstructured_client/general.py
15-
src/unstructured_client/jobs.py
16-
src/unstructured_client/sources.py
17-
src/unstructured_client/workflows.py

_test_unstructured_client/unit/test_server_urls.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,6 @@ def mock_build_request(*args, base_url, **kwargs):
5858
"sdk_endpoint_name",
5959
[
6060
("general.partition"),
61-
("destinations.create_destination"),
62-
("destinations.delete_destination"),
63-
("destinations.get_destination"),
64-
("destinations.list_destinations"),
65-
("destinations.update_destination"),
66-
("jobs.cancel_job"),
67-
("jobs.get_job"),
68-
("jobs.list_jobs"),
69-
("sources.create_source"),
70-
("sources.delete_source"),
71-
("sources.get_source"),
72-
("sources.list_sources"),
73-
("sources.update_source"),
74-
("workflows.create_workflow"),
75-
("workflows.delete_workflow"),
76-
("workflows.get_workflow"),
77-
("workflows.list_workflows"),
78-
("workflows.run_workflow"),
79-
("workflows.update_workflow"),
8061
],
8162
)
8263
def test_endpoint_uses_correct_url(monkeypatch, sdk_endpoint_name):
@@ -174,25 +155,6 @@ def test_endpoint_uses_correct_url(monkeypatch, sdk_endpoint_name):
174155
"sdk_endpoint_name",
175156
[
176157
("general.partition_async"),
177-
("destinations.create_destination_async"),
178-
("destinations.delete_destination_async"),
179-
("destinations.get_destination_async"),
180-
("destinations.list_destinations_async"),
181-
("destinations.update_destination_async"),
182-
("jobs.cancel_job_async"),
183-
("jobs.get_job_async"),
184-
("jobs.list_jobs_async"),
185-
("sources.create_source_async"),
186-
("sources.delete_source_async"),
187-
("sources.get_source_async"),
188-
("sources.list_sources_async"),
189-
("sources.update_source_async"),
190-
("workflows.create_workflow_async"),
191-
("workflows.delete_workflow_async"),
192-
("workflows.get_workflow_async"),
193-
("workflows.list_workflows_async"),
194-
("workflows.run_workflow_async"),
195-
("workflows.update_workflow_async"),
196158
],
197159
)
198160
async def test_async_endpoint_uses_correct_url(monkeypatch, sdk_endpoint_name):

src/unstructured_client/destinations.py

Lines changed: 70 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from typing import Any, List, Mapping, Optional, Union, cast
55
from unstructured_client import utils
66
from unstructured_client._hooks import HookContext
7-
from unstructured_client._hooks.custom.clean_server_url_hook import choose_server_url
87
from unstructured_client.models import errors, operations, shared
98
from unstructured_client.types import BaseModel, OptionalNullable, UNSET
109

@@ -22,7 +21,9 @@ def create_destination(
2221
timeout_ms: Optional[int] = None,
2322
http_headers: Optional[Mapping[str, str]] = None,
2423
) -> operations.CreateDestinationResponse:
25-
r"""Create Destination
24+
r"""Create destination connector
25+
26+
Create a new destination connector using the provided configuration and name.
2627
2728
:param request: The request object to send.
2829
:param retries: Override the default retry configuration for this method
@@ -35,15 +36,12 @@ def create_destination(
3536
if timeout_ms is None:
3637
timeout_ms = self.sdk_configuration.timeout_ms
3738

38-
client_url, *_ = self.sdk_configuration.get_server_details()
39-
40-
base_url = choose_server_url(
41-
endpoint_url=server_url,
42-
client_url=client_url,
43-
default_endpoint_url=operations.CREATE_DESTINATION_SERVERS[
39+
if server_url is not None:
40+
base_url = server_url
41+
else:
42+
base_url = operations.CREATE_DESTINATION_SERVERS[
4443
operations.CREATE_DESTINATION_SERVER_PLATFORM_API
4544
]
46-
)
4745

4846
if not isinstance(request, BaseModel):
4947
request = utils.unmarshal(request, operations.CreateDestinationRequest)
@@ -143,7 +141,9 @@ async def create_destination_async(
143141
timeout_ms: Optional[int] = None,
144142
http_headers: Optional[Mapping[str, str]] = None,
145143
) -> operations.CreateDestinationResponse:
146-
r"""Create Destination
144+
r"""Create destination connector
145+
146+
Create a new destination connector using the provided configuration and name.
147147
148148
:param request: The request object to send.
149149
:param retries: Override the default retry configuration for this method
@@ -156,15 +156,12 @@ async def create_destination_async(
156156
if timeout_ms is None:
157157
timeout_ms = self.sdk_configuration.timeout_ms
158158

159-
client_url, *_ = self.sdk_configuration.get_server_details()
160-
161-
base_url = choose_server_url(
162-
endpoint_url=server_url,
163-
client_url=client_url,
164-
default_endpoint_url=operations.CREATE_DESTINATION_SERVERS[
159+
if server_url is not None:
160+
base_url = server_url
161+
else:
162+
base_url = operations.CREATE_DESTINATION_SERVERS[
165163
operations.CREATE_DESTINATION_SERVER_PLATFORM_API
166164
]
167-
)
168165

169166
if not isinstance(request, BaseModel):
170167
request = utils.unmarshal(request, operations.CreateDestinationRequest)
@@ -264,7 +261,9 @@ def delete_destination(
264261
timeout_ms: Optional[int] = None,
265262
http_headers: Optional[Mapping[str, str]] = None,
266263
) -> operations.DeleteDestinationResponse:
267-
r"""Delete Destination
264+
r"""Delete destination connector
265+
266+
Delete a specific destination connector by its ID.
268267
269268
:param request: The request object to send.
270269
:param retries: Override the default retry configuration for this method
@@ -277,15 +276,12 @@ def delete_destination(
277276
if timeout_ms is None:
278277
timeout_ms = self.sdk_configuration.timeout_ms
279278

280-
client_url, *_ = self.sdk_configuration.get_server_details()
281-
282-
base_url = choose_server_url(
283-
endpoint_url=server_url,
284-
client_url=client_url,
285-
default_endpoint_url=operations.DELETE_DESTINATION_SERVERS[
279+
if server_url is not None:
280+
base_url = server_url
281+
else:
282+
base_url = operations.DELETE_DESTINATION_SERVERS[
286283
operations.DELETE_DESTINATION_SERVER_PLATFORM_API
287284
]
288-
)
289285

290286
if not isinstance(request, BaseModel):
291287
request = utils.unmarshal(request, operations.DeleteDestinationRequest)
@@ -376,7 +372,9 @@ async def delete_destination_async(
376372
timeout_ms: Optional[int] = None,
377373
http_headers: Optional[Mapping[str, str]] = None,
378374
) -> operations.DeleteDestinationResponse:
379-
r"""Delete Destination
375+
r"""Delete destination connector
376+
377+
Delete a specific destination connector by its ID.
380378
381379
:param request: The request object to send.
382380
:param retries: Override the default retry configuration for this method
@@ -389,15 +387,12 @@ async def delete_destination_async(
389387
if timeout_ms is None:
390388
timeout_ms = self.sdk_configuration.timeout_ms
391389

392-
client_url, *_ = self.sdk_configuration.get_server_details()
393-
394-
base_url = choose_server_url(
395-
endpoint_url=server_url,
396-
client_url=client_url,
397-
default_endpoint_url=operations.DELETE_DESTINATION_SERVERS[
390+
if server_url is not None:
391+
base_url = server_url
392+
else:
393+
base_url = operations.DELETE_DESTINATION_SERVERS[
398394
operations.DELETE_DESTINATION_SERVER_PLATFORM_API
399395
]
400-
)
401396

402397
if not isinstance(request, BaseModel):
403398
request = utils.unmarshal(request, operations.DeleteDestinationRequest)
@@ -487,7 +482,9 @@ def get_destination(
487482
timeout_ms: Optional[int] = None,
488483
http_headers: Optional[Mapping[str, str]] = None,
489484
) -> operations.GetDestinationResponse:
490-
r"""Get Destination
485+
r"""Get destination connector
486+
487+
Retrieve detailed information for a specific destination connector by its ID.
491488
492489
:param request: The request object to send.
493490
:param retries: Override the default retry configuration for this method
@@ -500,15 +497,12 @@ def get_destination(
500497
if timeout_ms is None:
501498
timeout_ms = self.sdk_configuration.timeout_ms
502499

503-
client_url, *_ = self.sdk_configuration.get_server_details()
504-
505-
base_url = choose_server_url(
506-
endpoint_url=server_url,
507-
client_url=client_url,
508-
default_endpoint_url=operations.GET_DESTINATION_SERVERS[
500+
if server_url is not None:
501+
base_url = server_url
502+
else:
503+
base_url = operations.GET_DESTINATION_SERVERS[
509504
operations.GET_DESTINATION_SERVER_PLATFORM_API
510505
]
511-
)
512506

513507
if not isinstance(request, BaseModel):
514508
request = utils.unmarshal(request, operations.GetDestinationRequest)
@@ -600,7 +594,9 @@ async def get_destination_async(
600594
timeout_ms: Optional[int] = None,
601595
http_headers: Optional[Mapping[str, str]] = None,
602596
) -> operations.GetDestinationResponse:
603-
r"""Get Destination
597+
r"""Get destination connector
598+
599+
Retrieve detailed information for a specific destination connector by its ID.
604600
605601
:param request: The request object to send.
606602
:param retries: Override the default retry configuration for this method
@@ -613,15 +609,12 @@ async def get_destination_async(
613609
if timeout_ms is None:
614610
timeout_ms = self.sdk_configuration.timeout_ms
615611

616-
client_url, *_ = self.sdk_configuration.get_server_details()
617-
618-
base_url = choose_server_url(
619-
endpoint_url=server_url,
620-
client_url=client_url,
621-
default_endpoint_url=operations.GET_DESTINATION_SERVERS[
612+
if server_url is not None:
613+
base_url = server_url
614+
else:
615+
base_url = operations.GET_DESTINATION_SERVERS[
622616
operations.GET_DESTINATION_SERVER_PLATFORM_API
623617
]
624-
)
625618

626619
if not isinstance(request, BaseModel):
627620
request = utils.unmarshal(request, operations.GetDestinationRequest)
@@ -714,7 +707,9 @@ def list_destinations(
714707
timeout_ms: Optional[int] = None,
715708
http_headers: Optional[Mapping[str, str]] = None,
716709
) -> operations.ListDestinationsResponse:
717-
r"""List Destinations
710+
r"""List destination connectors
711+
712+
Retrieve a list of available destination connectors.
718713
719714
:param request: The request object to send.
720715
:param retries: Override the default retry configuration for this method
@@ -727,15 +722,12 @@ def list_destinations(
727722
if timeout_ms is None:
728723
timeout_ms = self.sdk_configuration.timeout_ms
729724

730-
client_url, *_ = self.sdk_configuration.get_server_details()
731-
732-
base_url = choose_server_url(
733-
endpoint_url=server_url,
734-
client_url=client_url,
735-
default_endpoint_url=operations.LIST_DESTINATIONS_SERVERS[
725+
if server_url is not None:
726+
base_url = server_url
727+
else:
728+
base_url = operations.LIST_DESTINATIONS_SERVERS[
736729
operations.LIST_DESTINATIONS_SERVER_PLATFORM_API
737730
]
738-
)
739731

740732
if not isinstance(request, BaseModel):
741733
request = utils.unmarshal(request, operations.ListDestinationsRequest)
@@ -829,7 +821,9 @@ async def list_destinations_async(
829821
timeout_ms: Optional[int] = None,
830822
http_headers: Optional[Mapping[str, str]] = None,
831823
) -> operations.ListDestinationsResponse:
832-
r"""List Destinations
824+
r"""List destination connectors
825+
826+
Retrieve a list of available destination connectors.
833827
834828
:param request: The request object to send.
835829
:param retries: Override the default retry configuration for this method
@@ -842,15 +836,12 @@ async def list_destinations_async(
842836
if timeout_ms is None:
843837
timeout_ms = self.sdk_configuration.timeout_ms
844838

845-
client_url, *_ = self.sdk_configuration.get_server_details()
846-
847-
base_url = choose_server_url(
848-
endpoint_url=server_url,
849-
client_url=client_url,
850-
default_endpoint_url=operations.LIST_DESTINATIONS_SERVERS[
839+
if server_url is not None:
840+
base_url = server_url
841+
else:
842+
base_url = operations.LIST_DESTINATIONS_SERVERS[
851843
operations.LIST_DESTINATIONS_SERVER_PLATFORM_API
852844
]
853-
)
854845

855846
if not isinstance(request, BaseModel):
856847
request = utils.unmarshal(request, operations.ListDestinationsRequest)
@@ -944,7 +935,9 @@ def update_destination(
944935
timeout_ms: Optional[int] = None,
945936
http_headers: Optional[Mapping[str, str]] = None,
946937
) -> operations.UpdateDestinationResponse:
947-
r"""Update Destination
938+
r"""Update destination connector
939+
940+
Update the configuration of an existing destination connector.
948941
949942
:param request: The request object to send.
950943
:param retries: Override the default retry configuration for this method
@@ -957,15 +950,12 @@ def update_destination(
957950
if timeout_ms is None:
958951
timeout_ms = self.sdk_configuration.timeout_ms
959952

960-
client_url, *_ = self.sdk_configuration.get_server_details()
961-
962-
base_url = choose_server_url(
963-
endpoint_url=server_url,
964-
client_url=client_url,
965-
default_endpoint_url=operations.UPDATE_DESTINATION_SERVERS[
953+
if server_url is not None:
954+
base_url = server_url
955+
else:
956+
base_url = operations.UPDATE_DESTINATION_SERVERS[
966957
operations.UPDATE_DESTINATION_SERVER_PLATFORM_API
967958
]
968-
)
969959

970960
if not isinstance(request, BaseModel):
971961
request = utils.unmarshal(request, operations.UpdateDestinationRequest)
@@ -1065,7 +1055,9 @@ async def update_destination_async(
10651055
timeout_ms: Optional[int] = None,
10661056
http_headers: Optional[Mapping[str, str]] = None,
10671057
) -> operations.UpdateDestinationResponse:
1068-
r"""Update Destination
1058+
r"""Update destination connector
1059+
1060+
Update the configuration of an existing destination connector.
10691061
10701062
:param request: The request object to send.
10711063
:param retries: Override the default retry configuration for this method
@@ -1078,15 +1070,12 @@ async def update_destination_async(
10781070
if timeout_ms is None:
10791071
timeout_ms = self.sdk_configuration.timeout_ms
10801072

1081-
client_url, *_ = self.sdk_configuration.get_server_details()
1082-
1083-
base_url = choose_server_url(
1084-
endpoint_url=server_url,
1085-
client_url=client_url,
1086-
default_endpoint_url=operations.UPDATE_DESTINATION_SERVERS[
1073+
if server_url is not None:
1074+
base_url = server_url
1075+
else:
1076+
base_url = operations.UPDATE_DESTINATION_SERVERS[
10871077
operations.UPDATE_DESTINATION_SERVER_PLATFORM_API
10881078
]
1089-
)
10901079

10911080
if not isinstance(request, BaseModel):
10921081
request = utils.unmarshal(request, operations.UpdateDestinationRequest)

0 commit comments

Comments
 (0)