Skip to content

Commit f9fadca

Browse files
committed
remove services
1 parent 3e12b98 commit f9fadca

10 files changed

Lines changed: 4 additions & 370 deletions

File tree

β€Žappwrite/encoders/value_class_encoder.pyβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
from ..enums.scopes import Scopes
32
from ..enums.authenticator_type import AuthenticatorType
43
from ..enums.authentication_factor import AuthenticationFactor
54
from ..enums.o_auth_provider import OAuthProvider
@@ -16,6 +15,7 @@
1615
from ..enums.index_type import IndexType
1716
from ..enums.order_by import OrderBy
1817
from ..enums.runtime import Runtime
18+
from ..enums.scopes import Scopes
1919
from ..enums.template_reference_type import TemplateReferenceType
2020
from ..enums.vcs_reference_type import VCSReferenceType
2121
from ..enums.deployment_download_type import DeploymentDownloadType
@@ -43,9 +43,6 @@
4343

4444
class ValueClassEncoder(json.JSONEncoder):
4545
def default(self, o):
46-
if isinstance(o, Scopes):
47-
return o.value
48-
4946
if isinstance(o, AuthenticatorType):
5047
return o.value
5148

@@ -94,6 +91,9 @@ def default(self, o):
9491
if isinstance(o, Runtime):
9592
return o.value
9693

94+
if isinstance(o, Scopes):
95+
return o.value
96+
9797
if isinstance(o, TemplateReferenceType):
9898
return o.value
9999

β€Žappwrite/services/account.pyβ€Ž

Lines changed: 0 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from typing import List, Dict, Any, Optional
33
from ..exception import AppwriteException
44
from appwrite.utils.deprecated import deprecated
5-
from ..enums.scopes import Scopes;
65
from ..enums.authenticator_type import AuthenticatorType;
76
from ..enums.authentication_factor import AuthenticationFactor;
87
from ..enums.o_auth_provider import OAuthProvider;
@@ -216,186 +215,6 @@ def create_jwt(self, duration: Optional[float] = None) -> Dict[str, Any]:
216215
'content-type': 'application/json',
217216
}, api_params)
218217

219-
def list_keys(self, total: Optional[bool] = None) -> Dict[str, Any]:
220-
"""
221-
Get a list of all API keys from the current account.
222-
223-
Parameters
224-
----------
225-
total : Optional[bool]
226-
When set to false, the total count returned will be 0 and will not be calculated.
227-
228-
Returns
229-
-------
230-
Dict[str, Any]
231-
API response as a dictionary
232-
233-
Raises
234-
------
235-
AppwriteException
236-
If API request fails
237-
"""
238-
239-
api_path = '/account/keys'
240-
api_params = {}
241-
242-
if total is not None:
243-
api_params['total'] = total
244-
245-
return self.client.call('get', api_path, {
246-
}, api_params)
247-
248-
def create_key(self, name: str, scopes: List[Scopes], expire: Optional[str] = None) -> Dict[str, Any]:
249-
"""
250-
Create a new account API key.
251-
252-
Parameters
253-
----------
254-
name : str
255-
Key name. Max length: 128 chars.
256-
scopes : List[Scopes]
257-
Key scopes list. Maximum of 100 scopes are allowed.
258-
expire : Optional[str]
259-
Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
260-
261-
Returns
262-
-------
263-
Dict[str, Any]
264-
API response as a dictionary
265-
266-
Raises
267-
------
268-
AppwriteException
269-
If API request fails
270-
"""
271-
272-
api_path = '/account/keys'
273-
api_params = {}
274-
if name is None:
275-
raise AppwriteException('Missing required parameter: "name"')
276-
277-
if scopes is None:
278-
raise AppwriteException('Missing required parameter: "scopes"')
279-
280-
281-
api_params['name'] = name
282-
api_params['scopes'] = scopes
283-
api_params['expire'] = expire
284-
285-
return self.client.call('post', api_path, {
286-
'content-type': 'application/json',
287-
}, api_params)
288-
289-
def get_key(self, key_id: str) -> Dict[str, Any]:
290-
"""
291-
Get a key by its unique ID. This endpoint returns details about a specific API key in your account including it's scopes.
292-
293-
Parameters
294-
----------
295-
key_id : str
296-
Key unique ID.
297-
298-
Returns
299-
-------
300-
Dict[str, Any]
301-
API response as a dictionary
302-
303-
Raises
304-
------
305-
AppwriteException
306-
If API request fails
307-
"""
308-
309-
api_path = '/account/keys/{keyId}'
310-
api_params = {}
311-
if key_id is None:
312-
raise AppwriteException('Missing required parameter: "key_id"')
313-
314-
api_path = api_path.replace('{keyId}', key_id)
315-
316-
317-
return self.client.call('get', api_path, {
318-
}, api_params)
319-
320-
def update_key(self, key_id: str, name: str, scopes: List[Scopes], expire: Optional[str] = None) -> Dict[str, Any]:
321-
"""
322-
Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
323-
324-
Parameters
325-
----------
326-
key_id : str
327-
Key unique ID.
328-
name : str
329-
Key name. Max length: 128 chars.
330-
scopes : List[Scopes]
331-
Key scopes list. Maximum of 100 scopes are allowed.
332-
expire : Optional[str]
333-
Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Use null for unlimited expiration.
334-
335-
Returns
336-
-------
337-
Dict[str, Any]
338-
API response as a dictionary
339-
340-
Raises
341-
------
342-
AppwriteException
343-
If API request fails
344-
"""
345-
346-
api_path = '/account/keys/{keyId}'
347-
api_params = {}
348-
if key_id is None:
349-
raise AppwriteException('Missing required parameter: "key_id"')
350-
351-
if name is None:
352-
raise AppwriteException('Missing required parameter: "name"')
353-
354-
if scopes is None:
355-
raise AppwriteException('Missing required parameter: "scopes"')
356-
357-
api_path = api_path.replace('{keyId}', key_id)
358-
359-
api_params['name'] = name
360-
api_params['scopes'] = scopes
361-
api_params['expire'] = expire
362-
363-
return self.client.call('put', api_path, {
364-
'content-type': 'application/json',
365-
}, api_params)
366-
367-
def delete_key(self, key_id: str) -> Dict[str, Any]:
368-
"""
369-
Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
370-
371-
Parameters
372-
----------
373-
key_id : str
374-
Key unique ID.
375-
376-
Returns
377-
-------
378-
Dict[str, Any]
379-
API response as a dictionary
380-
381-
Raises
382-
------
383-
AppwriteException
384-
If API request fails
385-
"""
386-
387-
api_path = '/account/keys/{keyId}'
388-
api_params = {}
389-
if key_id is None:
390-
raise AppwriteException('Missing required parameter: "key_id"')
391-
392-
api_path = api_path.replace('{keyId}', key_id)
393-
394-
395-
return self.client.call('delete', api_path, {
396-
'content-type': 'application/json',
397-
}, api_params)
398-
399218
def list_logs(self, queries: Optional[List[str]] = None, total: Optional[bool] = None) -> Dict[str, Any]:
400219
"""
401220
Get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.

β€Žappwrite/services/organizations.pyβ€Ž

Lines changed: 0 additions & 73 deletions
This file was deleted.

β€Ždocs/examples/account/create-key.mdβ€Ž

Lines changed: 0 additions & 18 deletions
This file was deleted.

β€Ždocs/examples/account/delete-key.mdβ€Ž

Lines changed: 0 additions & 15 deletions
This file was deleted.

β€Ždocs/examples/account/get-key.mdβ€Ž

Lines changed: 0 additions & 15 deletions
This file was deleted.

β€Ždocs/examples/account/list-keys.mdβ€Ž

Lines changed: 0 additions & 15 deletions
This file was deleted.

β€Ždocs/examples/account/update-key.mdβ€Ž

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
Β (0)