mirror of
https://github.com/azaion/gps-denied-onboard.git
synced 2026-04-22 22:06:37 +00:00
initial structure implemented
docs -> _docs
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from .base import FlightAPIBase
|
||||
from .flight_api import FlightAPI
|
||||
|
||||
__all__ = ["FlightAPIBase", "FlightAPI"]
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import AsyncIterator
|
||||
from fastapi import UploadFile
|
||||
|
||||
from models.api import (
|
||||
FlightCreateRequest,
|
||||
FlightResponse,
|
||||
FlightDetailResponse,
|
||||
FlightStatusResponse,
|
||||
DeleteResponse,
|
||||
UpdateResponse,
|
||||
BatchResponse,
|
||||
UserFixRequest,
|
||||
UserFixResponse,
|
||||
ObjectGPSResponse,
|
||||
)
|
||||
from models.core import GPSPoint
|
||||
|
||||
|
||||
class FlightAPIBase(ABC):
|
||||
@abstractmethod
|
||||
async def create_flight(self, request: FlightCreateRequest) -> FlightResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_flight(self, flight_id: str) -> FlightDetailResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_flight_status(self, flight_id: str) -> FlightStatusResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def delete_flight(self, flight_id: str) -> DeleteResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def update_waypoints(
|
||||
self, flight_id: str, waypoints: list[GPSPoint]
|
||||
) -> UpdateResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def upload_batch(
|
||||
self,
|
||||
flight_id: str,
|
||||
files: list[UploadFile],
|
||||
start_sequence: int,
|
||||
end_sequence: int,
|
||||
batch_number: int,
|
||||
) -> BatchResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def submit_user_fix(
|
||||
self, flight_id: str, request: UserFixRequest
|
||||
) -> UserFixResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def get_object_gps(
|
||||
self, flight_id: str, frame_id: int, pixel: tuple[float, float]
|
||||
) -> ObjectGPSResponse:
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def stream_events(self, flight_id: str) -> AsyncIterator[dict]:
|
||||
pass
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
from typing import AsyncIterator
|
||||
from fastapi import UploadFile
|
||||
|
||||
from .base import FlightAPIBase
|
||||
from models.api import (
|
||||
FlightCreateRequest,
|
||||
FlightResponse,
|
||||
FlightDetailResponse,
|
||||
FlightStatusResponse,
|
||||
DeleteResponse,
|
||||
UpdateResponse,
|
||||
BatchResponse,
|
||||
UserFixRequest,
|
||||
UserFixResponse,
|
||||
ObjectGPSResponse,
|
||||
)
|
||||
from models.core import GPSPoint
|
||||
|
||||
|
||||
class FlightAPI(FlightAPIBase):
|
||||
async def create_flight(self, request: FlightCreateRequest) -> FlightResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_flight(self, flight_id: str) -> FlightDetailResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_flight_status(self, flight_id: str) -> FlightStatusResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def delete_flight(self, flight_id: str) -> DeleteResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def update_waypoints(
|
||||
self, flight_id: str, waypoints: list[GPSPoint]
|
||||
) -> UpdateResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def upload_batch(
|
||||
self,
|
||||
flight_id: str,
|
||||
files: list[UploadFile],
|
||||
start_sequence: int,
|
||||
end_sequence: int,
|
||||
batch_number: int,
|
||||
) -> BatchResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def submit_user_fix(
|
||||
self, flight_id: str, request: UserFixRequest
|
||||
) -> UserFixResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def get_object_gps(
|
||||
self, flight_id: str, frame_id: int, pixel: tuple[float, float]
|
||||
) -> ObjectGPSResponse:
|
||||
raise NotImplementedError
|
||||
|
||||
async def stream_events(self, flight_id: str) -> AsyncIterator[dict]:
|
||||
raise NotImplementedError
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user