Skip to content

Search API Specification

BangDori edited this page Oct 30, 2024 · 6 revisions
κΈ°λŠ₯ λ©”μ„œλ“œ URI λΉ„κ³ 
ν”Όλ“œ 검색 GET /v2/feeds?target=&page=&size= ❌
μ‚¬μš©μž 검색 GET /v2/users?target=&page=&size= ❌

1️⃣ ν”Όλ“œ 검색

interface Request {
  uri: '/v2/feeds?target=&page=&size=';
  method: 'GET';
  query: {
    target: string; // 검색 ν‚€μ›Œλ“œ
    page: string; // νŽ˜μ΄μ§€
    size: string; // 개수
  };
  body: {};
}

interface Response {
  code: '2000';
  data: {
    feed: {
      contents: Feed[];
      currentPageNumber: number; // ν˜„μž¬ νŽ˜μ΄μ§€
      pageSize: number; // νŽ˜μ΄μ§€ 크기
      numberOfElements: number; // μ‹€μ œ λ°μ΄ν„°μ˜ 수
      hasNextPage: boolean; // λ‹€μŒ μ‘΄μž¬ν•˜λŠ”μ§€
    };
  };
}

interface Feed {
  id: number;

  user: {
    id: number;
    profileImage: string;
    username: string;
  };

  content: string;
  images: Image[];

  likeCount: number;
  commentCount: number;

  isLiked: boolean;
  isBookmarked: boolean;

  createdAt: string;
  updatedAt: string;
}

2️⃣ μ‚¬μš©μž 검색

interface Request {
  uri: '/v2/users?target=&page=&size=';
  method: 'GET';
  query: {
    target: string; // 검색 ν‚€μ›Œλ“œ (2자 μ œν•œ)
    page: string; // νŽ˜μ΄μ§€
    size: string; // 개수
  };
  body: {};
}

interface Response {
  code: '2000';
  data: {
    user: {
      contents: User[];
      currentPageNumber: number; // ν˜„μž¬ νŽ˜μ΄μ§€
      pageSize: number; // νŽ˜μ΄μ§€ 크기
      numberOfElements: number; // μ‹€μ œ λ°μ΄ν„°μ˜ 수
      hasNextPage: boolean; // λ‹€μŒ μ‘΄μž¬ν•˜λŠ”μ§€
    };
  };
}

interface User {
  id: number;
  profileImage: string;
  username: string;
}