查询插件数据MasterStudy LMS
MasterStudy LMS
与 MasterStudy LMS 插件数据交互的 Query 示例。
获取 LMS 数据
此 Query 获取指定课程的标题和内容:
query GetCourse($courseId: ID!) {
course: customPost(by: { id: $courseId }, customPostTypes: "stm-courses") {
id
title
content
}
}更新 LMS 数据
此 Query 更新指定课程的标题和内容:
mutation UpdateCourse(
$courseId: ID!
$title: String!
$content: String!
) {
updateCustomPost(input: {
id: $courseId,
customPostType: "stm-courses"
title: $title
contentAs: {
html: $content
}
}) {
status
errors {
__typename
...on ErrorPayload {
message
}
}
customPost {
__typename
...on CustomPost {
id
title
content
}
}
}
}