Skip to content

Commit

Permalink
Clean up a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
AJXD2 committed Dec 6, 2024
1 parent 93d043f commit 0758edc
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions helldivepy/api/space_stations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from helldivepy.api.base import BaseApiModule
import typing
import helldivepy.models as models
from typing import Optional, TYPE_CHECKING

if typing.TYPE_CHECKING:
if TYPE_CHECKING:
from helldivepy.api_client import ApiClient


Expand All @@ -11,24 +11,24 @@ def __init__(self, api_client: "ApiClient") -> None:
super().__init__(api_client)

def get_space_stations(self) -> list[models.SpaceStation]:
"""Gets all spacestations
"""
Retrieves all space stations.
Returns:
list[models.SpaceStation]: The response from the server.
list[SpaceStation]: A list of space station objects from the server.
"""
data = self.get("community", "api", "v1", "space-stations")
return [models.SpaceStation(**i) for i in data]
return [models.SpaceStation(**item) for item in data]

def get_space_station(self, index: int) -> typing.Optional[models.SpaceStation]:
"""Get a space station by its ID.
def get_space_station(self, index: int) -> Optional[models.SpaceStation]:
"""
Retrieves a space station by its ID.
Args:
index (int): The ID of the space station
index (int): The ID of the space station.
Returns:
typing.Optional[models.SpaceStation]: The response from the server.
Optional[SpaceStation]: The space station object if found, or None.
"""
data = self.get("community", "api", "v1", "space", "stations", str(index))
if not data:
return None
return models.SpaceStation(**data)
return models.SpaceStation(**data) if data else None

0 comments on commit 0758edc

Please sign in to comment.