真的假的 API server

graphiql & DocsProject HackfoldrAPI server GithubWebsiteLine bot

GraphQL Schema

type Article {
  id: String
  text: String
  createdAt: String
  updatedAt: String
  references: [ArticleReference]

  # Number of normal article replies
  replyCount: Int
  articleReplies(
    # When specified, returns only article replies with the specified status
    status: ArticleReplyStatusEnum
  ): [ArticleReply]
  replyRequestCount: Int
  lastRequestedAt: String

  # If the current user has requested for reply for this article
  requestedForReply: Boolean

  # The user submitted this article
  user: User
  relatedArticles(
    filter: RelatedArticleFilter
    orderBy: [RelatedArticleOrderBy]

    # Returns only first <first> results
    first: Int = 10

    # Specify a cursor, returns results after this cursor. cannot be used with "before".
    after: String

    # Specify a cursor, returns results before this cursor. cannot be used with "after".
    before: String
  ): ArticleConnection
}

type ArticleConnection {
  # The total count of the entire collection, regardless of "before", "after".
  totalCount: Int
  edges: [ArticleConnectionEdges]
  pageInfo: ArticleConnectionPageInfo
}

type ArticleConnectionEdges {
  node: Article
  cursor: String
  score: Float
}

type ArticleConnectionPageInfo {
  # The cursor pointing to the last node of the entire collection, regardless of
  # "before" and "after". Can be used to determine if is in the last page.
  lastCursor: String

  # The cursor pointing to the first node of the entire collection, regardless of
  # "before" and "after". Can be used to determine if is in first page.
  firstCursor: String
}

type ArticleReference {
  createdAt: String
  type: ArticleReferenceTypeEnum
  permalink: String
}

input ArticleReferenceInput {
  type: ArticleReferenceTypeEnum!
  permalink: String
}

# Where this article is collected from.
enum ArticleReferenceTypeEnum {
  # The article is collected from the Internet, with a link to the article available.
  URL

  # The article is collected from conversations in LINE messengers.
  LINE
}

# The linkage between an Article and a Reply
type ArticleReply {
  replyId: String
  reply: Reply
  articleId: String
  article: Article

  # The user who conencted this reply and this article.
  user: User
  canUpdateStatus: Boolean
  feedbackCount: Int
  positiveFeedbackCount: Int
  negativeFeedbackCount: Int
  feedbacks: [ArticleReplyFeedback]
  status: ArticleReplyStatusEnum
  createdAt: String
  updatedAt: String
}

# User feedback to an ArticleReply
type ArticleReplyFeedback {
  user: User
  comment: String

  # One of 1, 0 and -1. Representing upvote, neutral and downvote, respectively
  score: Int
}

enum ArticleReplyStatusEnum {
  NORMAL
  DELETED
}

type CreateOrUpdateArticleReplyFeedbackResult {
  feedbackCount: Int
  positiveFeedbackCount: Int
  negativeFeedbackCount: Int
}

type CreateReplyRequestResult {
  # Reply request count for the given article after creating the reply request
  replyRequestCount: Int
  status: CreateReplyRequstResultStatus
}

enum CreateReplyRequstResultStatus {
  # Successfully inserted a new reply request
  SUCCESS

  # The user has already requested reply for this article
  DUPLICATE
}

enum FeedbackVote {
  UPVOTE
  NEUTRAL
  DOWNVOTE
}

input ListArticleFilter {
  # List only the articles whose number of replies matches the criteria.
  replyCount: ListArticleReplyCountExpr

  # List all articles related to a given string.
  moreLikeThis: ListArticleMoreLikeThisInput

  # List only the articles whose number of replies matches the criteria.
  replyRequestCount: ListArticleReplyRequestCountExpr
}

input ListArticleMoreLikeThisInput {
  # The text string to query.
  like: String
  minimumShouldMatch: String
}

# An entry of orderBy argument. Specifies field name and the sort order. Only one field name is allowd per entry.
input ListArticleOrderBy {
  _score: SortOrderEnum
  updatedAt: SortOrderEnum
  createdAt: SortOrderEnum
  replyRequestCount: SortOrderEnum
  replyCount: SortOrderEnum
  lastRequestedAt: SortOrderEnum
}

input ListArticleReplyCountExpr {
  LT: Int
  GT: Int
  EQ: Int
}

input ListArticleReplyRequestCountExpr {
  LT: Int
  GT: Int
  EQ: Int
}

type ListReplyConnection {
  # The total count of the entire collection, regardless of "before", "after".
  totalCount: Int
  edges: [ListReplyConnectionEdges]
  pageInfo: ListReplyConnectionPageInfo
}

type ListReplyConnectionEdges {
  node: Reply
  cursor: String
  score: Float
}

type ListReplyConnectionPageInfo {
  # The cursor pointing to the last node of the entire collection, regardless of
  # "before" and "after". Can be used to determine if is in the last page.
  lastCursor: String

  # The cursor pointing to the first node of the entire collection, regardless of
  # "before" and "after". Can be used to determine if is in first page.
  firstCursor: String
}

input ListReplyFilter {
  moreLikeThis: ListReplyMoreLikeThisInput

  # List the replies created by the requester themselves
  selfOnly: Boolean

  # List the replies of certain types
  type: ReplyTypeEnum
}

input ListReplyMoreLikeThisInput {
  like: String
  minimumShouldMatch: String
}

# An entry of orderBy argument. Specifies field name and the sort order. Only one field name is allowd per entry.
input ListReplyOrderBy {
  _score: SortOrderEnum
  createdAt: SortOrderEnum
}

type Mutation {
  # Create an article and/or a replyRequest
  CreateArticle(text: String!, reference: ArticleReferenceInput!): MutationResult

  # Create a reply that replies to the specified article.
  CreateReply(articleId: String!, text: String!, type: ReplyTypeEnum!, reference: String): MutationResult

  # Connects specified reply and specified article.
  CreateArticleReply(articleId: String!, replyId: String!): [ArticleReply]

  # Create a reply request for the given article
  CreateReplyRequest(articleId: String!): CreateReplyRequestResult

  # Create or update a feedback on an article-reply connection
  CreateOrUpdateArticleReplyFeedback(articleId: String!, replyId: String!, vote: FeedbackVote!): CreateOrUpdateArticleReplyFeedbackResult

  # Change status of specified articleReplies
  UpdateArticleReplyStatus(articleId: String!, replyId: String!, status: ArticleReplyStatusEnum!): [ArticleReply]
}

type MutationResult {
  id: String
}

type Query {
  GetArticle(id: String): Article
  GetReply(id: String): Reply

  #
  #     Gets specified user. If id is not given, returns the currently logged-in user.
  #     Note that some fields like email is not visible to other users.
  #   
  GetUser(id: String): User
  ListArticles(
    filter: ListArticleFilter
    orderBy: [ListArticleOrderBy]

    # Returns only first <first> results
    first: Int = 10

    # Specify a cursor, returns results after this cursor. cannot be used with "before".
    after: String

    # Specify a cursor, returns results before this cursor. cannot be used with "after".
    before: String
  ): ArticleConnection
  ListReplies(
    filter: ListReplyFilter
    orderBy: [ListReplyOrderBy]

    # Returns only first <first> results
    first: Int = 10

    # Specify a cursor, returns results after this cursor. cannot be used with "before".
    after: String

    # Specify a cursor, returns results before this cursor. cannot be used with "after".
    before: String
  ): ListReplyConnection
}

input RelatedArticleFilter {
  replyCount: ReplyCountExpr
}

# An entry of orderBy argument. Specifies field name and the sort order. Only one field name is allowd per entry.
input RelatedArticleOrderBy {
  _score: SortOrderEnum
  updatedAt: SortOrderEnum
}

type Reply {
  id: String

  # The user submitted this reply version
  user: User
  createdAt: String
  text: String
  type: ReplyTypeEnum
  reference: String
  versions(limit: Int): [ReplyVersion] @deprecated(reason: "Don't need 'versions' wrapper now.")
  articleReplies(
    # When specified, returns only reply connections with the specified status
    status: ArticleReplyStatusEnum
  ): [ArticleReply]
}

input ReplyCountExpr {
  LT: Int
  GT: Int
  EQ: Int
}

# Reflects how the replier categories the replied article.
enum ReplyTypeEnum {
  # The replier thinks that the article contains false information.
  RUMOR

  # The replier thinks that the articles contains no false information.
  NOT_RUMOR

  # The replier thinks that the article is actually not a complete article on the internet or passed around in messengers.
  NOT_ARTICLE

  # The replier thinks that the article contains personal viewpoint and is not objective.
  OPINIONATED
}

# Deprecated. Should remove in the future.
type ReplyVersion {
  # The user submitted this reply version
  user: User
  createdAt: String
  text: String
  type: ReplyTypeEnum
  reference: String
}

enum SortOrderEnum {
  ASC
  DESC
}

type User {
  id: String

  # Returns only for current user. Returns `null` otherwise.
  email: String
  name: String
  avatarUrl: String

  # Returns only for current user. Returns `null` otherwise.
  facebookId: String

  # Returns only for current user. Returns `null` otherwise.
  githubId: String

  # Returns only for current user. Returns `null` otherwise.
  twitterId: String
  createdAt: String
}