Skip to content

Instantly share code, notes, and snippets.

@littleboycoding
Created January 10, 2021 12:32
Show Gist options
  • Save littleboycoding/33a77e24921cdc750c2cef6a6c7af882 to your computer and use it in GitHub Desktop.
Save littleboycoding/33a77e24921cdc750c2cef6a6c7af882 to your computer and use it in GitHub Desktop.
directive @cacheControl(maxAge: Int, scope: CacheControlScope) on FIELD_DEFINITION | OBJECT | INTERFACE
"""
Direct the client to resolve this field locally, either from the cache or local resolvers.
"""
directive @client(
"""
When true, the client will never use the cache for this value. See
https://www.apollographql.com/docs/react/essentials/local-state/#forcing-resolvers-with-clientalways-true
"""
always: Boolean
) on FIELD | FRAGMENT_DEFINITION | INLINE_FRAGMENT
"""
Export this locally resolved field as a variable to be used in the remainder of this query. See
https://www.apollographql.com/docs/react/essentials/local-state/#using-client-fields-as-variables
"""
directive @export(
"""The variable name to export this field as."""
as: String!
) on FIELD
"""
Specify a custom store key for this result. See
https://www.apollographql.com/docs/react/advanced/caching/#the-connection-directive
"""
directive @connection(
"""Specify the store key."""
key: String!
"""
An array of query argument names to include in the generated custom store key.
"""
filter: [String!]
) on FIELD
type Query {
getLetters(cursor: ID, limit: Int = 10, hashtag: String): Letters!
getLetter(id: ID!): Letter!
getPaperPlane: Letter!
}
type Comments {
cursor: ID
limit: Int!
hasMore: Boolean!
letterId: ID!
comments: [Comment!]!
}
type Comment {
id: ID!
letterId: ID!
content: String!
commenter: String!
date: Float!
}
type Letters {
cursor: ID
limit: Int!
hasMore: Boolean!
hashtag: String
letters: [Letter!]!
}
type Letter {
id: ID!
content: String!
writer: String!
date: Float!
hashtags: [String!]!
method: String!
read: Boolean
getComments(cursor: ID, limit: Int = 5): Comments!
}
type Mutation {
writeLetter(content: String!, writer: String!, method: String!): Letter!
writeComment(letterId: ID!, content: String!, commenter: String!): Comment!
}
enum CacheControlScope {
PUBLIC
PRIVATE
}
"""The `Upload` scalar type represents a file upload."""
scalar Upload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment