Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/metadata/get_workspace_base_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async def main():
"""Fetches base images."""
async with CodesphereSDK() as sdk:
images = await sdk.metadata.images()
images = await sdk.metadata.list_images()
for image in images:
print(image.model_dump_json(indent=2))

Expand Down
2 changes: 1 addition & 1 deletion examples/metadata/get_workspace_plans.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async def main():
"""Fetches workspace plans."""
async with CodesphereSDK() as sdk:
plans = await sdk.metadata.plans()
plans = await sdk.metadata.list_plans()

for plan in plans:
print(plan.model_dump_json(indent=2))
Expand Down
2 changes: 1 addition & 1 deletion examples/teams/delete_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async def main():
try:
async with CodesphereSDK() as sdk:
team_to_delete = await sdk.teams.get(team_id="<id>")
team_to_delete = await sdk.teams.get(team_id=11111)
print(team_to_delete.model_dump_json(indent=2))
await team_to_delete.delete()
print(f"Team with ID {team_to_delete.id} was successfully deleted.")
Expand Down
2 changes: 1 addition & 1 deletion examples/teams/get_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
async def main():
try:
async with CodesphereSDK() as sdk:
team = await sdk.teams.get(team_id="<id>")
team = await sdk.teams.get(team_id=12312)
print(team.model_dump_json(indent=2))

except Exception as e:
Expand Down
3 changes: 1 addition & 2 deletions src/codesphere/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
import logging
from .client import CodesphereSDK

from .cs_types.exceptions.exceptions import CodesphereError, AuthenticationError

from .exceptions import CodesphereError, AuthenticationError
from .resources.team import Team, TeamCreate, TeamBase
from .resources.workspace import (
Workspace,
Expand Down
8 changes: 4 additions & 4 deletions src/codesphere/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
This module provides the main client class, CodesphereSDK.
"""

from .cs_types.rest.http_client import APIHttpClient
from .resources.metadata.resources import MetadataResource
from .resources.team.resources import TeamsResource
from .resources.workspace.resources import WorkspacesResource
from .http_client import APIHttpClient
from .resources.metadata import MetadataResource
from .resources.team import TeamsResource
from .resources.workspace import WorkspacesResource


class CodesphereSDK:
Expand Down
11 changes: 11 additions & 0 deletions src/codesphere/core/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from .base import ResourceBase
from .operations import APIOperation, AsyncCallable
from .handler import _APIOperationExecutor, APIRequestHandler

__all__ = [
"ResourceBase",
"APIOperation",
"_APIOperationExecutor",
"APIRequestHandler",
"AsyncCallable",
]
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ..cs_types.rest.http_client import APIHttpClient
from ..cs_types.rest.handler import _APIOperationExecutor
from ..http_client import APIHttpClient
from .handler import _APIOperationExecutor


class ResourceBase(_APIOperationExecutor):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import httpx
from pydantic import BaseModel, PrivateAttr, ValidationError

from .http_client import APIHttpClient
from ..http_client import APIHttpClient
from .operations import APIOperation

log = logging.getLogger(__name__)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import httpx
from pydantic import BaseModel
from typing import Optional, Any
from ...config import settings
from .config import settings

log = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions src/codesphere/resources/metadata/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""

from typing import List
from ...cs_types.rest.operations import APIOperation, AsyncCallable
from ..base import ResourceBase
from ...core import APIOperation, AsyncCallable
from ...core import ResourceBase
from .models import Datacenter, WsPlan, Image


Expand Down
3 changes: 1 addition & 2 deletions src/codesphere/resources/team/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from pydantic import BaseModel, Field
from typing import Optional

from ...cs_types.rest.handler import _APIOperationExecutor
from ...cs_types.rest.operations import APIOperation, AsyncCallable
from ...core import _APIOperationExecutor, APIOperation, AsyncCallable


class TeamCreate(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions src/codesphere/resources/team/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

from typing import List, Protocol

from ...cs_types.rest.operations import APIOperation, AsyncCallable
from ..base import ResourceBase
from ...core import APIOperation, AsyncCallable, ResourceBase
from .models import Team, TeamCreate


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, List, TYPE_CHECKING

if TYPE_CHECKING:
from ...client import APIHttpClient
from ....http_client import APIHttpClient


class EnvVarPair(BaseModel):
Expand Down
2 changes: 1 addition & 1 deletion src/codesphere/resources/workspace/env-vars/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from typing import List
from ..base import ResourceBase, APIOperation
from ....core import ResourceBase, APIOperation
from .models import Workspace, WorkspaceCreate, WorkspaceUpdate


Expand Down
2 changes: 1 addition & 1 deletion src/codesphere/resources/workspace/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Optional, List, TYPE_CHECKING, Union, Dict

if TYPE_CHECKING:
from ...client import APIHttpClient
from ...http_client import APIHttpClient


class EnvVarPair(BaseModel):
Expand Down
3 changes: 1 addition & 2 deletions src/codesphere/resources/workspace/resources.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import List, Protocol

from ...cs_types.rest.operations import APIOperation
from ..base import ResourceBase
from ...core import APIOperation, ResourceBase
from .models import Workspace, WorkspaceCreate


Expand Down
Loading