1+ from typing import override
2+
13from mpt_api_client .http import AsyncService , Service
24from mpt_api_client .http .mixins import (
35 AsyncCollectionMixin ,
4- AsyncCreateMixin ,
6+ AsyncCreateWithIconMixin ,
57 AsyncGetMixin ,
6- AsyncUpdateMixin ,
8+ AsyncUpdateWithIconMixin ,
79 CollectionMixin ,
8- CreateMixin ,
10+ CreateWithIconMixin ,
911 GetMixin ,
10- UpdateMixin ,
12+ UpdateWithIconMixin ,
1113)
14+ from mpt_api_client .http .types import FileTypes
1215from mpt_api_client .models import Model
16+ from mpt_api_client .models .model import ResourceData
1317from mpt_api_client .resources .accounts .accounts_users import (
1418 AccountsUsersService ,
1519 AsyncAccountsUsersService ,
@@ -31,14 +35,14 @@ class Account(Model):
3135class AccountsServiceConfig :
3236 """Accounts service configuration."""
3337
34- _endpoint = "/public/v1/accounts"
38+ _endpoint = "/public/v1/accounts/accounts "
3539 _model_class = Account
3640 _collection_key = "data"
3741
3842
3943class AccountsService (
40- CreateMixin [Account ],
41- UpdateMixin [Account ],
44+ CreateWithIconMixin [Account ],
45+ UpdateWithIconMixin [Account ],
4246 ActivatableMixin [Account ],
4347 EnablableMixin [Account ],
4448 ValidateMixin [Account ],
@@ -49,6 +53,63 @@ class AccountsService(
4953):
5054 """Accounts service."""
5155
56+ @override
57+ def create (
58+ self ,
59+ resource_data : ResourceData ,
60+ logo : FileTypes ,
61+ data_key : str = "account" ,
62+ icon_key : str = "logo" ,
63+ ) -> Account :
64+ """
65+ Create a new account with logo.
66+
67+ Args:
68+ resource_data (ResourceData): Account data.
69+ logo: Logo image in jpg, png, GIF, etc.
70+ data_key: Key for the account data.
71+ icon_key: Key for the logo.
72+
73+ Returns:
74+ Account: The created account.
75+ """
76+ return super ().create (
77+ resource_data = resource_data ,
78+ icon = logo ,
79+ data_key = data_key ,
80+ icon_key = icon_key ,
81+ )
82+
83+ @override
84+ def update (
85+ self ,
86+ resource_id : str ,
87+ resource_data : ResourceData ,
88+ logo : FileTypes ,
89+ data_key : str = "account" ,
90+ icon_key : str = "logo" ,
91+ ) -> Account :
92+ """
93+ Update an existing account with logo.
94+
95+ Args:
96+ resource_id (str): The ID of the account to update.
97+ resource_data (ResourceData): Account data.
98+ logo: Logo image in jpg, png, GIF, etc.
99+ data_key: Key for the account data.
100+ icon_key: Key for the logo.
101+
102+ Returns:
103+ Account: The updated account.
104+ """
105+ return super ().update (
106+ resource_id = resource_id ,
107+ resource_data = resource_data ,
108+ icon = logo ,
109+ data_key = data_key ,
110+ icon_key = icon_key ,
111+ )
112+
52113 def users (self , account_id : str ) -> AccountsUsersService :
53114 """Return account users service."""
54115 return AccountsUsersService (
@@ -57,8 +118,8 @@ def users(self, account_id: str) -> AccountsUsersService:
57118
58119
59120class AsyncAccountsService (
60- AsyncCreateMixin [Account ],
61- AsyncUpdateMixin [Account ],
121+ AsyncCreateWithIconMixin [Account ],
122+ AsyncUpdateWithIconMixin [Account ],
62123 AsyncActivatableMixin [Account ],
63124 AsyncEnablableMixin [Account ],
64125 AsyncValidateMixin [Account ],
@@ -69,6 +130,63 @@ class AsyncAccountsService(
69130):
70131 """Async Accounts service."""
71132
133+ @override
134+ async def create (
135+ self ,
136+ resource_data : ResourceData ,
137+ logo : FileTypes ,
138+ data_key : str = "account" ,
139+ icon_key : str = "logo" ,
140+ ) -> Account :
141+ """
142+ Create a new account with logo.
143+
144+ Args:
145+ resource_data (ResourceData): Account data.
146+ logo: Logo image in jpg, png, GIF, etc.
147+ data_key: Key for the account data.
148+ icon_key: Key for the logo.
149+
150+ Returns:
151+ Account: The created account.
152+ """
153+ return await super ().create (
154+ resource_data = resource_data ,
155+ icon = logo ,
156+ data_key = data_key ,
157+ icon_key = icon_key ,
158+ )
159+
160+ @override
161+ async def update (
162+ self ,
163+ resource_id : str ,
164+ resource_data : ResourceData ,
165+ logo : FileTypes ,
166+ data_key : str = "account" ,
167+ icon_key : str = "logo" ,
168+ ) -> Account :
169+ """
170+ Update an existing account with logo.
171+
172+ Args:
173+ resource_id (str): The ID of the account to update.
174+ resource_data (ResourceData): Account data.
175+ logo: Logo image in jpg, png, GIF, etc.
176+ data_key: Key for the account data.
177+ icon_key: Key for the logo.
178+
179+ Returns:
180+ Account: The updated account.
181+ """
182+ return await super ().update (
183+ resource_id = resource_id ,
184+ resource_data = resource_data ,
185+ icon = logo ,
186+ data_key = data_key ,
187+ icon_key = icon_key ,
188+ )
189+
72190 def users (self , account_id : str ) -> AsyncAccountsUsersService :
73191 """Return account users service."""
74192 return AsyncAccountsUsersService (
0 commit comments