GraphQL
=======
Usage
-----
`Protocol `_.
.. code::
GET /core/graphql?query=...
GET /res/graphql?query=...
POST /core/graphql
IDE
---
.. code::
GET /core/graphiql
Schema
------
.. code::
type Query {
ads: Ads
analytics: Analytics
posts(filters: PostsFilters, slice: PostsSlice): [Post]
authors(filters: AuthorsFilters, slice: AuthorsSlice): [Author]
sections(filters: SectionsFilters): [Section]
}
input PostsFilters {
includedIds: [Int]
excludedIds: [Int]
includedStatuses: [PostStatus]
excludedStatuses: [PostStatus]
includedSections: [Int]
excludedSections: [Int]
includedAuthors: [Int]
excludedAuthors: [Int]
includedTags: [String]
excludedTags: [String]
}
enum PostStatus {
PUBLISHED
}
input PostsSlice {
order: PostsOrder
limit: Int
allowDuplicates: Boolean # doesn't work yet
}
enum PostsOrder {
RATING
RECENCY
}
interface Particle {
pages: PageMap!
title: String
subtitle: String
linkOut: LinkOut
image: Image
video: Video
breadcrumbTitle: String
}
type Post implements Particle {
id: Int
content: ContentTree
authors: [Author]
primarySections: [Section]
regularSections: [Section]
primaryTags: [Tag]
regularTags: [Tag]
publishedAt: Int
}
input AuthorsSlice {
order: AuthorsOrder
limit: Int
}
enum AuthorsOrder {
TITLE
RATING
}
input AuthorsFilter {
includedIds: [Int]!
}
type Author implements Particle {
id: Int
}
input SectionsFilters {
includedIds: [Int]!
excludedIds: [Int]!
includedPaths: [String]!
excludedPaths: [String]!
includedStatuses: [SectionStatus]!
excludedStatuses: [SectionStatus]!
}
type Section implements Particle {
id: Int
slug: String
path: String
status: SectionStatus
}
enum SectionStatus {
PUBLIC
PRIVATE
UNLISTED
}
type Tag {
id: String
slug: String
pages: PageMap
title: String
}
type ContentTree {
rootRef: String
tree: [ContentNode]
}
interface ContentNode {
ref: String
parentRef: String!
}
type GroupContentNode implements ContentNode {
layout: ContentLayout
adsOrder: [Int]!
}
interface ContentLayout {
kind: ContentLayoutKind
}
enum ContentLayoutKind {
PLAIN
LISTICLE
SLIDESHOW
}
type PlainContentLayout implements ContentLayout {
}
type ListicleContentLayout implements ContentLayout {
flags: [ListicleContentLayoutFlag]
numeration: Numeration!
}
enum ListicleContentLayoutFlag {
ECOMMERCE
MULTICOLUMN
}
type SlideshowContentLayout implements ContentLayout {
flags: [SlideshowContentLayoutFlag]
numeration: Numeration!
}
enum SlideshowContentLayoutFlag {
COUNTER
PARALLAX
FULLSCREEN
THUMBNAILS
}
type Numeration {
order: NumerationOrder
}
enum NumerationOrder {
ASCENDING
DESCENDING
}
type ParticleContentNode implements Particle, ContentNode {
id: Int!
}
type MediaContentNode implements ContentNode {
kind: MediaContentKind
code: String
html(device: Device): String
}
enum MediaContentKind {
TEXT
IMAGE
}
type Ads {
head: PlainAd
body: List[BodyAd]!
listicle: List[ListicleAd]!
slideshow: List[SlideshowAd]!
beforeListicle: List[PlainAd]!
}
interface Ad {
template(device: Device): String
isEnabled: Boolean
}
type PlainAd implements Ad {}
type BodyAd implements Ad {
wordsCount: Int
}
type ListicleAd implements Ad {
order: List[Int]
title: String!
}
type SlideshowAd implements Ad {
order: List[Int]
}
type Analytics {
adobe: AdobeAnalytics
google(rm: Boolean = false): GoogleAnalytics
nielsen: NielsenAnalytics
parsely: ParselyAnalytics
comscore: ComscoreAnalytics
omniture: OmnitureAnalytics
chartbeat: ChartbeatAnalytics
}
interface AnalyticsConfig {
accountId: String!
linkers: JSONString
}
type AdobeAnalytics implements AnalyticsConfig {
host: String!
script: String!
}
type GoogleAnalytics implements AnalyticsConfig {
dimensions: JSONString
}
type NielsenAnalytics implements AnalyticsConfig {
}
type ParselyAnalytics implements AnalyticsConfig {
}
type ComscoreAnalytics implements AnalyticsConfig {
}
type OmnitureAnalytics implements AnalyticsConfig {
suiteId: String
}
type ChartbeatAnalytics implements AnalyticsConfig {
useNakedDomain: Boolean!
}
enum Device {
AMP
}
type Video {
href: String
}
type Image {
id: Int
crops(sizes: List[String]!): [ImageCrop]
flags: [ImageFlag]
title: String!
credit: String!
altText: String!
}
type ImageCrop {
size: String
href: String
}
type ImageFlag {
ANIMATED
GIF
}
type LinkOut {
pages: PageMap
target: String
}
type PageMap {
web: Page
amp: Page
}
type Page {
href: String
}
Examples
--------
* `Posts `_
* `Posts and authors `_
* `Debugging `_
* `Interactive IDE `_
Ideas
-----
* https://github.com/hasura/sphinx-graphiql