thunder/thunder_gqls

Thunder 的 GraphQL Schema。

安装次数: 1,272

依赖项: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 0

开放问题: 2

类型:drupal-module

1.0.0-beta8 2021-11-22 14:11 UTC

README

在 Thunder 安装程序的模块文件夹中

git clone git@github.com:thunder/thunder_gqls.git
drush en thunder_gqls

您可以通过启用 thunder_demo 模块来获得一些文章进行操作。

  • 在浏览器中打开 admin/config/graphql,点击 "创建服务器"
  • 选择一个标签和您喜欢的自定义端点。
  • 选择 "可组合的 schema" 作为 schema 并启用扩展
  • 点击 "保存" 按钮

回到 admin/config/graphql,从下拉按钮中选择 "探索者"。

如果一切正常,您应该能够在探索者中测试一些查询。对于示例查询,您需要添加查询变量 {"path": "/your-path"}

示例

query ($path: String!) {
  metatags(path: $path) {
    tag
    attributes
  }
  mainMenu: menu(id: "main" path: $path) {
    name
    id
    items {
      title
      url
      inActiveTrail
      children {
        title
        url
        inActiveTrail
      }
    }
  }
  footerMenu: menu(id: "footer" path: $path) {
    name
    id
    items {
      title
      url
      inActiveTrail
      children {
        title
        url
        inActiveTrail
      }
    }
  }
  page(path: $path) {
    uuid
    url
    name
    ... on User {
      mail
    }
    ... on Channel {
      articles(offset: 0 limit: 2) {
        total
        items {
          name
          url
        }
      }
      content {
        __typename
      }
    }
    ... on Article {
      id
      url
      seoTitle
      language
      author {
        id
        name
        mail
        __typename
      }
      channel {
        url
        name
      }
      teaser {
        image {
          src
          published
          fallbackMedia {
            src
          }
        }
      }
      content {
        __typename
        ... on ParagraphPinterest {
          url
        }
        ... on ParagraphText {
          text
        }
        ... on ParagraphGallery {
          images {
            src
          }
        }
        ... on ParagraphImage {
          image {
            src
            width
            title
            alt
            name
            tags {
              name
            }
            derivative(style: "medium") {
              src
              width
            }
            focalPoint {
              x
              y
            }
          }
        }
        ... on ParagraphLink {
          links {
            url
            title
          }
        }
      }
    }
  }
}