플러그인 데이터 쿼리
플러그인 데이터 쿼리MasterStudy LMS

MasterStudy LMS

MasterStudy LMS 플러그인의 데이터를 다루는 쿼리 예시입니다.

LMS 데이터 가져오기

이 쿼리는 지정된 강좌의 제목과 콘텐츠를 가져옵니다:

query GetCourse($courseId: ID!) {
  course: customPost(by: { id: $courseId }, customPostTypes: "stm-courses") {
    id
    title
    content
  }
}

LMS 데이터 업데이트

이 쿼리는 지정된 강좌의 제목과 콘텐츠를 업데이트합니다:

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
      }
    }
  }
}