[KR] 팔로우 API - 2022-dimipay-recruit/Flutter-Server GitHub Wiki
팔로우 API
/follows/:id/follow
POST request:
- params
- id: (팔로우를 할 유저의 UUID)
- header
- authorization: string (Bearer + JWT)
부연 : 현재 유저의 UUID는 서버에서 알아서 갖고오기에, 파라미터로 팔로우할 유저의 UUID를 넘겨주면 현재 유저가 해당 UUID의 유저를 팔로우 한 것으로 등록합니다.
response:
{
status: 'success',
data: {
follows: {
id: string (팔로우 정보 ID, 삭제에 사용합니다),
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
/follows/:id
DELETE request:
- params
- id: (팔로우를 삭제할 정보의 UUID)
- header
- authorization: string (Bearer + JWT)
부연 : 팔로우 정보 ID를 넘겨주면 해당 팔로우를 삭제하여, 연결을 끊습니다.
response:
{
status: 'success',
data: null
}
error:
- 400
- Invalid authorization token
- Invalid authorization header type
/follows/:id/follower
GET 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
/follows/:id/following
GET 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