Skip to content

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 AbortSignal to allow callers to terminate long-running or obsolete requests.
  • Intelligent Parsing: The notam_data method automatically extracts NOTAM Series, Number, and Year from a raw code string (e.g., "A1234/23").
  • Environment Flexibility: Supports dynamic BaseUrl configuration 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.

PropertyTypeDescriptionDefault
pageNonumberCurrent page number1
pageSizenumberItems per page100
onlyGeojsonbooleanReturn spatial data (GeoJSON) onlytrue
typeCbooleanInclude Class C NOTAMstrue
isInternationalbooleanFilter for international NOTAMstrue
signalAbortSignal(Optional) Signal to cancel the request-

NotamDetailParams

Used for precise fetching of the full text of a specific NOTAM.

PropertyTypeDescription
notamSeriesstringNOTAM Series (e.g., 'A')
notamNoPart1stringNOTAM Number (e.g., '0123')
notamNoPart2stringNOTAM Year (e.g., '2024')
nofstringNOTAM Office code (NOF)

NotamDataParams

A comprehensive query parameter set for NOTAM searches.

PropertyTypeDescription
notamCodestringRaw NOTAM code (e.g., "A1234/24") for auto-parsing
itemAstringICAO Location Indicator (4-letter code)
onlyValidbooleanFilter for currently active NOTAMs only
topicstringTopic 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 populates notamSeries, notamNoPart1, and notamNoPart2 internally, 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

  1. Parameter Sanitization: The SDK automatically converts empty strings ("") to null to ensure compatibility with the backend's filtering logic.
  2. Error Handling: Always implement .catch() blocks. Methods return a raw Response object; you must call .json() to access the payload.
  3. Runway Cycle: The getRunwayData method depends on the GlobalConfigManager. Ensure the global AIRAC cycle or period is initialized before calling this method.