Web API
api
¤
fapi
¤
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
¤
FAPIRespAircraft
¤
FAPIRespAircraftNotFound
¤
FAPIRespAirport
¤
FAPIRespAirportNotFound
¤
FAPIToken
¤
FAPIRespUser
¤
FAPIRespUserNotFound
¤
FAPIRespACRoute
¤
Bases: BaseModel
FAPIDestination
¤
FAPIRespACRouteFind
¤
Bases: BaseModel
FAPIRespRoute
¤
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,
)
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,
)