Skip to content

Commit

Permalink
chore: Move SerializedData class to json module (box/box-codegen#606
Browse files Browse the repository at this point in the history
) (#394)
  • Loading branch information
box-sdk-build authored Dec 2, 2024
1 parent 55a23d9 commit bd7b9f6
Show file tree
Hide file tree
Showing 314 changed files with 917 additions and 322 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "35ca680", "specHash": "544d370", "version": "1.7.0" }
{ "engineHash": "5a3b4bc", "specHash": "544d370", "version": "1.7.0" }
4 changes: 2 additions & 2 deletions box_sdk_gen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from box_sdk_gen.box import *

from box_sdk_gen.serialization import *

from box_sdk_gen.internal import *

from box_sdk_gen.networking import *

from box_sdk_gen.serialization import *

from box_sdk_gen.schemas import *

from box_sdk_gen.managers import *
Expand Down
17 changes: 7 additions & 10 deletions box_sdk_gen/box/errors.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import pprint
from datetime import datetime
from typing import Any, Optional
from typing import Any, Dict, Optional

from typing import Dict
from ..internal.errors import GeneratedCodeError


class BoxSDKError(Exception):
class BoxSDKError(GeneratedCodeError):
def __init__(
self,
message: str,
timestamp: Optional[datetime] = None,
error: Optional[Exception] = None,
name: Optional[str] = 'BoxSDKError',
**kwargs,
):
super().__init__(message)
super().__init__(message, **kwargs)
self.name = 'BoxSDKError'
self.message = message
self.timestamp = timestamp if timestamp is not None else datetime.now()
self.error = error
self.name = name

def __str__(self):
return ''.join(
Expand Down Expand Up @@ -113,12 +112,10 @@ def __init__(
message: str,
timestamp: Optional[datetime] = None,
error: Optional[str] = None,
name: Optional[str] = 'BoxAPIError',
**kwargs,
):
super().__init__(
message=message, timestamp=timestamp, error=error, name=name, **kwargs
)
super().__init__(message=message, timestamp=timestamp, error=error, **kwargs)
self.name = 'BoxAPIError'
self.request_info = request_info
self.response_info = response_info

Expand Down
6 changes: 3 additions & 3 deletions box_sdk_gen/box/jwt_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import Optional

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from typing import List

Expand All @@ -26,9 +26,9 @@

from box_sdk_gen.box.token_storage import InMemoryTokenStorage

from box_sdk_gen.serialization.json.json_data import json_to_serialized_data
from box_sdk_gen.serialization.json import json_to_serialized_data

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData

from box_sdk_gen.internal.utils import get_uuid

Expand Down
6 changes: 3 additions & 3 deletions box_sdk_gen/box/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Dict

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from typing import List

Expand All @@ -26,13 +26,13 @@

from box_sdk_gen.box.token_storage import InMemoryTokenStorage

from box_sdk_gen.serialization.json.json_data import sd_to_url_params
from box_sdk_gen.serialization.json import sd_to_url_params

from box_sdk_gen.internal.utils import prepare_params

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class OAuthConfig:
Expand Down
6 changes: 4 additions & 2 deletions box_sdk_gen/internal/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from box_sdk_gen.internal.utils import *

from box_sdk_gen.internal.errors import *

from box_sdk_gen.internal.base_object import *

from box_sdk_gen.internal.null_value import *

from box_sdk_gen.internal.utils import *
6 changes: 6 additions & 0 deletions box_sdk_gen/internal/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class GeneratedCodeError(Exception):
def __init__(self, message: str, **kwargs):
super().__init__(message)
self.name = 'GeneratedCodeError'
self.message = message
self.extra = kwargs
4 changes: 2 additions & 2 deletions box_sdk_gen/internal/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
jwt, default_backend, serialization = None, None, None

from .base_object import BaseObject
from ..serialization.json.json_data import sd_to_json
from ..serialization.json.serializer import serialize
from ..serialization.json import sd_to_json
from ..serialization.json import serialize
from .null_value import null

ByteStream = BufferedIOBase
Expand Down
10 changes: 6 additions & 4 deletions box_sdk_gen/managers/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from typing import Dict

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.internal.utils import to_string

Expand All @@ -28,6 +28,8 @@

from box_sdk_gen.schemas.ai_ask import AiAsk

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.schemas.ai_response import AiResponse

from box_sdk_gen.schemas.ai_text_gen import AiTextGen
Expand Down Expand Up @@ -62,9 +64,9 @@

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json


class CreateAiAskMode(str, Enum):
Expand Down
8 changes: 5 additions & 3 deletions box_sdk_gen/managers/app_item_associations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.schemas.app_item_associations import AppItemAssociations

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession
Expand All @@ -22,15 +24,15 @@

from box_sdk_gen.internal.utils import ByteStream

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.networking.fetch_options import FetchOptions

from box_sdk_gen.networking.fetch_response import FetchResponse

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class AppItemAssociationsManager:
Expand Down
10 changes: 6 additions & 4 deletions box_sdk_gen/managers/authorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.schemas.post_o_auth_2_token import PostOAuth2TokenGrantTypeField

Expand All @@ -18,6 +18,8 @@

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.schemas.access_token import AccessToken

from box_sdk_gen.schemas.o_auth_2_error import OAuth2Error
Expand All @@ -40,15 +42,15 @@

from box_sdk_gen.internal.utils import ByteStream

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.networking.fetch_options import FetchOptions

from box_sdk_gen.networking.fetch_response import FetchResponse

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class AuthorizeUserResponseType(str, Enum):
Expand Down
8 changes: 5 additions & 3 deletions box_sdk_gen/managers/avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.schemas.user_avatar import UserAvatar

from box_sdk_gen.networking.auth import Authentication
Expand All @@ -28,11 +30,11 @@

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.networking.fetch_options import MultipartItem

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class AvatarsManager:
Expand Down
10 changes: 6 additions & 4 deletions box_sdk_gen/managers/chunked_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

from typing import Dict

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.internal.utils import to_string

Expand All @@ -24,6 +24,8 @@

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.schemas.uploaded_part import UploadedPart

from box_sdk_gen.schemas.upload_parts import UploadParts
Expand All @@ -48,9 +50,9 @@

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.internal.utils import generate_byte_stream_from_buffer

Expand Down
8 changes: 5 additions & 3 deletions box_sdk_gen/managers/classifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@

from typing import List

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

from box_sdk_gen.schemas.classification_template import ClassificationTemplate

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.networking.auth import Authentication

from box_sdk_gen.networking.network import NetworkSession
Expand All @@ -34,7 +36,7 @@

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class AddClassificationRequestBodyOpField(str, Enum):
Expand Down
10 changes: 6 additions & 4 deletions box_sdk_gen/managers/collaboration_allowlist_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from box_sdk_gen.internal.utils import to_string

from box_sdk_gen.serialization.json.serializer import deserialize
from box_sdk_gen.serialization.json import deserialize

from box_sdk_gen.serialization.json.serializer import serialize
from box_sdk_gen.serialization.json import serialize

from box_sdk_gen.networking.fetch_options import ResponseFormat

Expand All @@ -18,6 +18,8 @@

from box_sdk_gen.schemas.client_error import ClientError

from box_sdk_gen.box.errors import BoxSDKError

from box_sdk_gen.schemas.collaboration_allowlist_entry import (
CollaborationAllowlistEntry,
)
Expand All @@ -32,15 +34,15 @@

from box_sdk_gen.internal.utils import ByteStream

from box_sdk_gen.serialization.json.json_data import sd_to_json
from box_sdk_gen.serialization.json import sd_to_json

from box_sdk_gen.networking.fetch_options import FetchOptions

from box_sdk_gen.networking.fetch_response import FetchResponse

from box_sdk_gen.networking.fetch import fetch

from box_sdk_gen.serialization.json.json_data import SerializedData
from box_sdk_gen.serialization.json import SerializedData


class CreateCollaborationWhitelistEntryDirection(str, Enum):
Expand Down
Loading

0 comments on commit bd7b9f6

Please sign in to comment.