gpt4 book ai didi

api - Wiki.js GraphQL : create page example

转载 作者:行者123 更新时间:2023-12-04 08:45:10 26 4
gpt4 key购买 nike

我是 GraphQL 的新手,我不明白如何编写 PageMutation create调用 Wiki.js。他们的 GraphQL 游乐场可在 public docs 上找到.创建模式是:

type PageMutation {
create(
content: String!
description: String!
editor: String!
isPublished: Boolean!
isPrivate: Boolean!
locale: String!
path: String!
publishEndDate: Date
publishStartDate: Date
scriptCss: String
scriptJs: String
tags: [String]!
title: String!
): PageResponse
在 GraphQL 文档页面中,他们说变异参数应该声明为输入参数,但这个不是。另外,我没有看到这种结构的描述(对象中的对象?),我不知道如何使用它。
欢迎提示。
谢谢

最佳答案

所以这是一个没有变量的页面创建的例子,只是突变本身:

mutation Page {
pages {
create (content:"contenuto", description:"descrizione", editor: "code", isPublished: true, isPrivate: false, locale: "it", path:"/", tags: ["tag1", "tag2"], title:"titolo") {
responseResult {
succeeded,
errorCode,
slug,
message
},
page {
id,
path,
title
}
}
}
}
详情 GraphQL docs .
这是一个带有变量的示例:
mutation Page ($content: String!, $descrizione: String!, $editor:String!, $isPublished:Boolean!, $isPrivate:Boolean!, $locale:String!, $path:String!,$tags:[String]!, $title:String!) {
pages {
create (content:$content, description:$descrizione, editor: $editor, isPublished: $isPublished, isPrivate: $isPrivate, locale: $locale, path:$path, tags: $tags, title:$title) {
responseResult {
succeeded,
errorCode,
slug,
message
},
page {
id,
path,
title
}
}
}
}
查询变量:
{
"content": "contenuto",
"descrizione":"descrizione",
"editor": "code",
"isPublished": true,
"isPrivate": false,
"locale": "it",
"path":"/pagina01",
"tags": ["tag1", "tag2"],
"title":"titolo"
}

关于api - Wiki.js GraphQL : create page example,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64362134/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com