This is the complete English API documentation based on your API class definition. It follows professional software engineering standards and incorporates civil aviation industry terminology.
API Development Documentation
1. Overview
The API class provides a unified interface for accessing core civil aviation data services. It facilitates communication with backend systems to retrieve NOTAMs (Notices to Air Missions), meteorological data (Radar, Typhoon, Volcanic Ash), runway parameters, and airport spatial information.
Key Features:
- Request Cancellation: All methods support the standard
AbortSignalto allow callers to terminate long-running or obsolete requests. - Intelligent Parsing: The
notam_datamethod automatically extracts NOTAM Series, Number, and Year from a raw code string (e.g., "A1234/23"). - Environment Flexibility: Supports dynamic
BaseUrlconfiguration for switching between staging and production environments.
2. Configuration
- Method:
setBaseUrl(baseUrl: string)– Use this to modify the request domain globally for the instance.
3. Data Type Definitions
NotamListParams
Used for filtering NOTAMs intended for map visualization.
| Property | Type | Description | Default |
|---|---|---|---|
| pageNo | number | Current page number | 1 |
| pageSize | number | Items per page | 100 |
| onlyGeojson | boolean | Return spatial data (GeoJSON) only | true |
| typeC | boolean | Include Class C NOTAMs | true |
| isInternational | boolean | Filter for international NOTAMs | true |
| signal | AbortSignal | (Optional) Signal to cancel the request | - |
NotamDetailParams
Used for precise fetching of the full text of a specific NOTAM.
| Property | Type | Description |
|---|---|---|
| notamSeries | string | NOTAM Series (e.g., 'A') |
| notamNoPart1 | string | NOTAM Number (e.g., '0123') |
| notamNoPart2 | string | NOTAM Year (e.g., '2024') |
| nof | string | NOTAM Office code (NOF) |
NotamDataParams
A comprehensive query parameter set for NOTAM searches.
| Property | Type | Description |
|---|---|---|
| notamCode | string | Raw NOTAM code (e.g., "A1234/24") for auto-parsing |
| itemA | string | ICAO Location Indicator (4-letter code) |
| onlyValid | boolean | Filter for currently active NOTAMs only |
| topic | string | Topic category (defaults to "official") |
4. Method Details
4.1 NOTAM Interfaces
notam_list(params)
- Description: Retrieves a list of NOTAMs with geographical data, suitable for rendering elements on a map.
- Returns:
Promise<Response>
notam_detail(params)
- Description: Fetches the full textual details of a single NOTAM identified by its Series, Number, Year, and NOF.
- Returns:
Promise<Response>
notam_data(params)
- Description: A multi-purpose NOTAM data retrieval interface.
- Logic Feature: This method includes a built-in Regex parser. If you provide a
notamCode(e.g.,A0556/24), the SDK automatically populatesnotamSeries,notamNoPart1, andnotamNoPart2internally, simplifying the caller's implementation.
4.2 Weather & Runway Interfaces
typhoon_volcano_ash(params)
- Description: Retrieves advisory analysis data for tropical cyclones (typhoons) and volcanic ash clouds.
getRadarData(signal?)
- Description: Fetches the latest radar imagery list (returns the 40 most recent records by default).
getRunwayData(params)
- Description: Retrieves physical runway parameters and operational data for a specific airport.
4.3 Airport & Spatial Data
getAirportPoint(airport, signal?)
- Description: A composite method. It first queries the airport's central geographic point and then automatically calls the index interface to fetch detailed spatial data.
- Result: Returns a JSON object containing coordinates, elevation, ICAO code, and other metadata.
5. Usage Examples
Standard Query
typescript
import API from './api';
const api = new API();
// 1. Fetch NOTAM List for Map
api.notam_list({
pageNo: 1,
pageSize: 50,
isInternational: true
}).then(res => res.json())
.then(data => console.log("NOTAM List:", data));
// 2. Search using Auto-Parsing
api.notam_data({
notamCode: "A0123/24", // Parsed as Series: A, No: 0123, Year: 2024
itemA: "ZSPD"
}).then(res => res.json());Abort/Cancel Request
Useful when a user navigates away or when implementing a custom timeout.
typescript
const controller = new AbortController();
api.getRadarData(controller.signal)
.then(res => res.json())
.catch(err => {
if (err.name === 'AbortError') {
console.log('Request was cancelled by the user.');
}
});
// Cancel the request if it takes longer than 5 seconds
setTimeout(() => {
controller.abort();
}, 5000);6. Development Notes
- Parameter Sanitization: The SDK automatically converts empty strings (
"") tonullto ensure compatibility with the backend's filtering logic. - Error Handling: Always implement
.catch()blocks. Methods return a rawResponseobject; you must call.json()to access the payload. - Runway Cycle: The
getRunwayDatamethod depends on theGlobalConfigManager. Ensure the global AIRAC cycle or period is initialized before calling this method.
