真的假的 API server

graphiql & DocsProject HackfoldrAPI server GithubWebsiteLine bot

GraphQL Schema

type Article {
  id: String
  text: String
  createdAt: String
  updatedAt: String
  references: [ArticleReference]
  replyCount: Int
  replyConnections(
    # When specified, returns only reply connections with the specified status
    status: ReplyConnectionStatusEnum
  ): [ReplyConnection]
  replyRequestCount: Int

  # 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
}

# A document that is crawled from selected myth-busting websites
type CrawledDoc {
  rumor: String
  answer: String
  url: String
}

type CreateOrUpdateReplyConnectionFeedbackResult {
  feedbackCount: Int
}

type CreateReplyRequestResult {
  replyRequestCount: Int
}

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
}

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
  versionCount: 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.`ReplyConnections` and `ReplyVersions` are created automatically.
  CreateReply(articleId: String!, text: String!, type: ReplyTypeEnum!, reference: String): MutationResult

  # Connects specified reply and specified article.
  CreateReplyConnection(articleId: String!, replyId: String!): MutationResult

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

  # Create or update a feedback on an article-reply connection
  CreateOrUpdateReplyConnectionFeedback(
    replyConnectionId: String!
    vote: FeedbackVote!

    # Optional text comment explaining why vote like this
    comment: String
  ): CreateOrUpdateReplyConnectionFeedbackResult

  # Remove sspecified reply from specified article.
  UpdateReplyConnectionStatus(replyConnectionId: String!, status: ReplyConnectionStatusEnum!): MutationResult
}

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
  SearchArticles(
    text: String
    filter: SearchArticleFilter
    orderBy: [SearchArticleOrderBy]

    # 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 @deprecated(reason: "Prefer ListArticle with moreLikeThis filter.")
  SearchReplies(
    text: String
    orderBy: [SearchReplyOrderBy]

    # 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
  ): SearchReplyConnection @deprecated(reason: "Prefer ListReplies with moreLikeThis filter.")

  # Search for crawled doc in rumor-search.g0v.ronny.tw
  SearchCrawledDocs(text: String): SearchCrawledDocConnection
}

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
  versions(limit: Int): [ReplyVersion]
  replyConnections(
    # When specified, returns only reply connections with the specified status
    status: ReplyConnectionStatusEnum
  ): [ReplyConnection]
}

# The linkage between an Article and a Reply
type ReplyConnection {
  reply: Reply
  article: Article
  id: String

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

# User feedback to a ReplyConnection
type ReplyConnectionFeedback {
  user: User
  comment: String

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

enum ReplyConnectionStatusEnum {
  NORMAL
  DELETED
}

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
}

type ReplyVersion {
  # The user submitted this reply version
  user: User
  createdAt: String
  text: String
  type: ReplyTypeEnum
  reference: String
}

input SearchArticleFilter {
  replyCount: SearchArticleReplyCountExpr
}

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

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

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

type SearchCrawledDocConnectionEdges {
  node: CrawledDoc
  cursor: String
  score: Float
}

type SearchCrawledDocConnectionPageInfo {
  # 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 SearchReplyConnection {
  # The total count of the entire collection, regardless of "before", "after".
  totalCount: Int
  edges: [SearchReplyConnectionEdges]
  pageInfo: SearchReplyConnectionPageInfo
}

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

type SearchReplyConnectionPageInfo {
  # 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
}

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

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
}