真的假的 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]
  replyRequests: [ReplyRequest]
  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 CreateOrUpdateReplyRequestFeedbackResult {
  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

  """Use with userId to show only articles from a specific user."""
  appId: String

  """Use with appId to show only articles from a specific user."""
  userId: String

  """
  
              Specify an articleId here to show only articles from the sender of that specified article.
              When specified, it overrides the settings of appId and userId.
            
  """
  fromUserOfArticleId: String
}

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!

    """
    The reason why the user want to submit this article. Mandatory for 1st sender
    """
    reason: String
  ): 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!

    """The reason why the user want to submit this article"""
    reason: String
  ): CreateReplyRequestResult

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

  """Create or update a feedback on a reply request reason"""
  CreateOrUpdateReplyRequestFeedback(replyRequestId: String!, vote: FeedbackVote!): CreateOrUpdateReplyRequestFeedbackResult

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

  """Change attribute of a user"""
  UpdateUser(name: String!): User
}

type MutationResult {
  id: String
}

"""Information of a user's point. Only available for current user."""
type PointInfo {
  """Points earned by the current user"""
  total: Int

  """Points required for current level"""
  currentLevel: Int

  """Points required for next level. null when there is no next level."""
  nextLevel: Int
}

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
  articleReplies(
    """
    When specified, returns only reply connections with the specified status
    """
    status: ArticleReplyStatusEnum
  ): [ArticleReply]
}

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

type ReplyRequest {
  id: String
  userId: String
  appId: String
  reason: String
  feedbackCount: Int
  positiveFeedbackCount: Int
  negativeFeedbackCount: Int
  createdAt: String
  updatedAt: String
}

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

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

  """Returns only for current user. Returns `null` otherwise."""
  repliedArticleCount: Int
  level: Int

  """Returns only for current user. Returns `null` otherwise."""
  points: PointInfo
  createdAt: String
  updatedAt: String
}