Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Web Red Apps
- Sabre Red 360 Services
- IEncodeDecodePublicService
IEncodeDecodePublicService
Web API for encode-decode service.
About the Encode/Decode Service
The Encode/Decode service encodes or decodes text for a specified category. The service returns a list of entries that match the input in text format with a single call. It includes the following domains for various categories of codes travel industry uses:
-
Airline name
-
Airport
-
Bus company name
-
Car equipment
-
Car type
-
Car vendor
-
Country
-
City
-
Credit card vendor
-
Cruise line
-
Currency
-
Equipment
-
Hotel vendor
-
Room type
-
SSR
-
US state
A domain and the argument to either encode or decode must be specified for each call.
-
Encode: To retrieve matching codes, provide domain and name or the beginning of name.
-
Decode: To retrieve matching names, provide domain and the code or the beginning of code.
-
Encode-Decode: To retrieve matching codes and names, provide domain and the code/name or part of code/name.
The Domain
enumeration represents the categories of pre-defined values.
Acquiring Encode Decode Service
In order to obtain IEncodeDecodePublicService and use it you need to import it, e.g.
import {IEncodeDecodePublicService} from 'sabre-ngv-app/app/services/impl/IEncodeDecodePublicService';
// ...
const edpublic: IEncodeDecodePublicService = getService(IEncodeDecodePublicService);
Usage
Service has three methods: .encode(), .decode() and .encodeDecode().
import {Domain} from 'sabre-ngv-app/app/services/impl/encodeDecode/Domain';
// ...
edpublic.decode(Domain.AIRPORT, "KR").then((results) => console.log(results));
// output: (25) ["KRA - KERANG, KERANG AIRPORT, Australia", ..., "KRZ - KIRI, KIRI AIRPORT, The Democratic Republic Of Congo"]
edpublic.encode(Domain.AIRPORT, "KR").then((results) => console.log(results));
// output: (18) ["KBI - KRIBI, KRIBI AIRPORT, Cameroon", ..., "XYN - KRISTINEHAMN, KRISTINEHAMN RAILWAY STATION, Sweden"]
edpublic.encodeDecode(Domain.AIRPORT, "KR").then((results) => console.log(results));
// output: (44) ["KRA - KERANG, KERANG AIRPORT, Australia", ..., "PDV - PLOVDIV, KRUMOVO AIRPORT, Bulgaria"]
Note that .encodeDecode()
matches given string also inside code or name.