node.js - 使用节点 js 和 graphql 使用运营商代码过滤 amadeus 航班优惠
问题描述
我必须使用过滤 flightOfferorigin, destination, departureDate, carrier
但是在将运营商添加到参数时出现此错误消息
Some of the parameters were not recognized. Please check your query.
如何通过将运营商传递给 amadeus 查询来过滤结果?
查询
import * as Sentry from '@sentry/node';
import amadeus from './../../../../amadeus';
export default async (parent, args, context, info) => {
try {
const { result } = await amadeus.shopping.flightOffers.get({
origin: args.filter.origin,
destination: args.filter.destination,
departureDate: args.filter.departureDate,
carrier: args.filter.carrier
});
context.dictionaries =await result.dictionaries;
return result.data;
} catch (error) {
console.log(error);
Sentry.captureException(error);
return [];
}
};
解决方案
通过查看您的代码,不清楚您使用的是Flight Low-fare Search API还是Flight Offers Search API。
在任何情况下,这 2 个 API 都没有运营商参数。如果要按航空公司过滤,可以使用:
航班低价搜索:
- includeAirlines:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludeAirlines:要排除的航空公司 IATA 代码列表,以逗号分隔
航班优惠搜索:
- IncludedAirlineCodes:要包含的航空公司 IATA 代码列表,以逗号分隔
- excludeAirlineCodes:要排除的航空公司 IATA 代码列表,以逗号分隔
推荐阅读
- r - 如何将函数应用于 r 中 data.table 中过滤数据的特定部分
- javascript - 具有 HTML 元素属性/属性的 LitElement Dot
- python - 在python中创建列表而不提及它?
- python - 取方形脉冲下的面积
- algorithm - 如何生成谜题来“破解密码”?
- xaml - 删除返回按钮页面 xamarin xaml
- tsql - T-sql 连接变量以在 Insert Into while 循环中使用
- python - 合并熊猫数据框行以创建范围?
- vue.js - 如何在 vuejs vuex 中将参数从方法传递到操作
- nativescript - 使用 routerExtension.back() 返回 TabView 时链接被禁用 - NativeScript