Web API
api
¤
Modules:
Name | Description |
---|---|
fapi |
|
models |
|
fapi
¤
Functions:
Name | Description |
---|---|
lifespan |
|
construct_acnf_response |
|
ac_search |
|
construct_apnf_response |
|
ap_search |
|
route_info |
|
ac_route_info |
|
ac_route_find_routes |
|
start |
|
Attributes:
Name | Type | Description |
---|---|---|
app |
|
|
server |
|
app
module-attribute
¤
app = FastAPI(
title="AM4Tools V2 API (Alpha)",
description="A collection of calculators and tools for Airline Manager 4, aimed to facilitate statistical analyses and promote the development of third-party tools. This version is primarily rewritten in C++ for performance, in particular, route finding.\n\n**This API is currently in alpha** - please report any issues on our [AM4Tools Discord server](https://discord.gg/4tVQHtf), or ping me at @cathayexpress if you encounter critical issues such as 500 Internal Server Error. This project is open source - feel free to open pull requests on [GitHub](https://github.com/cathaypacific8747/am4).\n\n# Key features\n- Fuzzy airport and aircraft search\n- Basic route details (P2P)\n- Advanced route details (P2P, with aircraft)\n- Automatic best stopover, trips per day and seat algorithm selection\n- Advanced route finder (P2P, with aircraft, origin hub, and filters) - **be careful: the massive response payload may crash this tab**: use Insomnia or Postman instead!\n- Fuel, CO2, misc costs and contribution estimation\n\nAt this stage, **no authentication is required** to access the API. An API token in the future will be required as this scales.\n\nThis service is 100% free to use for all users.\n\nOpen one of the endpoints and click the try it out button right here in your browser, or download `openapi.json` to test it out!",
version="0.1.8",
lifespan=lifespan,
)
server
module-attribute
¤
server = Server(
Config(
app,
host=HOST,
port=PORT,
reload=RELOAD,
server_header=False,
log_level=lower(),
)
)
construct_acnf_response
¤
construct_acnf_response(
param_name: str, ac_sugg: list[Suggestion]
) -> ORJSONResponse
construct_apnf_response
¤
construct_apnf_response(
param_name: str, ap_sugg: list[Suggestion]
) -> ORJSONResponse
ac_route_info
async
¤
ac_route_info(
origin: FAPIReqAPSearchQuery,
destination: FAPIReqAPSearchQuery,
ac: FAPIReqACSearchQuery,
options: FAPIReqACROptions,
user: FAPIReqUser,
)
ac_route_find_routes
async
¤
ac_route_find_routes(
ap0: FAPIReqAPSearchQuery,
ac: FAPIReqACSearchQuery,
options: FAPIReqACROptions,
user: FAPIReqUser,
)
models
¤
Classes:
Attributes:
Name | Type | Description |
---|---|---|
FAPIReqACSearchQuery |
|
|
FAPIReqAPSearchQuery |
|
|
FAPIReqRealism |
|
FAPIRespAircraft
¤
FAPIRespAircraftNotFound
¤
FAPIRespAirport
¤
FAPIRespAirportNotFound
¤
FAPIToken
¤
FAPIRespUser
¤
FAPIRespUserNotFound
¤
FAPIRespACRoute
¤
FAPIDestination
¤
FAPIRespACRouteFind
¤
FAPIRespRoute
¤
Bases: BaseModel
Attributes:
Name | Type | Description |
---|---|---|
status |
str
|
|
ap_origin |
PyAirport
|
|
ap_destination |
PyAirport
|
|
route |
PyRoute
|
|
FAPIReqACROptions
¤
FAPIReqACROptions(
config_algorithm: PyACROptionsConfigAlgorithm = None,
max_distance: PyACROptionsMaxDistance = None,
max_flight_time: PyACROptionsMaxFlightTime = None,
tpd_mode: PyACROptionsTPDMode = None,
trips_per_day_per_ac: PyACROptionsTripsPerDayPerAC = None,
sort_by: PyACROptionsSortBy = None,
)
Methods:
Name | Description |
---|---|
to_core |
|
Attributes:
Name | Type | Description |
---|---|---|
config_algorithm |
|
|
max_distance |
|
|
max_flight_time |
|
|
tpd_mode |
|
|
trips_per_day_per_ac |
|
|
sort_by |
|
FAPIReqUser
¤
FAPIReqUser(
realism: FAPIReqRealism = None,
wear_training: int = None,
repair_training: int = None,
l_training: int = None,
h_training: int = None,
fuel_training: int = None,
co2_training: int = None,
fuel_price: int = None,
co2_price: int = None,
accumulated_count: int = None,
fourx: bool = None,
income_loss_tol: float = None,
load: float = None,
cargo_load: float = None,
)
Methods:
Name | Description |
---|---|
to_core |
|
Attributes:
Name | Type | Description |
---|---|---|
realism |
|
|
wear_training |
|
|
repair_training |
|
|
l_training |
|
|
h_training |
|
|
fuel_training |
|
|
co2_training |
|
|
fuel_price |
|
|
co2_price |
|
|
accumulated_count |
|
|
fourx |
|
|
income_loss_tol |
|
|
load |
|
|
cargo_load |
|