api - 这在 GrqphQL 预期类型 '[OrderCreationNotificationEnum!] 中是什么意思
问题描述
我有一项服务提供给我使用的 api,他们正在使用 GraphQL。
除了本节之外,其他一切似乎都运行良好。
我正在使用以下查询来创建订单,除了在其中添加通知外,它工作正常
我收到此错误 InputObject 'OrderCreateMutationInput' 上的参数 'notifications' 的值无效({type: {OrderCreationNotificationEnum: {email: true}}})。预期类型“[OrderCreationNotificationEnum!]”
mutation{
orderCreate(input: {
order: {
externalIds:[
{key: "VRPOrderId", value: "abc131"}
]
firstName: "John"
surname: "Doe"
phone: "0405123456"
billingFirstName: "John"
billingSurname: "Doe"
billingEmailAddress: "john@email.com"
address: {
address: "1 Bourke Street"
city: "Melbourne"
country: {
code: "AU"
}
postcode: "3000"
state: {
short: "VIC"
}
}
billingAddress:{
address: "1 Bourke Street"
city: "Melbourne"
country: {
code: "AU"
}
postcode: "3000"
state: {
short: "VIC"
}
}
termsAndConditionsAccepted: true
}
lineItems: [
{
variantId: "VmFyaWFudC00NzMz"
quantity: 1
totalCents: 22500
postageCents: 1000
},
{
variantId: "VmFyaWFudC00NzYy"
quantity: 1
totalCents: 22500
postageCents: 500
}
]
notifications:
{
type: {
OrderCreationNotificationEnum: {
email: true
}
}
}
})
{
order{
id
invoices{
edges{
node{
id
lineItems{
id
quantity
}
}
}
}
}
status
}
}
我正在努力让通知正常工作。我也在为说明添加链接。请帮忙。
解决方案
InputObject 'OrderCreateMutationInput'上的参数 'notifications'是一个Enum:
enum OrderCreationNotificationEnum {
# Notify the order information via Email
EMAIL
# Notify the order information via SMS
SMS
}
对于通知,您应该指定一个枚举值数组,如下所示:
notifications: [EMAIL, SMS]
推荐阅读
- reactjs - 为什么 onpress 功能在本机反应中不起作用
- c++ - 使用 SWIG 为 C++ 程序生成插件接口
- javascript - 如何使用 React 遍历图像目录
- c# - C# 中用于套接字标识符的 TCP Socket Server 自定义类
- android - 我可以使用现有应用程序包名称发布新应用程序吗
- android - 制作边框的半径是从内部而不是外部给出的?
- python - Numpy添加给定的行
- shell - jq 具有来自不同来源的多个输入
- android - 使用 android 媒体播放器播放音频文件
- asp.net-mvc - 在表 'XXX' 上引入 FOREIGN KEY 约束 'XYZ_ID' 可能会导致 mvc 核心中出现循环或多个级联路径