Skip to content

Instantly share code, notes, and snippets.

@Whoaa512
Created April 5, 2018 14:21
Show Gist options
  • Save Whoaa512/7143d918aba16d9b201778897db18681 to your computer and use it in GitHub Desktop.
Save Whoaa512/7143d918aba16d9b201778897db18681 to your computer and use it in GitHub Desktop.
Example of GraphQL files for highlighting
import gql from 'graphql-tag'
import fragments from '~/graphql/fragments'
export default gql`
mutation createAnnotation(
$attrs: AnnotationInput!
) {
createAnnotation(attrs: $attrs) {
...Annotation
threads {
...Thread
owner {
id
}
}
}
}
${fragments.Annotation}
${fragments.Thread}
`
const MetricTypeDefs = `
# Primitive types for conveying geometric data
type Metric {
count: Int!
}
# The input for sendMetrics
input MetricInput {
name: String!
points: [Float!]!
tags: [String!]
# Should be one of ['count', 'gauge', 'rate']
type: String = "gauge"
}
extend type Mutation {
# Send metrics to data dog
sendMetrics(metrics: [MetricInput!]!): Metric!
}
`
export default MetricTypeDefs
mutation sendMetrics($metrics: [MetricInput!]!) {
sendMetrics(metrics: $metrics) {
count
}
}
fragment thread on Thread {
id
comments {
items {
id
author {
id
firstName
lastName
email
}
body
createdAt
deletedAt
editedAt
}
totalCount
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment