Wiki.js GraphQL:创建页面示例
Wiki.js GraphQL: create page example
我是 GraphQL 的新手,我不知道如何为 Wiki.js 编写 PageMutation
create
调用。 public docs 上提供了他们的 GraphQL playground。创建的架构是:
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 文档页面中,他们说突变参数应该声明为 input,但这个不是。另外,我没有看到这种结构(object in object?)的描述,我也不知道如何使用它。
欢迎提示。
谢谢
所以这里是一个没有变量的页面创建示例,只有 mutation 本身:
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"
}
我是 GraphQL 的新手,我不知道如何为 Wiki.js 编写 PageMutation
create
调用。 public docs 上提供了他们的 GraphQL playground。创建的架构是:
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 文档页面中,他们说突变参数应该声明为 input,但这个不是。另外,我没有看到这种结构(object in object?)的描述,我也不知道如何使用它。
欢迎提示。 谢谢
所以这里是一个没有变量的页面创建示例,只有 mutation 本身:
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"
}