Skip to content

Instantly share code, notes, and snippets.

@steveluscher
Last active June 22, 2018 08:05
Show Gist options
  • Save steveluscher/6beca90f058ded646cd37f3a03d2686c to your computer and use it in GitHub Desktop.
Save steveluscher/6beca90f058ded646cd37f3a03d2686c to your computer and use it in GitHub Desktop.

Revisions

  1. steveluscher revised this gist Apr 26, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion realworld.graphql
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    type Article {
    author: Profile!
    body: String!
    comments: CommentsConnection
    comments(first: Int, after: String): CommentsConnection
    createdAt: String!
    description: String!
    favorited: Boolean!
    @@ -37,6 +37,7 @@ type CommentEdge {
    }

    type CommentsConnection {
    count: Int!
    edges: [CommentEdge]
    pageInfo: PageInfo!
    }
    @@ -53,7 +54,10 @@ type PageInfo {
    }

    type Profile {
    articles(first: Int, after: String): ArticlesConnection
    bio: String!
    comments(first: Int, after: String): CommentsConnection
    favorites(first: Int, after: String): ArticlesConnection
    following: Boolean!
    image: String
    user: User!
  2. steveluscher created this gist Apr 26, 2017.
    123 changes: 123 additions & 0 deletions realworld.graphql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,123 @@
    type Article {
    author: Profile!
    body: String!
    comments: CommentsConnection
    createdAt: String!
    description: String!
    favorited: Boolean!
    favoritesCount: Int!
    slug: String!
    tags: [String],
    title: String!
    updatedAt: String!
    }

    type ArticleEdge {
    cursor: String!
    node: Article
    }

    type ArticlesConnection {
    count: Int!
    edges: [ArticleEdge]
    pageInfo: PageInfo!
    }

    type Comment {
    author: Profile!
    article: Article!
    body: String!
    createdAt: String!
    updatedAt: String!
    }

    type CommentEdge {
    cursor: String!
    node: Comment
    }

    type CommentsConnection {
    edges: [CommentEdge]
    pageInfo: PageInfo!
    }

    type DeletionStatus {
    success: Boolean!
    }

    type PageInfo {
    endCursor: String
    hasNextPage: Boolean!
    hasPreviousPage: Boolean!
    startCursor: String
    }

    type Profile {
    bio: String!
    following: Boolean!
    image: String
    user: User!
    }

    type User {
    email: String!
    profile: Profile!
    token: String!
    username: String!
    }

    # Input types.
    input ArticleChanges {
    body: String
    description: String
    title: String
    }

    input ArticleInput {
    body: String!
    description: String!
    tags: [String]
    title: String!
    }

    input UserChanges {
    bio: String
    email: String
    image: String
    password: String
    username: String
    }

    # Build the schema.
    type Query {
    article(slug: String!): Article
    articles(
    first: Int,
    after: String,
    authoredBy: String
    favoritedBy: String
    withTag: String
    ): ArticlesConnection
    currentUser: User
    feed(first: Int, after: String): ArticlesConnection
    profile(username: String!): Profile
    tags: [String]
    }

    type Mutation {
    addComment(slug: String!, body: String!): Comment
    authenticate(password: String!, email: String!): User
    createArticle(input: ArticleInput!)
    deleteArticle(slug: String!): DeletionStatus
    deleteComment(id: ID!): DeletionStatus
    favoriteArticle(slug: String!): Article
    followUser(username: String!): Profile
    unfollowUser(username: String!): Profile
    updateArticle(changes: ArticleChanges!): Article
    updateUser(changes: UserChanges!): User
    }

    schema {
    query: Query
    mutation: Mutation
    }