Eve Porcello
@eveporcello
eve@moonhighway.com
Query
Response
DSL
Noice!
[
{
"name": "Panorama",
"type": "gondola",
"capacity": 8,
"status": "open",
"manufacturer": "Garaventa",
"built": 2014,
"summer": true,
"night": false,
"elevation_gain": 2800,
"time": "9 minutes",
"hours": "9:00am - 4:00pm",
"updated": "9:45am",
"trails": [
"/class/api/snowtooth/trails/ocean-breeze",
"/class/api/snowtooth/trails/songstress",
"/class/api/snowtooth/trails/hemmed-slacks",
"/class/api/snowtooth/trails/sandys"
]
}
]
{
"name": "Ocean Breeze",
"lift": [
"/class/api/snowtooth/lifts/panorama"
],
"difficulty": "intermediate",
"status": "open",
"groomed": false,
"snowmaking": false,
"trees": true,
"night": true
}
{
"name": "Hemmed Slacks",
"lift": [
"/class/api/snowtooth/lifts/panorama"
],
"difficulty": "intermediate",
"status": "open",
"groomed": false,
"snowmaking": false,
"trees": true,
"night": false
}
{
"name": "Songstress",
"lift": [
"/class/api/snowtooth/lifts/panorama"
],
"difficulty": "expert",
"status": "closed",
"groomed": false,
"snowmaking": false,
"trees": true,
"night": false
}
{
"name": "Sandys",
"lift": [
"/class/api/snowtooth/lifts/astra-express",
"/class/api/snowtooth/lifts/panorama"
],
"difficulty": "intermediate",
"status": "open",
"groomed": false,
"snowmaking": false,
"trees": false,
"night": false
}
/lifts/panorama
/trails/ocean-breeze
/trails/songstress
/trails/hemmed-slacks
/trails/sandys
query {
lift(name:"Panorama") {
status
trails {
name
status
}
}
}
{
"data":{
"lift":{
"status":"hold",
"trails": [
{
"name": "Hot Potato",
"status": "open"
},
{
"name": "West Elm",
"status": "closed"
}
]
}
}
}
POST /graphql
Query
https://skiresort.com/graphql
[
{
"name": "Panorama",
"type": "gondola",
"capacity": 8,
"status": "open",
"manufacturer": "Garaventa",
"built": 2014,
"summer": true,
"night": false,
"elevation_gain": 2800,
"time": "9 minutes",
"hours": "9:00am - 4:00pm",
"updated": "9:45am",
"trails": [
"/class/api/snowtooth/trails/ocean-breeze",
"/class/api/snowtooth/trails/songstress",
"/class/api/snowtooth/trails/hemmed-slacks",
"/class/api/snowtooth/trails/sandys"
]
}
]
PUT
-H 'Content-Type: application/json'
-d { "status": "open" }
mutation {
setLiftStatus(
name:"Panorama",
newStatus: "hold"
) {
name
newStatus
oldStatus
}
}
{
"data": {
"setLiftStatus": {
"name": "Panorama",
"newStatus": "hold",
"oldStatus": "open"
}
}
}
POST /graphql
Mutation
Query
Response
Query
Response
fn( )
fn( )
fn( )
fn( )
fn( )
fn( )
id: ID!
name: String!
type Photo {
id: ID!
name: String!
url: String!
description: String
rating: Float
private: Boolean!
}
name: String!
description: String
type Query {
totalUsers: Int!
}
type User {
postedPhotos: [Photo!]!
}
photos: [Photo]
photos: [Photo]!
photos: [Photo!]!
Nullable list of nullable values
Non-nullable list of nullable values
Non-nullable list of non-nullable values
enum PhotoCategory {
PORTRAIT
ACTION
LANDSCAPE
}
type Photo {
postedBy: User!
}
type User {
postedPhotos: [Photo!]!
}
type Student {
schedule: [Course!]!
}
type Course {
students: [Student!]!
}
type Mutation {
postPhoto: Boolean!
}
type Mutation {
postPhoto (name: String!): Photo!
}
input PostPhotoInput {
name: String!
category: PhotoCategory=PORTRAIT
description: String
}
mutation addPhoto ($input: PostPhotoInput!) {
postPhoto(input: $input) {
id
name
url
}
}
{
"input": {
"name": "Desert Sunset",
"description": "Sunset over Sedona",
"category": "LANDSCAPE"
}
}
Query Variables
type Subscription {
newPhoto: Photo!
}
scalar DateTime
type Photo {
created: DateTime!
updated: DateTime!
}