Skip to content

Commit e8f93ce

Browse files
fix: Correct retention_length type hint to accept both integer and string (box/box-codegen#932) (#1382)
1 parent 29edee4 commit e8f93ce

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "8a22201", "specHash": "f8e0d99", "version": "10.6.0" }
1+
{ "engineHash": "37c0986", "specHash": "f8e0d99", "version": "10.6.0" }

box_sdk_gen/managers/retention_policies.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
from box_sdk_gen.serialization.json import deserialize
1212

13+
from typing import Union
14+
1315
from box_sdk_gen.serialization.json import serialize
1416

1517
from box_sdk_gen.internal.null_value import NullValue
1618

17-
from typing import Union
18-
1919
from box_sdk_gen.networking.fetch_options import ResponseFormat
2020

2121
from box_sdk_gen.schemas.retention_policies import RetentionPolicies
@@ -154,7 +154,7 @@ def create_retention_policy(
154154
disposition_action: CreateRetentionPolicyDispositionAction,
155155
*,
156156
description: Optional[str] = None,
157-
retention_length: Optional[str] = None,
157+
retention_length: Optional[Union[str, int]] = None,
158158
retention_type: Optional[CreateRetentionPolicyRetentionType] = None,
159159
can_owner_extend_retention: Optional[bool] = None,
160160
are_owners_notified: Optional[bool] = None,
@@ -186,7 +186,7 @@ def create_retention_policy(
186186
content. If the policy has a `policy_type` of
187187
`indefinite`, the `retention_length` will also be
188188
`indefinite`., defaults to None
189-
:type retention_length: Optional[str], optional
189+
:type retention_length: Optional[Union[str, int]], optional
190190
:param retention_type: Specifies the retention type:
191191
192192
* `modifiable`: You can modify the retention policy. For example,
@@ -301,7 +301,7 @@ def update_retention_policy_by_id(
301301
description: Union[Optional[str], NullValue] = None,
302302
disposition_action: Optional[str] = None,
303303
retention_type: Union[Optional[str], NullValue] = None,
304-
retention_length: Optional[str] = None,
304+
retention_length: Optional[Union[str, int]] = None,
305305
status: Union[Optional[str], NullValue] = None,
306306
can_owner_extend_retention: Union[Optional[bool], NullValue] = None,
307307
are_owners_notified: Union[Optional[bool], NullValue] = None,
@@ -354,7 +354,7 @@ def update_retention_policy_by_id(
354354
content. If the policy has a `policy_type` of
355355
`indefinite`, the `retention_length` will also be
356356
`indefinite`., defaults to None
357-
:type retention_length: Optional[str], optional
357+
:type retention_length: Optional[Union[str, int]], optional
358358
:param status: Used to retire a retention policy.
359359
360360
If not retiring a policy, do not include this parameter

docs/retention_policies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ client.retention_policies.create_retention_policy(
7878
- The type of the retention policy. A retention policy type can either be `finite`, where a specific amount of time to retain the content is known upfront, or `indefinite`, where the amount of time to retain the content is still unknown.
7979
- disposition_action `CreateRetentionPolicyDispositionAction`
8080
- The disposition action of the retention policy. `permanently_delete` deletes the content retained by the policy permanently. `remove_retention` lifts retention policy from the content, allowing it to be deleted by users once the retention policy has expired.
81-
- retention_length `Optional[str]`
81+
- retention_length `Optional[Union[str, int]]`
8282
- The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`.
8383
- retention_type `Optional[CreateRetentionPolicyRetentionType]`
8484
- Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non_modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies.
@@ -156,7 +156,7 @@ client.retention_policies.update_retention_policy_by_id(
156156
- The disposition action of the retention policy. This action can be `permanently_delete`, which will cause the content retained by the policy to be permanently deleted, or `remove_retention`, which will lift the retention policy from the content, allowing it to be deleted by users, once the retention policy has expired. You can use `null` if you don't want to change `disposition_action`.
157157
- retention_type `Optional[str]`
158158
- Specifies the retention type: _ `modifiable`: You can modify the retention policy. For example, you can add or remove folders, shorten or lengthen the policy duration, or delete the assignment. Use this type if your retention policy is not related to any regulatory purposes. _ `non-modifiable`: You can modify the retention policy only in a limited way: add a folder, lengthen the duration, retire the policy, change the disposition action or notification settings. You cannot perform other actions, such as deleting the assignment or shortening the policy duration. Use this type to ensure compliance with regulatory retention policies. When updating a retention policy, you can use `non-modifiable` type only. You can convert a `modifiable` policy to `non-modifiable`, but not the other way around.
159-
- retention_length `Optional[str]`
159+
- retention_length `Optional[Union[str, int]]`
160160
- The length of the retention policy. This value specifies the duration in days that the retention policy will be active for after being assigned to content. If the policy has a `policy_type` of `indefinite`, the `retention_length` will also be `indefinite`.
161161
- status `Optional[str]`
162162
- Used to retire a retention policy. If not retiring a policy, do not include this parameter or set it to `null`.

0 commit comments

Comments
 (0)