Skip to content

API GraphQL Query 명세서

Minkwan-Song edited this page Nov 24, 2020 · 1 revision

👻 User API

전체 유저 목록 조회

{
  allUsers {
    id
    nickname
    avatar
    password
    lang
    rooms {
      id
      avatar
      code
    }
    messages {
      id
      text
      source
    }
  }
}

유저 삭제

mutation {
  deleteUser($id: Int!) {
      deleteUser(id: $id) // true
  }
}

// example
mutation {
  deleteUser(id: 13)
}

👨‍👩‍👧‍👧 Room API

전체 채팅방 목록 조회

{
  allRooms {
    id
    avatar
    code
    users {
      id
      nickname
      avatar
      lang
    }
    messages {
      id
      text
      source
    }
  }
}

id값으로 채팅방 조회

{
  seeRoomById(id: 1) {
    id
    avatar
    code
    users {
      id
      nickname
      avatar
      lang
    }
    messages {
      id
      text
      source
    }
  }
}

새로운 채팅방 생성

mutation {
  createRoom(nickname: String!, avatar: String!, password: String, lang: String!) {
      createRoom(nickname: $nickname, avatar: $testAvatar, password: $password, lang: $lang)
  }
}

// example
mutation {
  createRoom(nickname: "yejin", avatar: "avatar", lang: "en") {
    id
    code
  }
}

채팅방 참여

mutation {
  enterRoom(nickname: String!, avatar: String!, password: String, lang: String!, code: String!) {
      enterRoom(nickname: $nickname, avatar: $testAvatar, password: $password, lang: $lang, code: $code)
  }
}

// example
mutation {
  enterRoom(nickname: "test5", avatar: "hi_avatar", lang: "ko", code: "335976")
}

📧 Message API

메시지 생성

mutation {
  createMessage($text: String! $source: String!, $nickname: String!, $roomId: Int!) {
      createMessage(text: $text, source: $source, nickname: $nickname, roomId: $roomId)
  }
}

// example
mutation {
  createMessage(text: "hi", source: "ko", nickname: "yejin", roomId: 1)
}

room id값으로 채팅 목록 조회

{
  allChatById(id: 1) {
    id
    text
    source
    user {
      id
      nickname
      avatar
      lang
    }
  }
}

실시간 채팅 조회

subscription {
  newMessage {
    id
    text
    source
  }
}

Team Madagascar

🏡 Home

🚀 개요


📌 기획서


🙉 Team Rules

Code Convention

📃 Documents


데일리 스크럼

Week 1
Week 2
Week 3
Week 4
Week 5

회의록

Week 1
Week 2
Week 3
Week 4
Week 5

피어세션

그룹 회고


학습 정리

Clone this wiki locally