Skip to content

API Specification

BangDori edited this page Apr 12, 2024 · 30 revisions

ν”Όλ“œ

κΈ°λŠ₯ λ©”μ„œλ“œ URI λΉ„κ³ 
ν”Όλ“œ λͺ©λ‘ 쑰회 GET /feeds ⚠️
ν”Όλ“œ μž‘μ„± POST /feeds ⚠️
ν”Όλ“œ 상세 GET /feeds/{feed_id} ⚠️
ν”Όλ“œ μˆ˜μ • PUT /feeds/{feed_id} ⚠️
ν”Όλ“œ μ‚­μ œ DELETE /feeds/{feed_id} ⚠️
ν”Όλ“œ μ’‹μ•„μš” POST /feeds/{feed_id}/like ⚠️
ν”Όλ“œ μ‹ κ³  POST /feeds/{feed_id}/report ⚠️
ν”Όλ“œ 이미지 μ—…λ‘œλ“œ POST /feeds/{feed_id}/image ✨ 방법 λ…Όμ˜ ν•„μš” (preSignedURL)
ν”Όλ“œ 이미지 제거 DELETE /feeds/{feed_id}/image ✨ 방법 λ…Όμ˜ ν•„μš”

ν”Όλ“œ λͺ©λ‘ 쑰회

  • request: X
  • response: Feed[]

ν”Όλ“œ μž‘μ„±

// request
interface Request {
  title: string;
  content: string;
  images: string[]; // ν”„λ‘ νŠΈ μ—…λ‘œλ“œ or μ„œλ²„ μ—…λ‘œλ“œ λ…Όμ˜ ν•„μš”
  scope: "public" | "friends" | "private";
}

// response: 성곡 | μ‹€νŒ¨μ— λ”°λ₯Έ 응닡 μ½”λ“œ

ν”Όλ“œ 상세

  • request: X
  • response: Feed + Comment
interface Feed {
  id: string | number; // id 값을 string으둜 μ„€μ •ν•˜λŠ”μ§€ number둜 μ„€μ •ν•˜λŠ”μ§€?
  user: {
    // κ²Œμ‹œλ¬Όμ„ μž‘μ„±ν•œ μœ μ € 정보
    id: string | number;
    profile_image: string;
    name: string;
    // 1. νŒ”λ‘œμš° λ˜μ—ˆλŠ”μ§€μ™€ 자기 κ²Œμ‹œλ¬ΌμΈμ§€μ— λŒ€ν•œ μ—¬λΆ€λ₯Ό λ³€μˆ˜ ν•˜λ‚˜λ‘œ μ²΄ν‚Ήν•œλ‹€.
    // ex)
    //    relationship_status: 'self' | 'following' | 'none'
    // 2. 각 μƒνƒœλ₯Ό λ³€μˆ˜λ‘œ λΆ„λ¦¬ν•œλ‹€.
    // ex)
    //    is_follow: boolean
    //    is_self_feed: boolean
  };

  title: string;
  content: string;
  images: string[];

  like_count: number;
  comment_count: number;

  is_like: boolean;
  is_bookmark: boolean;

  updated_at: string;
}

ν”Όλ“œ μˆ˜μ •

// request
interface Request {
  title: string;
  content: string;
  images: string[]; // ν”„λ‘ νŠΈ μ—…λ‘œλ“œ or μ„œλ²„ μ—…λ‘œλ“œ λ…Όμ˜ ν•„μš”
  scope: "public" | "friends" | "private";
}

// response: 성곡 | μ‹€νŒ¨ 응닡 μ½”λ“œ

ν”Όλ“œ μ‚­μ œ

// request
interface Request {
  feed_id: number | string; // number둜 할지 string으둜 할지, μ„œλ²„μ—μ„œ μ •ν•΄μ€˜μ•Όν•¨
}

// response: 성곡 | μ‹€νŒ¨ 응닡 μ½”λ“œ

ν”Όλ“œ μ’‹μ•„μš”

// request
interface Request {
  feed_id: number | string; // number둜 할지 string으둜 할지, μ„œλ²„μ—μ„œ μ •ν•΄μ€˜μ•Όν•¨
}

// response: 성곡 | μ‹€νŒ¨ 응닡 μ½”λ“œ

ν”Όλ“œ μ‹ κ³ 

// request
interface Request {
  feed_id: number | string; // number둜 할지 string으둜 할지, μ„œλ²„μ—μ„œ μ •ν•΄μ€˜μ•Όν•¨
}

// response: 성곡 | μ‹€νŒ¨ 응닡 μ½”λ“œ

ν”Όλ“œ 이미지 μ—…λ‘œλ“œ (presignedURL)

  • 보λ₯˜

ν”Όλ“œ 이미지 제거

  • 보λ₯˜

μœ μ €

κΈ°λŠ₯ λ©”μ„œλ“œ URI λΉ„κ³ 
νŒ”λ‘œμš° μš”μ²­ POST /users/{user_id}/follow ⚠️
μ‚¬μš©μž 검색 GET /users ⚠️
μ‚¬μš©μž ν”„λ‘œν•„ 쑰회 GET /users/{user_id} ⚠️

νŒ”λ‘œμš° μš”μ²­

// request
interface Request {
  user_id: number | string;
}

// response: 성곡 | μ‹€νŒ¨ 응닡 μ½”λ“œ

μ‚¬μš©μž 검색

μ“°λ‘œν‹€λ§μœΌλ‘œ 할거냐, λ””λ°”μš΄μŠ€λ‘œ 할거냐, μ•„λ‹ˆλ©΄ λͺ¨λ“  μž…λ ₯에 λŒ€ν•΄ 검색할 거냐?

// request
// μ‚¬μš©μž + (κ²Œμ‹œλ¬Ό 검색 - ν˜„μž¬λŠ” μ—†μ§€λ§Œ μΆ”ν›„ λ“±λ‘λœλ‹€λ©΄?)
`/search/top?q=${}`

// (κ²Œμ‹œλ¬Ό 검색 - ν˜„μž¬λŠ” μ—†μ§€λ§Œ μΆ”ν›„ λ“±λ‘λœλ‹€λ©΄)
`/search/posts?q=${}`

// 일반 μ‚¬μš©μž 검색
`/search/users?q=${}`

// μ’‹μ•„μš” μ‚¬μš©μž κ²€γ……κ°œ
`/search/like?q=${}`

// response
interface Response {
    users: User[]
}

μ‚¬μš©μž ν”„λ‘œν•„ 쑰회

// request
interface Request {
  user_id: number | string;
}

// respnose
interface Response {
  user: User;
  feeds: Feed[];
  is_follow: boolean; // νŒ”λ‘œμš° μ—¬λΆ€λ₯Ό user에 λ„£λŠ”κ²Œ λ§žλŠ”μ§€, μ•„λ‹ˆλ©΄ λΆ„λ¦¬ν•˜λŠ”κ²Œ λ§žλŠ”μ§€ μ• λ§€ν•˜λ‹€!
}
  • βœ…: 확인 μ™„λ£Œ
  • ⚠️: λŒ€κΈ° μƒνƒœ