[KR] 팔로우 API - 2022-dimipay-recruit/Flutter-Server Wiki
팔로우 API
POST /follows/:id/follow
request:
- params
- id: (팔로우를 할 유저의 UUID)
- header
- authorization: string (Bearer + JWT)
부연 : 현재 유저의 UUID는 서버에서 알아서 갖고오기에, 파라미터로 팔로우할 유저의 UUID를 넘겨주면 현재 유저가 해당 UUID의 유저를 팔로우 한 것으로 등록합니다.
response:
{
status: 'success',
data: {
follows: {
followerId: string (팔로우한 사람의 ID),
followingId: string (팔로우받은 사람의 ID),
follower(팔로우한 사람): {
id: string (UUID),
link: string (/^[a-z0-9]{6,16}$/),
nickname: string (/^.{3,20}$/),
email: string,
profileImage: string,
description: string,
},
following(팔로잉한 사람): {
id: string (UUID),
link: string (/^[a-z0-9]{6,16}$/),
nickname: string (/^.{3,20}$/),
email: string,
profileImage: string,
description: string,
},
}
}
}
error:
- 400
- Invalid authorization token
- Invalid authorization header type
DELETE /follows/:id/follow
request:
- params
- id: (언팔로우를 할 유저의 UUID)
- header
- authorization: string (Bearer + JWT)
부연 : 현재 유저의 UUID는 서버에서 알아서 갖고오기에, 파라미터로 팔로우할 유저의 UUID를 넘겨주면 현재 유저가 해당 UUID의 유저를 언팔로우 한 것으로 처리합니다.
response:
{
status: 'success',
data: null
}
error:
- 400
- Invalid authorization token
- Invalid authorization header type
GET /follows/:id/follower
request:
- params
- id: (팔로우를 조회할 유저의 UUID)
- query (?page[index]=0&page[size]=100&page[order]=desc와 같은 형태로 요청)
- page
- index?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 0)
- size?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 100)
- order?: 'desc' | 'asc' (기본 asc)
- page
- header
- authorization: string (Bearer + JWT)
부연 : 해당 "유저를 팔로우 한" 팔로우 정보를 갖고옵니다.
response:
{
status: 'success',
data: {
followers: [(맨 위 POST와 같은 follows형식의 값이 배열됩니다.)]
}
}
error:
- 400
- Invalid authorization token
- Invalid authorization header type
GET /follows/:id/following
request:
- params
- id: (팔로우를 조회할 유저의 UUID)
- query (?page[index]=0&page[size]=100&page[order]=desc와 같은 형태로 요청)
- page
- index?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 0)
- size?: string (/^[1-9][0-9]+$|^[0-9]$/, 기본 100)
- order?: 'desc' | 'asc' (기본 asc)
- page
- header
- authorization: string (Bearer + JWT)
부연 : 해당 "유저가 팔로우 한" 팔로우 정보를 갖고옵니다.
response:
{
status: 'success',
data: {
followers: [(맨 위 POST와 같은 follows형식의 값이 배열됩니다.)]
}
}
error:
- 400
- Invalid authorization token
- Invalid authorization header type