MyBoom GraphQL API Reference

本網站為 MyBoom 交友平台後端服務的 GraphQL API 規格文檔,包含 App 端及網站管理後台端需要的 API 接口。

若你看不懂本文檔或是不知道如何使用,請參考以下連結:

  1. GraphQL 官方教學 https://graphql.org/learn/
  2. Apollo 官方教學 https://www.apollographql.com/docs/react/
Contact

若串接過程中遇到任何問題,請加 Line 聯繫 - varedx20001207

API Endpoints
https://api.myboom.tw/graphql
Headers
Authorization: Bearer <YOUR_TOKEN_HERE>

Queries

admins

Description

管理員列表

Response

Returns an AdminConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10
keyword - String

Example

Query
query admins(
  $skip: Int,
  $limit: Int,
  $keyword: String
) {
  admins(
    skip: $skip,
    limit: $limit,
    keyword: $keyword
  ) {
    edges {
      ...AdminEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "skip": 0,
  "limit": 10,
  "keyword": "abc123"
}
Response
{
  "data": {
    "admins": {
      "edges": [AdminEdge],
      "pageInfo": PageInfo
    }
  }
}

categories

Response

Returns a CategoryConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10

Example

Query
query categories(
  $skip: Int,
  $limit: Int
) {
  categories(
    skip: $skip,
    limit: $limit
  ) {
    edges {
      ...CategoryEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{"skip": 0, "limit": 10}
Response
{
  "data": {
    "categories": {
      "edges": [CategoryEdge],
      "pageInfo": PageInfo
    }
  }
}

comments

Response

Returns a CommentConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10
topicId - String
authorId - String

Example

Query
query comments(
  $skip: Int,
  $limit: Int,
  $topicId: String,
  $authorId: String
) {
  comments(
    skip: $skip,
    limit: $limit,
    topicId: $topicId,
    authorId: $authorId
  ) {
    edges {
      ...CommentEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "skip": 0,
  "limit": 10,
  "topicId": "xyz789",
  "authorId": "xyz789"
}
Response
{
  "data": {
    "comments": {
      "edges": [CommentEdge],
      "pageInfo": PageInfo
    }
  }
}

hotKeywords

Description

熱門搜尋關鍵字

Response

Returns [String!]!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10

Example

Query
query hotKeywords(
  $skip: Int,
  $limit: Int
) {
  hotKeywords(
    skip: $skip,
    limit: $limit
  )
}
Variables
{"skip": 0, "limit": 10}
Response
{"data": {"hotKeywords": ["abc123"]}}

notificationTasks

Description

管理員從後台手動發出(或還未發出)的推播通知

Response

Returns a NotificationTaskConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10
isSent - Boolean

Example

Query
query notificationTasks(
  $skip: Int,
  $limit: Int,
  $isSent: Boolean
) {
  notificationTasks(
    skip: $skip,
    limit: $limit,
    isSent: $isSent
  ) {
    edges {
      ...NotificationTaskEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{"skip": 0, "limit": 10, "isSent": false}
Response
{
  "data": {
    "notificationTasks": {
      "edges": [NotificationTaskEdge],
      "pageInfo": PageInfo
    }
  }
}

notifications

Response

Returns a NotificationConnection!

Arguments
Name Description
receiverId - String!
skip - Int Default = 0
limit - Int Default = 10

Example

Query
query notifications(
  $receiverId: String!,
  $skip: Int,
  $limit: Int
) {
  notifications(
    receiverId: $receiverId,
    skip: $skip,
    limit: $limit
  ) {
    edges {
      ...NotificationEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "receiverId": "abc123",
  "skip": 0,
  "limit": 10
}
Response
{
  "data": {
    "notifications": {
      "edges": [NotificationEdge],
      "pageInfo": PageInfo
    }
  }
}

topic

Response

Returns a Topic!

Arguments
Name Description
id - String!

Example

Query
query topic($id: String!) {
  topic(id: $id) {
    id
    title
    author {
      ...UserFragment
    }
    category {
      ...CategoryFragment
    }
    options {
      ...OptionFragment
    }
    isVoted
    voteCount
    isSaved
    createdAt
    comments {
      ...CommentConnectionFragment
    }
    isWatching
  }
}
Variables
{"id": "abc123"}
Response
{
  "data": {
    "topic": {
      "id": "507f1f77bcf86cd799439011",
      "title": "abc123",
      "author": User,
      "category": Category,
      "options": [Option],
      "isVoted": true,
      "voteCount": 27,
      "isSaved": true,
      "createdAt": "2020-01-01T00:00:00.000Z",
      "comments": CommentConnection,
      "isWatching": false
    }
  }
}

topics

Response

Returns a TopicConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10
authorId - String
isVoted - Boolean
isSaved - Boolean
keyword - String
categoryId - String

Example

Query
query topics(
  $skip: Int,
  $limit: Int,
  $authorId: String,
  $isVoted: Boolean,
  $isSaved: Boolean,
  $keyword: String,
  $categoryId: String
) {
  topics(
    skip: $skip,
    limit: $limit,
    authorId: $authorId,
    isVoted: $isVoted,
    isSaved: $isSaved,
    keyword: $keyword,
    categoryId: $categoryId
  ) {
    edges {
      ...TopicEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "skip": 0,
  "limit": 10,
  "authorId": "abc123",
  "isVoted": true,
  "isSaved": true,
  "keyword": "xyz789",
  "categoryId": "abc123"
}
Response
{
  "data": {
    "topics": {
      "edges": [TopicEdge],
      "pageInfo": PageInfo
    }
  }
}

user

Response

Returns a User!

Arguments
Name Description
id - String!

Example

Query
query user($id: String!) {
  user(id: $id) {
    id
    name
    avatarUrl
    email
    registeredAt
    topicCount
    commentedCount
    commentCount
    savedCount
    votedCount
    followerCount
    followingCount
    appleIdentifier
    googleIdentifier
    facebookIdentifier
    lineIdentifier
    isFollowing
    watchingTopicIDs
    notificationSettings {
      ...UserNotificationSettingsFragment
    }
  }
}
Variables
{"id": "abc123"}
Response
{
  "data": {
    "user": {
      "id": "507f1f77bcf86cd799439011",
      "name": "xyz789",
      "avatarUrl": "https://example.com/exmaple",
      "email": "abc123",
      "registeredAt": "2020-01-01T00:00:00.000Z",
      "topicCount": 27,
      "commentedCount": 27,
      "commentCount": 27,
      "savedCount": 27,
      "votedCount": 27,
      "followerCount": 27,
      "followingCount": 27,
      "appleIdentifier": "abc123",
      "googleIdentifier": "abc123",
      "facebookIdentifier": "abc123",
      "lineIdentifier": "abc123",
      "isFollowing": false,
      "watchingTopicIDs": [
        "507f1f77bcf86cd799439011"
      ],
      "notificationSettings": UserNotificationSettings
    }
  }
}

users

Response

Returns a UserConnection!

Arguments
Name Description
skip - Int Default = 0
limit - Int Default = 10
followedBy - String
keyword - String

Example

Query
query users(
  $skip: Int,
  $limit: Int,
  $followedBy: String,
  $keyword: String
) {
  users(
    skip: $skip,
    limit: $limit,
    followedBy: $followedBy,
    keyword: $keyword
  ) {
    edges {
      ...UserEdgeFragment
    }
    pageInfo {
      ...PageInfoFragment
    }
  }
}
Variables
{
  "skip": 0,
  "limit": 10,
  "followedBy": "xyz789",
  "keyword": "abc123"
}
Response
{
  "data": {
    "users": {
      "edges": [UserEdge],
      "pageInfo": PageInfo
    }
  }
}

Mutations

adminSignIn

Description

管理員登入

Response

Returns an AdminLoginResponse!

Arguments
Name Description
username - String!
password - String!

Example

Query
mutation adminSignIn(
  $username: String!,
  $password: String!
) {
  adminSignIn(
    username: $username,
    password: $password
  ) {
    token
    admin {
      ...AdminFragment
    }
  }
}
Variables
{
  "username": "xyz789",
  "password": "abc123"
}
Response
{
  "data": {
    "adminSignIn": {
      "token": "xyz789",
      "admin": Admin
    }
  }
}

cancelNotificationTask

Description

管理員取消已排程的推播通知

Response

Returns a NotificationTask!

Arguments
Name Description
taskID - ID!

Example

Query
mutation cancelNotificationTask($taskID: ID!) {
  cancelNotificationTask(taskID: $taskID) {
    id
    title
    content
    createdAt
    createdBy
    time
    cancelAt
  }
}
Variables
{"taskID": "507f1f77bcf86cd799439011"}
Response
{
  "data": {
    "cancelNotificationTask": {
      "id": "507f1f77bcf86cd799439011",
      "title": "xyz789",
      "content": "abc123",
      "createdAt": "2020-01-01T00:00:00.000Z",
      "createdBy": "507f1f77bcf86cd799439011",
      "time": "abc123",
      "cancelAt": "2020-01-01T00:00:00.000Z"
    }
  }
}

cancelSaveTopic

Description

取消收藏話題

Response

Returns a Boolean!

Arguments
Name Description
topicID - String!

Example

Query
mutation cancelSaveTopic($topicID: String!) {
  cancelSaveTopic(topicID: $topicID)
}
Variables
{"topicID": "xyz789"}
Response
{"data": {"cancelSaveTopic": true}}

createAdmin

Description

新增管理員帳號

Response

Returns an Admin

Arguments
Name Description
username - String!
password - String!
nickname - String!
permissions - [AdminPermission!]!

Example

Query
mutation createAdmin(
  $username: String!,
  $password: String!,
  $nickname: String!,
  $permissions: [AdminPermission!]!
) {
  createAdmin(
    username: $username,
    password: $password,
    nickname: $nickname,
    permissions: $permissions
  ) {
    id
    username
    nickname
    createdAt
    permissions
  }
}
Variables
{
  "username": "abc123",
  "password": "xyz789",
  "nickname": "xyz789",
  "permissions": ["USER_MANAGEMENT"]
}
Response
{
  "data": {
    "createAdmin": {
      "id": "507f1f77bcf86cd799439011",
      "username": "abc123",
      "nickname": "abc123",
      "createdAt": "2020-01-01T00:00:00.000Z",
      "permissions": ["USER_MANAGEMENT"]
    }
  }
}

createCategory

Description

(管理後台)建立話題分類

Response

Returns a Category!

Arguments
Name Description
name - String!
image - Upload!

Example

Query
mutation createCategory(
  $name: String!,
  $image: Upload!
) {
  createCategory(
    name: $name,
    image: $image
  ) {
    id
    name
    imageUrl
    topicCount
    starCount
  }
}
Variables
{
  "name": "abc123",
  "image": "File"
}
Response
{
  "data": {
    "createCategory": {
      "id": "507f1f77bcf86cd799439011",
      "name": "abc123",
      "imageUrl": "https://example.com/exmaple",
      "topicCount": 27,
      "starCount": 27
    }
  }
}

createComment

Description

發表留言

Response

Returns a Comment!

Arguments
Name Description
topicId - String!
content - String!

Example

Query
mutation createComment(
  $topicId: String!,
  $content: String!
) {
  createComment(
    topicId: $topicId,
    content: $content
  ) {
    id
    topic {
      ...TopicFragment
    }
    createdAt
    content
    author {
      ...UserFragment
    }
  }
}
Variables
{
  "topicId": "xyz789",
  "content": "abc123"
}
Response
{
  "data": {
    "createComment": {
      "id": "507f1f77bcf86cd799439011",
      "topic": Topic,
      "createdAt": "2020-01-01T00:00:00.000Z",
      "content": "xyz789",
      "author": User
    }
  }
}

createTopic

Description

建立話題

Response

Returns a Topic!

Arguments
Name Description
title - String!
categoryId - String!
options - [OptionInput!]!

Example

Query
mutation createTopic(
  $title: String!,
  $categoryId: String!,
  $options: [OptionInput!]!
) {
  createTopic(
    title: $title,
    categoryId: $categoryId,
    options: $options
  ) {
    id
    title
    author {
      ...UserFragment
    }
    category {
      ...CategoryFragment
    }
    options {
      ...OptionFragment
    }
    isVoted
    voteCount
    isSaved
    createdAt
    comments {
      ...CommentConnectionFragment
    }
    isWatching
  }
}
Variables
{
  "title": "abc123",
  "categoryId": "abc123",
  "options": [OptionInput]
}
Response
{
  "data": {
    "createTopic": {
      "id": "507f1f77bcf86cd799439011",
      "title": "abc123",
      "author": User,
      "category": Category,
      "options": [Option],
      "isVoted": true,
      "voteCount": 27,
      "isSaved": false,
      "createdAt": "2020-01-01T00:00:00.000Z",
      "comments": CommentConnection,
      "isWatching": false
    }
  }
}

deleteCategory

Description

(管理後台)刪除話題分類

Response

Returns a Boolean!

Arguments
Name Description
id - String!

Example

Query
mutation deleteCategory($id: String!) {
  deleteCategory(id: $id)
}
Variables
{"id": "abc123"}
Response
{"data": {"deleteCategory": false}}

deleteComment

Description

刪除留言

Response

Returns a Boolean!

Arguments
Name Description
commentID - ID!

Example

Query
mutation deleteComment($commentID: ID!) {
  deleteComment(commentID: $commentID)
}
Variables
{"commentID": "507f1f77bcf86cd799439011"}
Response
{"data": {"deleteComment": true}}

deleteTopic

Description

刪除話題

Response

Returns a Boolean!

Arguments
Name Description
topicID - String!

Example

Query
mutation deleteTopic($topicID: String!) {
  deleteTopic(topicID: $topicID)
}
Variables
{"topicID": "xyz789"}
Response
{"data": {"deleteTopic": false}}

followUser

Description

追蹤使用者

Response

Returns a Boolean!

Arguments
Name Description
userID - String!

Example

Query
mutation followUser($userID: String!) {
  followUser(userID: $userID)
}
Variables
{"userID": "abc123"}
Response
{"data": {"followUser": false}}

generateCaptcha

Description

取得 Captcha 驗證碼

Response

Returns a String!

Example

Query
mutation generateCaptcha {
  generateCaptcha
}
Response
{"data": {"generateCaptcha": "xyz789"}}

oauthSignIn

Description

OAuth 註冊或登入

Response

Returns a LoginResponse!

Arguments
Name Description
provider - OAuthProvider!
code - String!

Example

Query
mutation oauthSignIn(
  $provider: OAuthProvider!,
  $code: String!
) {
  oauthSignIn(
    provider: $provider,
    code: $code
  ) {
    token
    user {
      ...UserFragment
    }
  }
}
Variables
{"provider": "GOOGLE", "code": "abc123"}
Response
{
  "data": {
    "oauthSignIn": {
      "token": "abc123",
      "user": User
    }
  }
}

readNotification

Description

已讀通知

Response

Returns a Boolean!

Arguments
Name Description
notificationID - String!

Example

Query
mutation readNotification($notificationID: String!) {
  readNotification(notificationID: $notificationID)
}
Variables
{"notificationID": "xyz789"}
Response
{"data": {"readNotification": false}}

readNotifications

Description

已讀多筆通知

Response

Returns a Boolean!

Arguments
Name Description
notificationsID - [String!]!

Example

Query
mutation readNotifications($notificationsID: [String!]!) {
  readNotifications(notificationsID: $notificationsID)
}
Variables
{"notificationsID": ["xyz789"]}
Response
{"data": {"readNotifications": true}}

registerDevice

Description

註冊設備推播通知

Response

Returns a Boolean!

Arguments
Name Description
expoToken - String!
deviceModel - String!

Example

Query
mutation registerDevice(
  $expoToken: String!,
  $deviceModel: String!
) {
  registerDevice(
    expoToken: $expoToken,
    deviceModel: $deviceModel
  )
}
Variables
{
  "expoToken": "xyz789",
  "deviceModel": "abc123"
}
Response
{"data": {"registerDevice": true}}

saveTopic

Description

收藏話題

Response

Returns a Boolean!

Arguments
Name Description
topicID - String!

Example

Query
mutation saveTopic($topicID: String!) {
  saveTopic(topicID: $topicID)
}
Variables
{"topicID": "abc123"}
Response
{"data": {"saveTopic": true}}

sendNotification

Description

管理員手動發送推播通知

Response

Returns a NotificationTask!

Arguments
Name Description
title - String!
content - String!
sendTime - String!

Example

Query
mutation sendNotification(
  $title: String!,
  $content: String!,
  $sendTime: String!
) {
  sendNotification(
    title: $title,
    content: $content,
    sendTime: $sendTime
  ) {
    id
    title
    content
    createdAt
    createdBy
    time
    cancelAt
  }
}
Variables
{
  "title": "xyz789",
  "content": "xyz789",
  "sendTime": "abc123"
}
Response
{
  "data": {
    "sendNotification": {
      "id": "507f1f77bcf86cd799439011",
      "title": "abc123",
      "content": "xyz789",
      "createdAt": "2020-01-01T00:00:00.000Z",
      "createdBy": "507f1f77bcf86cd799439011",
      "time": "abc123",
      "cancelAt": "2020-01-01T00:00:00.000Z"
    }
  }
}

traditionalSignIn

Description

使用 Email 和密碼登入

Response

Returns a LoginResponse!

Arguments
Name Description
email - String!
password - String!

Example

Query
mutation traditionalSignIn(
  $email: String!,
  $password: String!
) {
  traditionalSignIn(
    email: $email,
    password: $password
  ) {
    token
    user {
      ...UserFragment
    }
  }
}
Variables
{
  "email": "abc123",
  "password": "xyz789"
}
Response
{
  "data": {
    "traditionalSignIn": {
      "token": "xyz789",
      "user": User
    }
  }
}

traditionalSignUp

Description

使用 Email 和密碼註冊帳號

Response

Returns a LoginResponse!

Arguments
Name Description
email - String!
password - String!
captchaID - String!
captchaAnswer - String!

Example

Query
mutation traditionalSignUp(
  $email: String!,
  $password: String!,
  $captchaID: String!,
  $captchaAnswer: String!
) {
  traditionalSignUp(
    email: $email,
    password: $password,
    captchaID: $captchaID,
    captchaAnswer: $captchaAnswer
  ) {
    token
    user {
      ...UserFragment
    }
  }
}
Variables
{
  "email": "abc123",
  "password": "abc123",
  "captchaID": "xyz789",
  "captchaAnswer": "abc123"
}
Response
{
  "data": {
    "traditionalSignUp": {
      "token": "xyz789",
      "user": User
    }
  }
}

unfollowUser

Description

取消追蹤使用者

Response

Returns a Boolean!

Arguments
Name Description
userID - String!

Example

Query
mutation unfollowUser($userID: String!) {
  unfollowUser(userID: $userID)
}
Variables
{"userID": "xyz789"}
Response
{"data": {"unfollowUser": false}}

unregisterDevice

Description

取消註冊設備推播通知

Response

Returns a Boolean!

Arguments
Name Description
expoToken - String!

Example

Query
mutation unregisterDevice($expoToken: String!) {
  unregisterDevice(expoToken: $expoToken)
}
Variables
{"expoToken": "abc123"}
Response
{"data": {"unregisterDevice": true}}

unwatchTopic

Description

取消關注話題

Response

Returns a Boolean!

Arguments
Name Description
topicID - String!

Example

Query
mutation unwatchTopic($topicID: String!) {
  unwatchTopic(topicID: $topicID)
}
Variables
{"topicID": "abc123"}
Response
{"data": {"unwatchTopic": true}}

updateAdmin

Description

更新管理員帳號

Response

Returns an Admin

Arguments
Name Description
id - ID!
username - String
password - String
nickname - String
permissions - [AdminPermission!]

Example

Query
mutation updateAdmin(
  $id: ID!,
  $username: String,
  $password: String,
  $nickname: String,
  $permissions: [AdminPermission!]
) {
  updateAdmin(
    id: $id,
    username: $username,
    password: $password,
    nickname: $nickname,
    permissions: $permissions
  ) {
    id
    username
    nickname
    createdAt
    permissions
  }
}
Variables
{
  "id": "507f1f77bcf86cd799439011",
  "username": "xyz789",
  "password": "xyz789",
  "nickname": "abc123",
  "permissions": ["USER_MANAGEMENT"]
}
Response
{
  "data": {
    "updateAdmin": {
      "id": "507f1f77bcf86cd799439011",
      "username": "abc123",
      "nickname": "xyz789",
      "createdAt": "2020-01-01T00:00:00.000Z",
      "permissions": ["USER_MANAGEMENT"]
    }
  }
}

updateCategory

Description

(管理後台)修改話題分類

Response

Returns a Category!

Arguments
Name Description
id - String!
newName - String
newImage - Upload

Example

Query
mutation updateCategory(
  $id: String!,
  $newName: String,
  $newImage: Upload
) {
  updateCategory(
    id: $id,
    newName: $newName,
    newImage: $newImage
  ) {
    id
    name
    imageUrl
    topicCount
    starCount
  }
}
Variables
{
  "id": "xyz789",
  "newName": "xyz789",
  "newImage": "File"
}
Response
{
  "data": {
    "updateCategory": {
      "id": "507f1f77bcf86cd799439011",
      "name": "abc123",
      "imageUrl": "https://example.com/exmaple",
      "topicCount": 27,
      "starCount": 27
    }
  }
}

updateEmail

Description

修改電子郵件信箱

Response

Returns a Boolean!

Arguments
Name Description
oldEmail - String!
newEmail - String!
password - String!

Example

Query
mutation updateEmail(
  $oldEmail: String!,
  $newEmail: String!,
  $password: String!
) {
  updateEmail(
    oldEmail: $oldEmail,
    newEmail: $newEmail,
    password: $password
  )
}
Variables
{
  "oldEmail": "xyz789",
  "newEmail": "xyz789",
  "password": "abc123"
}
Response
{"data": {"updateEmail": true}}

updatePassword

Description

修改登入密碼

Response

Returns a Boolean!

Arguments
Name Description
newPassword - String!
oldPassword - String!

Example

Query
mutation updatePassword(
  $newPassword: String!,
  $oldPassword: String!
) {
  updatePassword(
    newPassword: $newPassword,
    oldPassword: $oldPassword
  )
}
Variables
{
  "newPassword": "abc123",
  "oldPassword": "xyz789"
}
Response
{"data": {"updatePassword": true}}

updateTopic

Description

更新話題

Response

Returns a Topic!

Arguments
Name Description
id - ID!
title - String
categoryId - String

Example

Query
mutation updateTopic(
  $id: ID!,
  $title: String,
  $categoryId: String
) {
  updateTopic(
    id: $id,
    title: $title,
    categoryId: $categoryId
  ) {
    id
    title
    author {
      ...UserFragment
    }
    category {
      ...CategoryFragment
    }
    options {
      ...OptionFragment
    }
    isVoted
    voteCount
    isSaved
    createdAt
    comments {
      ...CommentConnectionFragment
    }
    isWatching
  }
}
Variables
{
  "id": "507f1f77bcf86cd799439011",
  "title": "abc123",
  "categoryId": "xyz789"
}
Response
{
  "data": {
    "updateTopic": {
      "id": "507f1f77bcf86cd799439011",
      "title": "abc123",
      "author": User,
      "category": Category,
      "options": [Option],
      "isVoted": true,
      "voteCount": 27,
      "isSaved": false,
      "createdAt": "2020-01-01T00:00:00.000Z",
      "comments": CommentConnection,
      "isWatching": false
    }
  }
}

updateUserNotificationSetting

Description

更新使用者的通知設定

Response

Returns a Boolean!

Arguments
Name Description
settings - UserNotificationSettingInput!

Example

Query
mutation updateUserNotificationSetting($settings: UserNotificationSettingInput!) {
  updateUserNotificationSetting(settings: $settings)
}
Variables
{"settings": UserNotificationSettingInput}
Response
{"data": {"updateUserNotificationSetting": false}}

updateUserProfile

Description

更新使用者的個人資訊

Response

Returns a User!

Arguments
Name Description
id - ID!
email - String
name - String
image - Upload

Example

Query
mutation updateUserProfile(
  $id: ID!,
  $email: String,
  $name: String,
  $image: Upload
) {
  updateUserProfile(
    id: $id,
    email: $email,
    name: $name,
    image: $image
  ) {
    id
    name
    avatarUrl
    email
    registeredAt
    topicCount
    commentedCount
    commentCount
    savedCount
    votedCount
    followerCount
    followingCount
    appleIdentifier
    googleIdentifier
    facebookIdentifier
    lineIdentifier
    isFollowing
    watchingTopicIDs
    notificationSettings {
      ...UserNotificationSettingsFragment
    }
  }
}
Variables
{
  "id": "507f1f77bcf86cd799439011",
  "email": "xyz789",
  "name": "abc123",
  "image": "File"
}
Response
{
  "data": {
    "updateUserProfile": {
      "id": "507f1f77bcf86cd799439011",
      "name": "xyz789",
      "avatarUrl": "https://example.com/exmaple",
      "email": "abc123",
      "registeredAt": "2020-01-01T00:00:00.000Z",
      "topicCount": 27,
      "commentedCount": 27,
      "commentCount": 27,
      "savedCount": 27,
      "votedCount": 27,
      "followerCount": 27,
      "followingCount": 27,
      "appleIdentifier": "abc123",
      "googleIdentifier": "abc123",
      "facebookIdentifier": "abc123",
      "lineIdentifier": "xyz789",
      "isFollowing": true,
      "watchingTopicIDs": [
        "507f1f77bcf86cd799439011"
      ],
      "notificationSettings": UserNotificationSettings
    }
  }
}

voteTopic

Description

對話題的某個選項投票

Response

Returns a Boolean!

Arguments
Name Description
topicId - String!
optionId - String!

Example

Query
mutation voteTopic(
  $topicId: String!,
  $optionId: String!
) {
  voteTopic(
    topicId: $topicId,
    optionId: $optionId
  )
}
Variables
{
  "topicId": "abc123",
  "optionId": "xyz789"
}
Response
{"data": {"voteTopic": false}}

watchTopic

Description

關注話題

Response

Returns a Boolean!

Arguments
Name Description
topicID - String!

Example

Query
mutation watchTopic($topicID: String!) {
  watchTopic(topicID: $topicID)
}
Variables
{"topicID": "abc123"}
Response
{"data": {"watchTopic": true}}

Types

Admin

Fields
Field Name Description
id - ID!
username - String! 管理員帳號
nickname - String! 管理員使用者名稱
createdAt - String! 管理員帳號創建日期
permissions - [AdminPermission!]! 管理員權限
Example
{
  "id": "507f1f77bcf86cd799439011",
  "username": "abc123",
  "nickname": "xyz789",
  "createdAt": "2020-01-01T00:00:00.000Z",
  "permissions": ["USER_MANAGEMENT"]
}

AdminConnection

Fields
Field Name Description
edges - [AdminEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [AdminEdge],
  "pageInfo": PageInfo
}

AdminEdge

Fields
Field Name Description
node - Admin!
cursor - ID!
Example
{
  "node": Admin,
  "cursor": "507f1f77bcf86cd799439011"
}

AdminLoginResponse

Fields
Field Name Description
token - String!
admin - Admin!
Example
{
  "token": "xyz789",
  "admin": Admin
}

AdminPermission

Values
Enum Value Description

USER_MANAGEMENT

CATEGORY_MANAGEMENT

NOTIFICATION_MANAGEMENT

ADMIN_MANAGEMENT

TOPIC_MANAGEMENT

Example
"USER_MANAGEMENT"

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

Category

Fields
Field Name Description
id - ID!
name - String!
imageUrl - String!
topicCount - Int! 屬於這個分類的話題數量
starCount - Int! 總獲得星數
Example
{
  "id": "507f1f77bcf86cd799439011",
  "name": "xyz789",
  "imageUrl": "https://example.com/exmaple",
  "topicCount": 27,
  "starCount": 27
}

CategoryConnection

Fields
Field Name Description
edges - [CategoryEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [CategoryEdge],
  "pageInfo": PageInfo
}

CategoryEdge

Fields
Field Name Description
node - Category!
cursor - ID!
Example
{
  "node": Category,
  "cursor": "507f1f77bcf86cd799439011"
}

Comment

Fields
Field Name Description
id - ID!
topic - Topic!
createdAt - String!
content - String!
author - User!
Example
{
  "id": "507f1f77bcf86cd799439011",
  "topic": Topic,
  "createdAt": "2020-01-01T00:00:00.000Z",
  "content": "xyz789",
  "author": User
}

CommentConnection

Fields
Field Name Description
edges - [CommentEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [CommentEdge],
  "pageInfo": PageInfo
}

CommentEdge

Fields
Field Name Description
node - Comment!
cursor - ID!
Example
{
  "node": Comment,
  "cursor": "507f1f77bcf86cd799439011"
}

ID

Description

The ID scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.

Example
"507f1f77bcf86cd799439011"

Int

Description

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

Example
27

LoginResponse

Fields
Field Name Description
token - String!
user - User!
Example
{
  "token": "abc123",
  "user": User
}

Notification

Fields
Field Name Description
id - ID!
createdAt - String!
content - String!
receiverId - ID!
isRead - Boolean! 是否已讀
imageUrl - String! 通知的圖片,可能是使用者的頭像或是圖標
uri - String! 點擊通知後的跳轉頁面
Example
{
  "id": "507f1f77bcf86cd799439011",
  "createdAt": "2020-01-01T00:00:00.000Z",
  "content": "abc123",
  "receiverId": "507f1f77bcf86cd799439011",
  "isRead": false,
  "imageUrl": "https://example.com/exmaple",
  "uri": "abc123"
}

NotificationConnection

Fields
Field Name Description
edges - [NotificationEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [NotificationEdge],
  "pageInfo": PageInfo
}

NotificationEdge

Fields
Field Name Description
node - Notification!
cursor - ID!
Example
{
  "node": Notification,
  "cursor": "507f1f77bcf86cd799439011"
}

NotificationTask

Description

管理員手動排程發送推播通知

Fields
Field Name Description
id - ID!
title - String! 通知標題
content - String! 通知內容
createdAt - String! 建立時間
createdBy - ID! 發送的管理員帳號
time - String! 通知時間
cancelAt - String! 取消時間
Example
{
  "id": "507f1f77bcf86cd799439011",
  "title": "abc123",
  "content": "abc123",
  "createdAt": "2020-01-01T00:00:00.000Z",
  "createdBy": "507f1f77bcf86cd799439011",
  "time": "abc123",
  "cancelAt": "2020-01-01T00:00:00.000Z"
}

NotificationTaskConnection

Fields
Field Name Description
edges - [NotificationTaskEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [NotificationTaskEdge],
  "pageInfo": PageInfo
}

NotificationTaskEdge

Fields
Field Name Description
node - NotificationTask!
cursor - ID!
Example
{
  "node": NotificationTask,
  "cursor": "507f1f77bcf86cd799439011"
}

OAuthProvider

Values
Enum Value Description

GOOGLE

FACEBOOK

LINE

APPLE

Example
"GOOGLE"

Option

Fields
Field Name Description
id - ID!
name - String!
imageUrl - String 背景圖片網址,可以為空(空的話顯示背景色)
backgroundColor - [String!]! 背景顏色(漸層)
voteCount - Int! 選項被投票的次數
isVoted - Boolean! 當前使用者是否投了這個選項
Example
{
  "id": "507f1f77bcf86cd799439011",
  "name": "xyz789",
  "imageUrl": "https://example.com/exmaple",
  "backgroundColor": ["xyz789"],
  "voteCount": 27,
  "isVoted": false
}

OptionInput

Fields
Input Field Description
name - String!
image - Upload
backgroundColor - [String!]
Example
{
  "name": "abc123",
  "image": "File",
  "backgroundColor": ["xyz789"]
}

PageInfo

Fields
Field Name Description
totalCount - Int!
hasNextPage - Boolean!
Example
{"totalCount": 27, "hasNextPage": false}

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"xyz789"

Topic

Fields
Field Name Description
id - ID!
title - String!
author - User!
category - Category!
options - [Option!]! 話題的選項
isVoted - Boolean! 當前使用者是否投了這個話題
voteCount - Int! 選項被投票的總次數
isSaved - Boolean! 話題是否被當前使用者收藏
createdAt - String!
comments - CommentConnection!
isWatching - Boolean! 是否被當前使用者關注(關注代表會收到該話題的通知)
Example
{
  "id": "507f1f77bcf86cd799439011",
  "title": "xyz789",
  "author": User,
  "category": Category,
  "options": [Option],
  "isVoted": false,
  "voteCount": 27,
  "isSaved": true,
  "createdAt": "2020-01-01T00:00:00.000Z",
  "comments": CommentConnection,
  "isWatching": false
}

TopicConnection

Fields
Field Name Description
edges - [TopicEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [TopicEdge],
  "pageInfo": PageInfo
}

TopicEdge

Fields
Field Name Description
node - Topic!
cursor - ID!
Example
{
  "node": Topic,
  "cursor": "507f1f77bcf86cd799439011"
}

Upload

Example
"File"

User

Fields
Field Name Description
id - ID!
name - String!
avatarUrl - String!
email - String!
registeredAt - String!
topicCount - Int! 使用者發表的話題數量
commentedCount - Int! 使用者所有話題被留言的次數總和
commentCount - Int! 使用者所有話題的留言數量總和
savedCount - Int! 使用者話題被收藏的次數總和
votedCount - Int! 使用者所有話題被投票的次數總和
followerCount - Int! 粉絲數量
followingCount - Int! 追蹤中的使用者數量
appleIdentifier - String 使用者綁定的 Apple 唯一標識符
googleIdentifier - String 使用者綁定的 Google 唯一標識符
facebookIdentifier - String 使用者綁定的 Facebook 唯一標識符
lineIdentifier - String 使用者綁定的 Line 唯一標識符
isFollowing - Boolean! 使用者是否被當前查詢的使用者追蹤
watchingTopicIDs - [ID!]! 使用者當前關注(會收到通知)的話題 ID 列表
notificationSettings - UserNotificationSettings! 使用者當前的通知設定
Example
{
  "id": "507f1f77bcf86cd799439011",
  "name": "xyz789",
  "avatarUrl": "https://example.com/exmaple",
  "email": "xyz789",
  "registeredAt": "2020-01-01T00:00:00.000Z",
  "topicCount": 27,
  "commentedCount": 27,
  "commentCount": 27,
  "savedCount": 27,
  "votedCount": 27,
  "followerCount": 27,
  "followingCount": 27,
  "appleIdentifier": "abc123",
  "googleIdentifier": "abc123",
  "facebookIdentifier": "abc123",
  "lineIdentifier": "abc123",
  "isFollowing": false,
  "watchingTopicIDs": [
    "507f1f77bcf86cd799439011"
  ],
  "notificationSettings": UserNotificationSettings
}

UserConnection

Fields
Field Name Description
edges - [UserEdge!]!
pageInfo - PageInfo!
Example
{
  "edges": [UserEdge],
  "pageInfo": PageInfo
}

UserEdge

Fields
Field Name Description
node - User!
cursor - ID!
Example
{
  "node": User,
  "cursor": "507f1f77bcf86cd799439011"
}

UserNotificationSettingInput

Fields
Input Field Description
allComments - Boolean
votedTopicBeingVoted - Boolean
votedTopicBeingCommented - Boolean
votedTopicBeingSaved - Boolean
Example
{
  "allComments": true,
  "votedTopicBeingVoted": true,
  "votedTopicBeingCommented": true,
  "votedTopicBeingSaved": true
}

UserNotificationSettings

Fields
Field Name Description
allComments - Boolean! 關閉此項代表不接受任何因為留言而觸發的通知
votedTopicBeingVoted - Boolean! 關閉此項代表不接受自己投過票的話題被別人投票時的通知
votedTopicBeingCommented - Boolean! 關閉此項代表不接受自己投過票的話題被別人留言時的通知
votedTopicBeingSaved - Boolean! 關閉此項代表不接受自己投過票的話題被別人收藏時的通知
Example
{
  "allComments": false,
  "votedTopicBeingVoted": false,
  "votedTopicBeingCommented": false,
  "votedTopicBeingSaved": true
}