diff --git a/README.md b/README.md index 9d6edbb..32af656 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Written in TypeScript](https://img.shields.io/github/languages/top/2BAD/ryanair)](https://github.com/2BAD/ryanair/search?l=typescript) [![Postman Collection](https://img.shields.io/badge/postman-collection-ff6c37)](https://www.postman.com/hakkotsu/workspace/ryanair) -Unofficial typescript client for the Ryanair API that allows you to easily retrieve information about airports, flights and prices. +Unofficial TypeScript client for Ryanair's API that provides easy access to flights, fares, and airport information. ## Install @@ -22,51 +22,70 @@ npm install @2bad/ryanair ```typescript import { airports, fares, flights } from '@2bad/ryanair' -// Get information about the closest airport based on your IP address -const airport = await airports.getClosest() +// Find your nearest airport +const closest = await airports.getClosest() -// Get a list of available dates from a specific destination +// Check available flight dates const dates = await flights.getDates('BER', 'DUB') -// Or the cheapest one-way fares between two airports for a given start date -const cheapest = await fares.getCheapestPerDay('BER', 'DUB', '2023-10-10') +// Get cheapest fares for your trip +const deals = await fares.getCheapestPerDay('BER', 'DUB', '2024-02-01') ``` -## API +## API Overview -- [Airports](docs/airports.md#airports-api) - - [getActive](docs/airports.md#getactive) - - [getActiveV3](docs/airports.md#getactivev3) - - [getClosest](docs/airports.md#getclosest) - - [getDestinations](docs/airports.md#getdestinationscode-iatacode) - - [getInfo](docs/airports.md#getinfocode-iatacode) - - [getNearby](docs/airports.md#getnearby) - - [getSchedules](docs/airports.md#getschedules) - - [findRoutes](docs/airports.md#findroutesfrom-iatacode-to-iatacode) -- [Fares](docs/fares.md#fares-api) - - [getCheapestPerDay](docs/fares.md#getcheapestperdayfrom-iatacode-to-iatacode-startdate-strdate-currency--eur) - - [findDailyFaresInRange](docs/fares.md#findDailyFaresInRangefrom-iatacode-to-iatacode-startdate-strdate-enddate-strdate-currency--eur) - - [findCheapestRoundTrip](docs/fares.md#findcheapestroundtripfrom-iatacode-to-iatacode-startdate-strdate-enddate-strdate-currency--eur-limit--10) -- [Flights](docs/flights.md#flights-api) - - [getDates](docs/flights.md#getdatesfrom-iatacode-to-iatacode) - - [getAvailable](docs/flights.md#getavailableparams-partial) +### Airports API +- Get active airports list +- Find nearest airports +- Discover available destinations +- View airport details +- Search flight routes -## IATA codes +[View Airports Documentation →](docs/airports.md) -IATA codes are three-letter codes used by the International Air Transport Association (IATA) to identify airports, airlines, and other entities in the aviation industry. These codes are used primarily for ticketing, scheduling, and other administrative purposes. +### Fares API +- Find cheapest daily fares +- Compare prices across date ranges +- Discover best round-trip deals +- Search by currency preference -Airport codes are the most common type of IATA code. They consist of three letters, with the first two letters representing the country and the third letter representing the airport. For example, LAX is the IATA code for Los Angeles International Airport in the United States. +[View Fares Documentation →](docs/fares.md) -For a full list of available IATA codes, please visit this [page](https://www.iata.org/en/publications/directories/code-search/). +### Flights API +- Check flight availability +- View flight schedules +- Search available dates +- Access flight details -## Error handling +[View Flights Documentation →](docs/flights.md) -Each function throws an Error if the request to the API fails or the response is invalid. Make sure to handle them or use try-catch statement. +## Understanding IATA Codes + +IATA codes are three-letter identifiers used in aviation for airports worldwide. For example: +- `DUB` - Dublin Airport +- `BER` - Berlin Brandenburg Airport +- `STN` - London Stansted Airport + +Find the complete list on [IATA's official website](https://www.iata.org/en/publications/directories/code-search/). ## Disclaimer -Please note that this is not an official library and has no affiliation with Ryanair. The wrapper is based on publicly available API, terms of use and limitations of the Ryanair API apply. +This is an unofficial package and is not affiliated with Ryanair. Usage is subject to Ryanair's API terms and conditions. ## Contributing -We welcome contributions! If you find a bug or want to request a new feature, please open an issue. If you want to submit a bug fix or new feature, please open a pull request. +Contributions are welcome! Here's how you can help: + +1. Fork the repository +2. Create a feature branch +3. Submit a pull request + +Please ensure your code passes all tests and follows our coding standards. + +## License + +MIT © [2BAD](https://github.com/2BAD) + +--- + +Need help? [Open an issue](https://github.com/2BAD/ryanair/issues) or check our [Postman collection](https://www.postman.com/hakkotsu/workspace/ryanair). diff --git a/packages/ryanair/LICENSE b/packages/ryanair/LICENSE new file mode 100644 index 0000000..8b7be45 --- /dev/null +++ b/packages/ryanair/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 2BAD + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ryanair/README.md b/packages/ryanair/README.md new file mode 100644 index 0000000..32af656 --- /dev/null +++ b/packages/ryanair/README.md @@ -0,0 +1,91 @@ +# Ryanair API + +[![NPM version](https://img.shields.io/npm/v/@2bad/ryanair)](https://www.npmjs.com/package/@2bad/ryanair) +[![License](https://img.shields.io/npm/l/@2bad/ryanair)](https://www.npmjs.com/package/@2bad/ryanair) +[![GitHub Build Status](https://img.shields.io/github/actions/workflow/status/2BAD/ryanair/build.yml)](https://github.com/2BAD/ryanair/actions/workflows/build.yml) +[![Code coverage](https://img.shields.io/codecov/c/github/2BAD/ryanair)](https://codecov.io/gh/2BAD/ryanair) +[![Written in TypeScript](https://img.shields.io/github/languages/top/2BAD/ryanair)](https://github.com/2BAD/ryanair/search?l=typescript) +[![Postman Collection](https://img.shields.io/badge/postman-collection-ff6c37)](https://www.postman.com/hakkotsu/workspace/ryanair) + +Unofficial TypeScript client for Ryanair's API that provides easy access to flights, fares, and airport information. + +## Install + +```shell +npm install @2bad/ryanair +``` + +**Warning:** This package is native [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) and no longer provides a CommonJS export. If your project uses CommonJS, you will have to [convert to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) or use the [dynamic `import()`](https://v8.dev/features/dynamic-import) function. Please don't open issues for questions regarding CommonJS / ESM. + +## Usage + +```typescript +import { airports, fares, flights } from '@2bad/ryanair' + +// Find your nearest airport +const closest = await airports.getClosest() + +// Check available flight dates +const dates = await flights.getDates('BER', 'DUB') + +// Get cheapest fares for your trip +const deals = await fares.getCheapestPerDay('BER', 'DUB', '2024-02-01') +``` + +## API Overview + +### Airports API +- Get active airports list +- Find nearest airports +- Discover available destinations +- View airport details +- Search flight routes + +[View Airports Documentation →](docs/airports.md) + +### Fares API +- Find cheapest daily fares +- Compare prices across date ranges +- Discover best round-trip deals +- Search by currency preference + +[View Fares Documentation →](docs/fares.md) + +### Flights API +- Check flight availability +- View flight schedules +- Search available dates +- Access flight details + +[View Flights Documentation →](docs/flights.md) + +## Understanding IATA Codes + +IATA codes are three-letter identifiers used in aviation for airports worldwide. For example: +- `DUB` - Dublin Airport +- `BER` - Berlin Brandenburg Airport +- `STN` - London Stansted Airport + +Find the complete list on [IATA's official website](https://www.iata.org/en/publications/directories/code-search/). + +## Disclaimer + +This is an unofficial package and is not affiliated with Ryanair. Usage is subject to Ryanair's API terms and conditions. + +## Contributing + +Contributions are welcome! Here's how you can help: + +1. Fork the repository +2. Create a feature branch +3. Submit a pull request + +Please ensure your code passes all tests and follows our coding standards. + +## License + +MIT © [2BAD](https://github.com/2BAD) + +--- + +Need help? [Open an issue](https://github.com/2BAD/ryanair/issues) or check our [Postman collection](https://www.postman.com/hakkotsu/workspace/ryanair).