Skip to content

Commit cf2b1d5

Browse files
feat!: Change names of unions (box/box-codegen#789) (#939)
1 parent 4442a84 commit cf2b1d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+457
-275
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "1c54d3c", "specHash": "24fbeb9", "version": "0.1.0" }
1+
{ "engineHash": "ef443c1", "specHash": "99e14a6", "version": "0.1.0" }

box_sdk_gen/managers/ai.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
from typing import Dict
1010

11-
from typing import Union
12-
1311
from box_sdk_gen.serialization.json import serialize
1412

1513
from box_sdk_gen.internal.utils import to_string
@@ -22,10 +20,26 @@
2220

2321
from box_sdk_gen.schemas.ai_agent_reference import AiAgentReference
2422

23+
from box_sdk_gen.schemas.ai_agent_ask import AiAgentAsk
24+
25+
from box_sdk_gen.schemas.ai_ask_agent import AiAskAgent
26+
2527
from box_sdk_gen.networking.fetch_options import ResponseFormat
2628

29+
from box_sdk_gen.schemas.ai_agent_text_gen import AiAgentTextGen
30+
31+
from box_sdk_gen.schemas.ai_text_gen_agent import AiTextGenAgent
32+
33+
from box_sdk_gen.schemas.ai_agent_extract import AiAgentExtract
34+
35+
from box_sdk_gen.schemas.ai_agent_extract_structured import AiAgentExtractStructured
36+
2737
from box_sdk_gen.schemas.ai_item_base import AiItemBase
2838

39+
from box_sdk_gen.schemas.ai_extract_agent import AiExtractAgent
40+
41+
from box_sdk_gen.schemas.ai_extract_structured_agent import AiExtractStructuredAgent
42+
2943
from box_sdk_gen.schemas.ai_response_full import AiResponseFull
3044

3145
from box_sdk_gen.schemas.client_error import ClientError
@@ -36,13 +50,7 @@
3650

3751
from box_sdk_gen.schemas.ai_text_gen import AiTextGen
3852

39-
from box_sdk_gen.schemas.ai_agent_ask import AiAgentAsk
40-
41-
from box_sdk_gen.schemas.ai_agent_text_gen import AiAgentTextGen
42-
43-
from box_sdk_gen.schemas.ai_agent_extract import AiAgentExtract
44-
45-
from box_sdk_gen.schemas.ai_agent_extract_structured import AiAgentExtractStructured
53+
from box_sdk_gen.schemas.ai_agent import AiAgent
4654

4755
from box_sdk_gen.schemas.ai_extract import AiExtract
4856

@@ -222,7 +230,7 @@ def create_ai_ask(
222230
*,
223231
dialogue_history: Optional[List[AiDialogueHistory]] = None,
224232
include_citations: Optional[bool] = None,
225-
ai_agent: Optional[Union[AiAgentAsk, AiAgentReference]] = None,
233+
ai_agent: Optional[AiAskAgent] = None,
226234
extra_headers: Optional[Dict[str, Optional[str]]] = None
227235
) -> Optional[AiResponseFull]:
228236
"""
@@ -280,7 +288,7 @@ def create_ai_text_gen(
280288
items: List[CreateAiTextGenItems],
281289
*,
282290
dialogue_history: Optional[List[AiDialogueHistory]] = None,
283-
ai_agent: Optional[Union[AiAgentReference, AiAgentTextGen]] = None,
291+
ai_agent: Optional[AiTextGenAgent] = None,
284292
extra_headers: Optional[Dict[str, Optional[str]]] = None
285293
) -> AiResponse:
286294
"""
@@ -330,7 +338,7 @@ def get_ai_agent_default_config(
330338
language: Optional[str] = None,
331339
model: Optional[str] = None,
332340
extra_headers: Optional[Dict[str, Optional[str]]] = None
333-
) -> Union[AiAgentAsk, AiAgentTextGen, AiAgentExtract, AiAgentExtractStructured]:
341+
) -> AiAgent:
334342
"""
335343
Get the AI agent default config.
336344
:param mode: The mode to filter the agent config to return.
@@ -366,17 +374,14 @@ def get_ai_agent_default_config(
366374
network_session=self.network_session,
367375
)
368376
)
369-
return deserialize(
370-
response.data,
371-
Union[AiAgentAsk, AiAgentTextGen, AiAgentExtract, AiAgentExtractStructured],
372-
)
377+
return deserialize(response.data, AiAgent)
373378

374379
def create_ai_extract(
375380
self,
376381
prompt: str,
377382
items: List[AiItemBase],
378383
*,
379-
ai_agent: Optional[Union[AiAgentReference, AiAgentExtract]] = None,
384+
ai_agent: Optional[AiExtractAgent] = None,
380385
extra_headers: Optional[Dict[str, Optional[str]]] = None
381386
) -> AiResponse:
382387
"""
@@ -420,7 +425,7 @@ def create_ai_extract_structured(
420425
*,
421426
metadata_template: Optional[CreateAiExtractStructuredMetadataTemplate] = None,
422427
fields: Optional[List[CreateAiExtractStructuredFields]] = None,
423-
ai_agent: Optional[Union[AiAgentReference, AiAgentExtractStructured]] = None,
428+
ai_agent: Optional[AiExtractStructuredAgent] = None,
424429
extra_headers: Optional[Dict[str, Optional[str]]] = None
425430
) -> AiExtractStructuredResponse:
426431
"""

box_sdk_gen/managers/file_versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def promote_file_version(
349349
top of the versions history. The file will have the exact same contents
350350
351351
352-
as the older version, with the the same hash digest, `etag`, and
352+
as the older version, with the same hash digest, `etag`, and
353353
354354
355355
name as the original.

box_sdk_gen/managers/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def delete_file_by_id(
485485
the trash.
486486
487487
488-
The the enterprise settings determine whether the item will
488+
The enterprise settings determine whether the item will
489489
490490
491491
be permanently deleted from Box or moved to the trash.

box_sdk_gen/managers/search.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414

1515
from box_sdk_gen.internal.utils import to_string
1616

17-
from typing import Union
18-
1917
from box_sdk_gen.networking.fetch_options import ResponseFormat
2018

19+
from box_sdk_gen.schemas.search_results import SearchResults
20+
21+
from box_sdk_gen.schemas.search_results_with_shared_links import (
22+
SearchResultsWithSharedLinks,
23+
)
24+
2125
from box_sdk_gen.schemas.metadata_query_results import MetadataQueryResults
2226

2327
from box_sdk_gen.schemas.client_error import ClientError
2428

2529
from box_sdk_gen.schemas.metadata_query import MetadataQuery
2630

27-
from box_sdk_gen.schemas.search_results import SearchResults
28-
29-
from box_sdk_gen.schemas.search_results_with_shared_links import (
30-
SearchResultsWithSharedLinks,
31-
)
31+
from box_sdk_gen.schemas.search_results_response import SearchResultsResponse
3232

3333
from box_sdk_gen.schemas.metadata_filter import MetadataFilter
3434

@@ -269,7 +269,7 @@ def search_for_content(
269269
deleted_user_ids: Optional[List[str]] = None,
270270
deleted_at_range: Optional[List[str]] = None,
271271
extra_headers: Optional[Dict[str, Optional[str]]] = None
272-
) -> Union[SearchResults, SearchResultsWithSharedLinks]:
272+
) -> SearchResultsResponse:
273273
"""
274274
Searches for files, folders, web links, and shared files across the
275275
@@ -332,7 +332,7 @@ def search_for_content(
332332
Date ranges are defined as comma separated RFC3339
333333
timestamps.
334334
335-
If the the start date is omitted (`,2014-05-17T13:35:01-07:00`)
335+
If the start date is omitted (`,2014-05-17T13:35:01-07:00`)
336336
anything created before the end date will be returned.
337337
338338
If the end date is omitted (`2014-05-15T13:35:01-07:00,`) the
@@ -500,7 +500,7 @@ def search_for_content(
500500
501501
Date ranges are defined as comma separated RFC3339 timestamps.
502502
503-
If the the start date is omitted (`2014-05-17T13:35:01-07:00`),
503+
If the start date is omitted (`2014-05-17T13:35:01-07:00`),
504504
anything deleted before the end date will be returned.
505505
506506
If the end date is omitted (`2014-05-15T13:35:01-07:00`),
@@ -555,6 +555,4 @@ def search_for_content(
555555
network_session=self.network_session,
556556
)
557557
)
558-
return deserialize(
559-
response.data, Union[SearchResults, SearchResultsWithSharedLinks]
560-
)
558+
return deserialize(response.data, SearchResultsResponse)

box_sdk_gen/managers/skills.py

Lines changed: 13 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
from typing import Optional
44

5-
from typing import Union
6-
75
from box_sdk_gen.internal.base_object import BaseObject
86

97
from typing import List
@@ -16,12 +14,6 @@
1614

1715
from box_sdk_gen.serialization.json import serialize
1816

19-
from box_sdk_gen.networking.fetch_options import ResponseFormat
20-
21-
from box_sdk_gen.schemas.skill_cards_metadata import SkillCardsMetadata
22-
23-
from box_sdk_gen.schemas.client_error import ClientError
24-
2517
from box_sdk_gen.schemas.keyword_skill_card import KeywordSkillCard
2618

2719
from box_sdk_gen.schemas.timeline_skill_card import TimelineSkillCard
@@ -30,6 +22,14 @@
3022

3123
from box_sdk_gen.schemas.status_skill_card import StatusSkillCard
3224

25+
from box_sdk_gen.networking.fetch_options import ResponseFormat
26+
27+
from box_sdk_gen.schemas.skill_cards_metadata import SkillCardsMetadata
28+
29+
from box_sdk_gen.schemas.client_error import ClientError
30+
31+
from box_sdk_gen.schemas.skill_card import SkillCard
32+
3333
from box_sdk_gen.box.errors import BoxSDKError
3434

3535
from box_sdk_gen.networking.auth import Authentication
@@ -61,14 +61,7 @@ def __init__(
6161
*,
6262
op: Optional[UpdateBoxSkillCardsOnFileRequestBodyOpField] = None,
6363
path: Optional[str] = None,
64-
value: Optional[
65-
Union[
66-
KeywordSkillCard,
67-
TimelineSkillCard,
68-
TranscriptSkillCard,
69-
StatusSkillCard,
70-
]
71-
] = None,
64+
value: Optional[SkillCard] = None,
7265
**kwargs
7366
):
7467
"""
@@ -94,24 +87,10 @@ class UpdateAllSkillCardsOnFileStatus(str, Enum):
9487

9588

9689
class UpdateAllSkillCardsOnFileMetadata(BaseObject):
97-
def __init__(
98-
self,
99-
*,
100-
cards: Optional[
101-
List[
102-
Union[
103-
KeywordSkillCard,
104-
TimelineSkillCard,
105-
TranscriptSkillCard,
106-
StatusSkillCard,
107-
]
108-
]
109-
] = None,
110-
**kwargs
111-
):
90+
def __init__(self, *, cards: Optional[List[SkillCard]] = None, **kwargs):
11291
"""
11392
:param cards: A list of Box Skill cards to apply to this file., defaults to None
114-
:type cards: Optional[List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]], optional
93+
:type cards: Optional[List[SkillCard]], optional
11594
"""
11695
super().__init__(**kwargs)
11796
self.cards = cards
@@ -236,14 +215,7 @@ def get_box_skill_cards_on_file(
236215
def create_box_skill_cards_on_file(
237216
self,
238217
file_id: str,
239-
cards: List[
240-
Union[
241-
KeywordSkillCard,
242-
TimelineSkillCard,
243-
TranscriptSkillCard,
244-
StatusSkillCard,
245-
]
246-
],
218+
cards: List[SkillCard],
247219
*,
248220
extra_headers: Optional[Dict[str, Optional[str]]] = None
249221
) -> SkillCardsMetadata:
@@ -259,7 +231,7 @@ def create_box_skill_cards_on_file(
259231
Example: "12345"
260232
:type file_id: str
261233
:param cards: A list of Box Skill cards to apply to this file.
262-
:type cards: List[Union[KeywordSkillCard, TimelineSkillCard, TranscriptSkillCard, StatusSkillCard]]
234+
:type cards: List[SkillCard]
263235
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
264236
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
265237
"""

box_sdk_gen/managers/tasks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def create_task(
174174
is considered completed.
175175
176176
* `all_assignees` (default) requires all assignees to review or
177-
approve the the task in order for it to be considered completed.
177+
approve the task in order for it to be considered completed.
178178
* `any_assignee` accepts any one assignee to review or
179-
approve the the task in order for it to be considered completed., defaults to None
179+
approve the task in order for it to be considered completed., defaults to None
180180
:type completion_rule: Optional[CreateTaskCompletionRule], optional
181181
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
182182
:type extra_headers: Optional[Dict[str, Optional[str]]], optional
@@ -269,9 +269,9 @@ def update_task_by_id(
269269
is considered completed.
270270
271271
* `all_assignees` (default) requires all assignees to review or
272-
approve the the task in order for it to be considered completed.
272+
approve the task in order for it to be considered completed.
273273
* `any_assignee` accepts any one assignee to review or
274-
approve the the task in order for it to be considered completed., defaults to None
274+
approve the task in order for it to be considered completed., defaults to None
275275
:type completion_rule: Optional[UpdateTaskByIdCompletionRule], optional
276276
:param extra_headers: Extra headers that will be included in the HTTP request., defaults to None
277277
:type extra_headers: Optional[Dict[str, Optional[str]]], optional

box_sdk_gen/managers/user_collaborations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def create_collaboration(
369369
:param is_access_only: If set to `true`, collaborators have access to
370370
shared items, but such items won't be visible in the
371371
All Files list. Additionally, collaborators won't
372-
see the the path to the root folder for the
372+
see the path to the root folder for the
373373
shared item., defaults to None
374374
:type is_access_only: Optional[bool], optional
375375
:param can_view_path: Determines if the invited users can see the entire parent path to

0 commit comments

Comments
 (0)