moovio_sdk 0.13.24__py3-none-any.whl → 0.14.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,10 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
+ from .mooverror import MoovError
3
4
  from typing import TYPE_CHECKING
4
5
  from importlib import import_module
5
6
  import builtins
7
+ import sys
6
8
 
7
9
  if TYPE_CHECKING:
8
10
  from .accountterminalapplicationerror import (
@@ -29,6 +31,7 @@ if TYPE_CHECKING:
29
31
  CreateSweepConfigErrorData,
30
32
  )
31
33
  from .createticketerror import CreateTicketError, CreateTicketErrorData
34
+ from .createwalleterror import CreateWalletError, CreateWalletErrorData
32
35
  from .feeplanagreementerror import FeePlanAgreementError, FeePlanAgreementErrorData
33
36
  from .fileuploadvalidationerror import (
34
37
  File,
@@ -44,11 +47,11 @@ if TYPE_CHECKING:
44
47
  MicroDepositValidationError,
45
48
  MicroDepositValidationErrorData,
46
49
  )
47
- from .mooverror import MoovError
48
50
  from .no_response_error import NoResponseError
49
51
  from .onboardinginviteerror import OnboardingInviteError, OnboardingInviteErrorData
50
52
  from .patchaccounterror import PatchAccountError, PatchAccountErrorData
51
53
  from .patchsweepconfigerror import PatchSweepConfigError, PatchSweepConfigErrorData
54
+ from .patchwalleterror import PatchWalletError, PatchWalletErrorData
52
55
  from .refundvalidationerror import RefundValidationError, RefundValidationErrorData
53
56
  from .representativevalidationerror import (
54
57
  Error,
@@ -125,6 +128,8 @@ __all__ = [
125
128
  "CreateSweepConfigErrorData",
126
129
  "CreateTicketError",
127
130
  "CreateTicketErrorData",
131
+ "CreateWalletError",
132
+ "CreateWalletErrorData",
128
133
  "Error",
129
134
  "ErrorTypedDict",
130
135
  "FeePlanAgreementError",
@@ -151,6 +156,8 @@ __all__ = [
151
156
  "PatchAccountErrorData",
152
157
  "PatchSweepConfigError",
153
158
  "PatchSweepConfigErrorData",
159
+ "PatchWalletError",
160
+ "PatchWalletErrorData",
154
161
  "RefundValidationError",
155
162
  "RefundValidationErrorData",
156
163
  "RepresentativeValidationError",
@@ -212,6 +219,8 @@ _dynamic_imports: dict[str, str] = {
212
219
  "CreateSweepConfigErrorData": ".createsweepconfigerror",
213
220
  "CreateTicketError": ".createticketerror",
214
221
  "CreateTicketErrorData": ".createticketerror",
222
+ "CreateWalletError": ".createwalleterror",
223
+ "CreateWalletErrorData": ".createwalleterror",
215
224
  "FeePlanAgreementError": ".feeplanagreementerror",
216
225
  "FeePlanAgreementErrorData": ".feeplanagreementerror",
217
226
  "File": ".fileuploadvalidationerror",
@@ -228,7 +237,6 @@ _dynamic_imports: dict[str, str] = {
228
237
  "LinkCardErrorData": ".linkcarderror",
229
238
  "MicroDepositValidationError": ".microdepositvalidationerror",
230
239
  "MicroDepositValidationErrorData": ".microdepositvalidationerror",
231
- "MoovError": ".mooverror",
232
240
  "NoResponseError": ".no_response_error",
233
241
  "OnboardingInviteError": ".onboardinginviteerror",
234
242
  "OnboardingInviteErrorData": ".onboardinginviteerror",
@@ -236,6 +244,8 @@ _dynamic_imports: dict[str, str] = {
236
244
  "PatchAccountErrorData": ".patchaccounterror",
237
245
  "PatchSweepConfigError": ".patchsweepconfigerror",
238
246
  "PatchSweepConfigErrorData": ".patchsweepconfigerror",
247
+ "PatchWalletError": ".patchwalleterror",
248
+ "PatchWalletErrorData": ".patchwalleterror",
239
249
  "RefundValidationError": ".refundvalidationerror",
240
250
  "RefundValidationErrorData": ".refundvalidationerror",
241
251
  "Error": ".representativevalidationerror",
@@ -276,6 +286,18 @@ _dynamic_imports: dict[str, str] = {
276
286
  }
277
287
 
278
288
 
289
+ def dynamic_import(modname, retries=3):
290
+ for attempt in range(retries):
291
+ try:
292
+ return import_module(modname, __package__)
293
+ except KeyError:
294
+ # Clear any half-initialized module and retry
295
+ sys.modules.pop(modname, None)
296
+ if attempt == retries - 1:
297
+ break
298
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
299
+
300
+
279
301
  def __getattr__(attr_name: str) -> object:
280
302
  module_name = _dynamic_imports.get(attr_name)
281
303
  if module_name is None:
@@ -284,7 +306,7 @@ def __getattr__(attr_name: str) -> object:
284
306
  )
285
307
 
286
308
  try:
287
- module = import_module(module_name, __package__)
309
+ module = dynamic_import(module_name)
288
310
  result = getattr(module, attr_name)
289
311
  return result
290
312
  except ImportError as e:
@@ -0,0 +1,29 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ import httpx
5
+ from moovio_sdk.models.errors import MoovError
6
+ from moovio_sdk.types import BaseModel
7
+ from typing import Optional
8
+
9
+
10
+ class CreateWalletErrorData(BaseModel):
11
+ name: Optional[str] = None
12
+
13
+ description: Optional[str] = None
14
+
15
+ metadata: Optional[str] = None
16
+
17
+
18
+ class CreateWalletError(MoovError):
19
+ data: CreateWalletErrorData
20
+
21
+ def __init__(
22
+ self,
23
+ data: CreateWalletErrorData,
24
+ raw_response: httpx.Response,
25
+ body: Optional[str] = None,
26
+ ):
27
+ message = body or raw_response.text
28
+ super().__init__(message, raw_response, body)
29
+ self.data = data
@@ -0,0 +1,31 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ import httpx
5
+ from moovio_sdk.models.errors import MoovError
6
+ from moovio_sdk.types import BaseModel
7
+ from typing import Optional
8
+
9
+
10
+ class PatchWalletErrorData(BaseModel):
11
+ name: Optional[str] = None
12
+
13
+ status: Optional[str] = None
14
+
15
+ description: Optional[str] = None
16
+
17
+ metadata: Optional[str] = None
18
+
19
+
20
+ class PatchWalletError(MoovError):
21
+ data: PatchWalletErrorData
22
+
23
+ def __init__(
24
+ self,
25
+ data: PatchWalletErrorData,
26
+ raw_response: httpx.Response,
27
+ body: Optional[str] = None,
28
+ ):
29
+ message = body or raw_response.text
30
+ super().__init__(message, raw_response, body)
31
+ self.data = data
@@ -3,6 +3,7 @@
3
3
  from typing import TYPE_CHECKING
4
4
  from importlib import import_module
5
5
  import builtins
6
+ import sys
6
7
 
7
8
  if TYPE_CHECKING:
8
9
  from .globals import Globals, GlobalsTypedDict
@@ -15,6 +16,18 @@ _dynamic_imports: dict[str, str] = {
15
16
  }
16
17
 
17
18
 
19
+ def dynamic_import(modname, retries=3):
20
+ for attempt in range(retries):
21
+ try:
22
+ return import_module(modname, __package__)
23
+ except KeyError:
24
+ # Clear any half-initialized module and retry
25
+ sys.modules.pop(modname, None)
26
+ if attempt == retries - 1:
27
+ break
28
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
29
+
30
+
18
31
  def __getattr__(attr_name: str) -> object:
19
32
  module_name = _dynamic_imports.get(attr_name)
20
33
  if module_name is None:
@@ -23,7 +36,7 @@ def __getattr__(attr_name: str) -> object:
23
36
  )
24
37
 
25
38
  try:
26
- module = import_module(module_name, __package__)
39
+ module = dynamic_import(module_name)
27
40
  result = getattr(module, attr_name)
28
41
  return result
29
42
  except ImportError as e:
@@ -3,6 +3,7 @@
3
3
  from typing import TYPE_CHECKING
4
4
  from importlib import import_module
5
5
  import builtins
6
+ import sys
6
7
 
7
8
  if TYPE_CHECKING:
8
9
  from .acceptdispute import (
@@ -181,6 +182,14 @@ if TYPE_CHECKING:
181
182
  CreateTransferOptionsResponse,
182
183
  CreateTransferOptionsResponseTypedDict,
183
184
  )
185
+ from .createwallet import (
186
+ CreateWalletGlobals,
187
+ CreateWalletGlobalsTypedDict,
188
+ CreateWalletRequest,
189
+ CreateWalletRequestTypedDict,
190
+ CreateWalletResponse,
191
+ CreateWalletResponseTypedDict,
192
+ )
184
193
  from .deletedisputeevidencefile import (
185
194
  DeleteDisputeEvidenceFileGlobals,
186
195
  DeleteDisputeEvidenceFileGlobalsTypedDict,
@@ -1106,6 +1115,14 @@ if TYPE_CHECKING:
1106
1115
  UpdateTransferResponse,
1107
1116
  UpdateTransferResponseTypedDict,
1108
1117
  )
1118
+ from .updatewallet import (
1119
+ UpdateWalletGlobals,
1120
+ UpdateWalletGlobalsTypedDict,
1121
+ UpdateWalletRequest,
1122
+ UpdateWalletRequestTypedDict,
1123
+ UpdateWalletResponse,
1124
+ UpdateWalletResponseTypedDict,
1125
+ )
1109
1126
  from .uploaddisputeevidencefile import (
1110
1127
  UploadDisputeEvidenceFileGlobals,
1111
1128
  UploadDisputeEvidenceFileGlobalsTypedDict,
@@ -1278,6 +1295,12 @@ __all__ = [
1278
1295
  "CreateTransferResponseResult",
1279
1296
  "CreateTransferResponseResultTypedDict",
1280
1297
  "CreateTransferResponseTypedDict",
1298
+ "CreateWalletGlobals",
1299
+ "CreateWalletGlobalsTypedDict",
1300
+ "CreateWalletRequest",
1301
+ "CreateWalletRequestTypedDict",
1302
+ "CreateWalletResponse",
1303
+ "CreateWalletResponseTypedDict",
1281
1304
  "DeleteDisputeEvidenceFileGlobals",
1282
1305
  "DeleteDisputeEvidenceFileGlobalsTypedDict",
1283
1306
  "DeleteDisputeEvidenceFileRequest",
@@ -1973,6 +1996,12 @@ __all__ = [
1973
1996
  "UpdateTransferRequestTypedDict",
1974
1997
  "UpdateTransferResponse",
1975
1998
  "UpdateTransferResponseTypedDict",
1999
+ "UpdateWalletGlobals",
2000
+ "UpdateWalletGlobalsTypedDict",
2001
+ "UpdateWalletRequest",
2002
+ "UpdateWalletRequestTypedDict",
2003
+ "UpdateWalletResponse",
2004
+ "UpdateWalletResponseTypedDict",
1976
2005
  "UploadDisputeEvidenceFileGlobals",
1977
2006
  "UploadDisputeEvidenceFileGlobalsTypedDict",
1978
2007
  "UploadDisputeEvidenceFileRequest",
@@ -2136,6 +2165,12 @@ _dynamic_imports: dict[str, str] = {
2136
2165
  "CreateTransferOptionsRequestTypedDict": ".createtransferoptions",
2137
2166
  "CreateTransferOptionsResponse": ".createtransferoptions",
2138
2167
  "CreateTransferOptionsResponseTypedDict": ".createtransferoptions",
2168
+ "CreateWalletGlobals": ".createwallet",
2169
+ "CreateWalletGlobalsTypedDict": ".createwallet",
2170
+ "CreateWalletRequest": ".createwallet",
2171
+ "CreateWalletRequestTypedDict": ".createwallet",
2172
+ "CreateWalletResponse": ".createwallet",
2173
+ "CreateWalletResponseTypedDict": ".createwallet",
2139
2174
  "DeleteDisputeEvidenceFileGlobals": ".deletedisputeevidencefile",
2140
2175
  "DeleteDisputeEvidenceFileGlobalsTypedDict": ".deletedisputeevidencefile",
2141
2176
  "DeleteDisputeEvidenceFileRequest": ".deletedisputeevidencefile",
@@ -2831,6 +2866,12 @@ _dynamic_imports: dict[str, str] = {
2831
2866
  "UpdateTransferRequestTypedDict": ".updatetransfer",
2832
2867
  "UpdateTransferResponse": ".updatetransfer",
2833
2868
  "UpdateTransferResponseTypedDict": ".updatetransfer",
2869
+ "UpdateWalletGlobals": ".updatewallet",
2870
+ "UpdateWalletGlobalsTypedDict": ".updatewallet",
2871
+ "UpdateWalletRequest": ".updatewallet",
2872
+ "UpdateWalletRequestTypedDict": ".updatewallet",
2873
+ "UpdateWalletResponse": ".updatewallet",
2874
+ "UpdateWalletResponseTypedDict": ".updatewallet",
2834
2875
  "UploadDisputeEvidenceFileGlobals": ".uploaddisputeevidencefile",
2835
2876
  "UploadDisputeEvidenceFileGlobalsTypedDict": ".uploaddisputeevidencefile",
2836
2877
  "UploadDisputeEvidenceFileRequest": ".uploaddisputeevidencefile",
@@ -2864,6 +2905,18 @@ _dynamic_imports: dict[str, str] = {
2864
2905
  }
2865
2906
 
2866
2907
 
2908
+ def dynamic_import(modname, retries=3):
2909
+ for attempt in range(retries):
2910
+ try:
2911
+ return import_module(modname, __package__)
2912
+ except KeyError:
2913
+ # Clear any half-initialized module and retry
2914
+ sys.modules.pop(modname, None)
2915
+ if attempt == retries - 1:
2916
+ break
2917
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
2918
+
2919
+
2867
2920
  def __getattr__(attr_name: str) -> object:
2868
2921
  module_name = _dynamic_imports.get(attr_name)
2869
2922
  if module_name is None:
@@ -2872,7 +2925,7 @@ def __getattr__(attr_name: str) -> object:
2872
2925
  )
2873
2926
 
2874
2927
  try:
2875
- module = import_module(module_name, __package__)
2928
+ module = dynamic_import(module_name)
2876
2929
  result = getattr(module, attr_name)
2877
2930
  return result
2878
2931
  except ImportError as e:
@@ -0,0 +1,80 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from moovio_sdk.models.components import (
5
+ createwallet as components_createwallet,
6
+ wallet as components_wallet,
7
+ )
8
+ from moovio_sdk.types import BaseModel
9
+ from moovio_sdk.utils import (
10
+ FieldMetadata,
11
+ HeaderMetadata,
12
+ PathParamMetadata,
13
+ RequestMetadata,
14
+ )
15
+ import pydantic
16
+ from typing import Dict, List, Optional
17
+ from typing_extensions import Annotated, NotRequired, TypedDict
18
+
19
+
20
+ class CreateWalletGlobalsTypedDict(TypedDict):
21
+ x_moov_version: NotRequired[str]
22
+ r"""Specify an API version.
23
+
24
+ API versioning follows the format `vYYYY.QQ.BB`, where
25
+ - `YYYY` is the year
26
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
27
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
28
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
29
+
30
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
31
+ """
32
+
33
+
34
+ class CreateWalletGlobals(BaseModel):
35
+ x_moov_version: Annotated[
36
+ Optional[str],
37
+ pydantic.Field(alias="x-moov-version"),
38
+ FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
39
+ ] = "v2024.01.00"
40
+ r"""Specify an API version.
41
+
42
+ API versioning follows the format `vYYYY.QQ.BB`, where
43
+ - `YYYY` is the year
44
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
45
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
46
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
47
+
48
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
49
+ """
50
+
51
+
52
+ class CreateWalletRequestTypedDict(TypedDict):
53
+ account_id: str
54
+ r"""The Moov account ID the wallet belongs to."""
55
+ create_wallet: components_createwallet.CreateWalletTypedDict
56
+
57
+
58
+ class CreateWalletRequest(BaseModel):
59
+ account_id: Annotated[
60
+ str,
61
+ pydantic.Field(alias="accountID"),
62
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
63
+ ]
64
+ r"""The Moov account ID the wallet belongs to."""
65
+
66
+ create_wallet: Annotated[
67
+ components_createwallet.CreateWallet,
68
+ FieldMetadata(request=RequestMetadata(media_type="application/json")),
69
+ ]
70
+
71
+
72
+ class CreateWalletResponseTypedDict(TypedDict):
73
+ headers: Dict[str, List[str]]
74
+ result: components_wallet.WalletTypedDict
75
+
76
+
77
+ class CreateWalletResponse(BaseModel):
78
+ headers: Dict[str, List[str]]
79
+
80
+ result: components_wallet.Wallet
@@ -3,9 +3,9 @@
3
3
  from __future__ import annotations
4
4
  from moovio_sdk.models.components import (
5
5
  account as components_account,
6
- accounttype as components_accounttype,
7
6
  capabilityid as components_capabilityid,
8
7
  capabilitystatus as components_capabilitystatus,
8
+ createaccounttype as components_createaccounttype,
9
9
  )
10
10
  from moovio_sdk.types import BaseModel
11
11
  from moovio_sdk.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
@@ -62,17 +62,14 @@ class ListAccountsRequestTypedDict(TypedDict):
62
62
 
63
63
  Provide the full email address to filter by email.
64
64
  """
65
- type: NotRequired[components_accounttype.AccountType]
65
+ type: NotRequired[components_createaccounttype.CreateAccountType]
66
66
  r"""Filter connected accounts by AccountType.
67
67
 
68
68
  If the `type` parameter is used in combination with `name`, only the corresponding type's name fields will
69
69
  be searched. For example, if `type=business` and `name=moov`, the search will attempt to find matches against
70
70
  the display name and Business Profile name fields (`legalBusinessName`, and `doingBusinessAs`).
71
- """
72
- include_guest: NotRequired[bool]
73
- r"""Filter accounts with AccountType guest.
74
71
 
75
- If true, the response will include guest accounts.
72
+ Filtering by `type=guest` is not currently supported.
76
73
  """
77
74
  foreign_id: NotRequired[str]
78
75
  r"""Serves as an optional alias from a foreign/external system which can be used to reference this resource."""
@@ -114,7 +111,7 @@ class ListAccountsRequest(BaseModel):
114
111
  """
115
112
 
116
113
  type: Annotated[
117
- Optional[components_accounttype.AccountType],
114
+ Optional[components_createaccounttype.CreateAccountType],
118
115
  FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
119
116
  ] = None
120
117
  r"""Filter connected accounts by AccountType.
@@ -122,16 +119,8 @@ class ListAccountsRequest(BaseModel):
122
119
  If the `type` parameter is used in combination with `name`, only the corresponding type's name fields will
123
120
  be searched. For example, if `type=business` and `name=moov`, the search will attempt to find matches against
124
121
  the display name and Business Profile name fields (`legalBusinessName`, and `doingBusinessAs`).
125
- """
126
-
127
- include_guest: Annotated[
128
- Optional[bool],
129
- pydantic.Field(alias="includeGuest"),
130
- FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
131
- ] = None
132
- r"""Filter accounts with AccountType guest.
133
122
 
134
- If true, the response will include guest accounts.
123
+ Filtering by `type=guest` is not currently supported.
135
124
  """
136
125
 
137
126
  foreign_id: Annotated[
@@ -1,9 +1,18 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from moovio_sdk.models.components import wallet as components_wallet
4
+ from moovio_sdk.models.components import (
5
+ wallet as components_wallet,
6
+ walletstatus as components_walletstatus,
7
+ wallettype as components_wallettype,
8
+ )
5
9
  from moovio_sdk.types import BaseModel
6
- from moovio_sdk.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
10
+ from moovio_sdk.utils import (
11
+ FieldMetadata,
12
+ HeaderMetadata,
13
+ PathParamMetadata,
14
+ QueryParamMetadata,
15
+ )
7
16
  import pydantic
8
17
  from typing import Dict, List, Optional
9
18
  from typing_extensions import Annotated, NotRequired, TypedDict
@@ -43,6 +52,12 @@ class ListWalletsGlobals(BaseModel):
43
52
 
44
53
  class ListWalletsRequestTypedDict(TypedDict):
45
54
  account_id: str
55
+ status: NotRequired[components_walletstatus.WalletStatus]
56
+ r"""Optional parameter for filtering wallets by status."""
57
+ wallet_type: NotRequired[components_wallettype.WalletType]
58
+ r"""Optional parameter for filtering wallets by type."""
59
+ skip: NotRequired[int]
60
+ count: NotRequired[int]
46
61
 
47
62
 
48
63
  class ListWalletsRequest(BaseModel):
@@ -52,6 +67,29 @@ class ListWalletsRequest(BaseModel):
52
67
  FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
53
68
  ]
54
69
 
70
+ status: Annotated[
71
+ Optional[components_walletstatus.WalletStatus],
72
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
73
+ ] = None
74
+ r"""Optional parameter for filtering wallets by status."""
75
+
76
+ wallet_type: Annotated[
77
+ Optional[components_wallettype.WalletType],
78
+ pydantic.Field(alias="walletType"),
79
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
80
+ ] = None
81
+ r"""Optional parameter for filtering wallets by type."""
82
+
83
+ skip: Annotated[
84
+ Optional[int],
85
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
86
+ ] = None
87
+
88
+ count: Annotated[
89
+ Optional[int],
90
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
91
+ ] = None
92
+
55
93
 
56
94
  class ListWalletsResponseTypedDict(TypedDict):
57
95
  headers: Dict[str, List[str]]
@@ -0,0 +1,89 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from moovio_sdk.models.components import (
5
+ patchwallet as components_patchwallet,
6
+ wallet as components_wallet,
7
+ )
8
+ from moovio_sdk.types import BaseModel
9
+ from moovio_sdk.utils import (
10
+ FieldMetadata,
11
+ HeaderMetadata,
12
+ PathParamMetadata,
13
+ RequestMetadata,
14
+ )
15
+ import pydantic
16
+ from typing import Dict, List, Optional
17
+ from typing_extensions import Annotated, NotRequired, TypedDict
18
+
19
+
20
+ class UpdateWalletGlobalsTypedDict(TypedDict):
21
+ x_moov_version: NotRequired[str]
22
+ r"""Specify an API version.
23
+
24
+ API versioning follows the format `vYYYY.QQ.BB`, where
25
+ - `YYYY` is the year
26
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
27
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
28
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
29
+
30
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
31
+ """
32
+
33
+
34
+ class UpdateWalletGlobals(BaseModel):
35
+ x_moov_version: Annotated[
36
+ Optional[str],
37
+ pydantic.Field(alias="x-moov-version"),
38
+ FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
39
+ ] = "v2024.01.00"
40
+ r"""Specify an API version.
41
+
42
+ API versioning follows the format `vYYYY.QQ.BB`, where
43
+ - `YYYY` is the year
44
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
45
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
46
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
47
+
48
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
49
+ """
50
+
51
+
52
+ class UpdateWalletRequestTypedDict(TypedDict):
53
+ wallet_id: str
54
+ r"""Identifier for the wallet."""
55
+ account_id: str
56
+ r"""The Moov account ID the wallet belongs to."""
57
+ patch_wallet: components_patchwallet.PatchWalletTypedDict
58
+
59
+
60
+ class UpdateWalletRequest(BaseModel):
61
+ wallet_id: Annotated[
62
+ str,
63
+ pydantic.Field(alias="walletID"),
64
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
65
+ ]
66
+ r"""Identifier for the wallet."""
67
+
68
+ account_id: Annotated[
69
+ str,
70
+ pydantic.Field(alias="accountID"),
71
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
72
+ ]
73
+ r"""The Moov account ID the wallet belongs to."""
74
+
75
+ patch_wallet: Annotated[
76
+ components_patchwallet.PatchWallet,
77
+ FieldMetadata(request=RequestMetadata(media_type="application/json")),
78
+ ]
79
+
80
+
81
+ class UpdateWalletResponseTypedDict(TypedDict):
82
+ headers: Dict[str, List[str]]
83
+ result: components_wallet.WalletTypedDict
84
+
85
+
86
+ class UpdateWalletResponse(BaseModel):
87
+ headers: Dict[str, List[str]]
88
+
89
+ result: components_wallet.Wallet
moovio_sdk/sdk.py CHANGED
@@ -11,6 +11,7 @@ from moovio_sdk import utils
11
11
  from moovio_sdk._hooks import SDKHooks
12
12
  from moovio_sdk.models import components, internal
13
13
  from moovio_sdk.types import OptionalNullable, UNSET
14
+ import sys
14
15
  from typing import Callable, Dict, Optional, TYPE_CHECKING, Union, cast
15
16
  import weakref
16
17
 
@@ -214,6 +215,7 @@ class Moov(BaseSDK):
214
215
  timeout_ms=timeout_ms,
215
216
  debug_logger=debug_logger,
216
217
  ),
218
+ parent_ref=self,
217
219
  )
218
220
 
219
221
  hooks = SDKHooks()
@@ -238,13 +240,24 @@ class Moov(BaseSDK):
238
240
  self.sdk_configuration.async_client_supplied,
239
241
  )
240
242
 
243
+ def dynamic_import(self, modname, retries=3):
244
+ for attempt in range(retries):
245
+ try:
246
+ return importlib.import_module(modname)
247
+ except KeyError:
248
+ # Clear any half-initialized module and retry
249
+ sys.modules.pop(modname, None)
250
+ if attempt == retries - 1:
251
+ break
252
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
253
+
241
254
  def __getattr__(self, name: str):
242
255
  if name in self._sub_sdk_map:
243
256
  module_path, class_name = self._sub_sdk_map[name]
244
257
  try:
245
- module = importlib.import_module(module_path)
258
+ module = self.dynamic_import(module_path)
246
259
  klass = getattr(module, class_name)
247
- instance = klass(self.sdk_configuration)
260
+ instance = klass(self.sdk_configuration, parent_ref=self)
248
261
  setattr(self, name, instance)
249
262
  return instance
250
263
  except ImportError as e:
@@ -3,6 +3,7 @@
3
3
  from typing import TYPE_CHECKING
4
4
  from importlib import import_module
5
5
  import builtins
6
+ import sys
6
7
 
7
8
  if TYPE_CHECKING:
8
9
  from .annotations import get_discriminator
@@ -162,6 +163,18 @@ _dynamic_imports: dict[str, str] = {
162
163
  }
163
164
 
164
165
 
166
+ def dynamic_import(modname, retries=3):
167
+ for attempt in range(retries):
168
+ try:
169
+ return import_module(modname, __package__)
170
+ except KeyError:
171
+ # Clear any half-initialized module and retry
172
+ sys.modules.pop(modname, None)
173
+ if attempt == retries - 1:
174
+ break
175
+ raise KeyError(f"Failed to import module '{modname}' after {retries} attempts")
176
+
177
+
165
178
  def __getattr__(attr_name: str) -> object:
166
179
  module_name = _dynamic_imports.get(attr_name)
167
180
  if module_name is None:
@@ -170,9 +183,8 @@ def __getattr__(attr_name: str) -> object:
170
183
  )
171
184
 
172
185
  try:
173
- module = import_module(module_name, __package__)
174
- result = getattr(module, attr_name)
175
- return result
186
+ module = dynamic_import(module_name)
187
+ return getattr(module, attr_name)
176
188
  except ImportError as e:
177
189
  raise ImportError(
178
190
  f"Failed to import {attr_name} from {module_name}: {e}"