Skip to content

Feed API Specification

BangDori edited this page Apr 19, 2024 · 32 revisions
๊ธฐ๋Šฅ ๋ฉ”์„œ๋“œ URI ๋น„๊ณ 
ํ”ผ๋“œ ๋ชฉ๋ก ์กฐํšŒ GET /feeds โœ…
ํ”ผ๋“œ ์ž‘์„ฑ POST /feeds โœ…
ํ”ผ๋“œ ์ƒ์„ธ GET /feeds/{feed_id} โœ…
ํ”ผ๋“œ ์ˆ˜์ • PUT /feeds/{feed_id} โœ…
ํ”ผ๋“œ ์‚ญ์ œ DELETE /feeds/{feed_id} โœ…
ํ”ผ๋“œ ์‹ ๊ณ  POST /feeds/{feed_id}/reports โœ…

1๏ธโƒฃ ํ”ผ๋“œ ๋ชฉ๋ก ์กฐํšŒ

interface Request {
  uri: "/feeds?page=";
  method: "GET";
  query: {
    page: string; // default = 1
  };
  body: {};
}

interface Response {
  code: "2000";
  data: {
    feeds: Feed[]; // 0๏ธโƒฃ Feed
    currentPageNumber: number; // ํ˜„์žฌ ํŽ˜์ด์ง€์˜ ์ˆ˜
    pageSize: number; // ํŽ˜์ด์ง€ ํฌ๊ธฐ
    numberOfElements: number; // ์‹ค์ œ ๋ฐ์ดํ„ฐ์˜ ์ˆ˜
    hasNext: boolean; // ๋‹ค์Œ ์กด์žฌํ•˜๋Š”์ง€
  };
}

2๏ธโƒฃ ํ”ผ๋“œ ์ž‘์„ฑ

interface Request {
  uri: "/feeds";
  method: "POST";
  body: {
    title: string;
    content: string;
    images: string[];
    scope: "public" | "friend" | "private";
  };
}

interface Response {
  code: "2000";
  data: {};
}

3๏ธโƒฃ ํ”ผ๋“œ ์ƒ์„ธ

interface Request {
  uri: "/feeds/feed_id";
  method: "GET";
  body: {};
}

interface Response {
  code: "2000";
  data: {
    feed: Feed; // 0๏ธโƒฃ Feed
  };
}

4๏ธโƒฃ ํ”ผ๋“œ ์ˆ˜์ •

interface Request {
  uri: "/feeds/{feed_id}";
  method: "PUT";
  body: {
    title: string;
    content: string;
    images: string[];
    scope: "public" | "friend" | "private";
  };
}

interface Response {
  code: "2000";
  data: {};
}

5๏ธโƒฃ ํ”ผ๋“œ ์‚ญ์ œ

interface Request {
  uri: "/feeds/{feed_id}";
  method: "DELETE";
  body: {};
}

interface Response {
  code: "2000";
  data: {};
}

6๏ธโƒฃ ํ”ผ๋“œ ์‹ ๊ณ 

interface Request {
  uri: "/feeds/{feed_id}/reports";
  method: "POST";
  body: {
    category: string;
    content: string;
    isBlind: boolean;
  };
}

interface Response {
  code: "2000";
  data: {};
}