-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
44 lines (37 loc) · 1.29 KB
/
__init__.py
File metadata and controls
44 lines (37 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from .client import APIHttpClient
from .resources.team.resources import TeamsResource, TeamCreate
from .resources.workspace.resources import WorkspacesResource
from .resources.metadata.resources import MetadataResource
from .resources.workspace.models import (
Workspace,
WorkspaceCreate,
WorkspaceUpdate,
WorkspaceStatus,
)
class CodesphereSDK:
def __init__(self, token: str = None):
self._http_client = APIHttpClient()
self.teams: TeamsResource | None = None
self.workspaces: WorkspacesResource | None = None
async def __aenter__(self):
"""Wird beim Eintritt in den 'async with'-Block aufgerufen."""
await self._http_client.__aenter__()
self.teams = TeamsResource(self._http_client)
self.workspaces = WorkspacesResource(self._http_client)
self.metadata = MetadataResource(self._http_client)
return self
async def __aexit__(self, exc_type, exc_val, exc_tb):
"""Wird beim Verlassen des 'async with'-Blocks aufgerufen."""
await self._http_client.__aexit__(exc_type, exc_val, exc_tb)
__all__ = [
"CodesphereSDK",
"CodesphereError",
"AuthenticationError",
"Team",
"TeamCreate",
"TeamInList",
"Workspace",
"WorkspaceCreate",
"WorkspaceUpdate",
"WorkspaceStatus",
]