@lumir-company/admin-server-api
관리자 시스템을 위한 API SDK 패키지입니다.
설치
npm install @lumir-company/admin-server-api
사용법
인증
import { AuthAPI } from '@lumir-company/admin-server-api';
const authApi = new AuthAPI('http://your-api-url');
const token = await authApi.login({
accountId: 'your-id',
password: 'your-password',
});
공지사항 관리
import { NoticeAPI } from '@lumir-company/admin-server-api';
const noticeApi = new NoticeAPI('http://your-api-url');
noticeApi.setToken(token.accessToken);
const { data } = await noticeApi.getNotices(1, 10);
const notice = await noticeApi.getNoticeById('notice-id');
뉴스 관리
import { NewsAPI } from '@lumir-company/admin-server-api';
const newsApi = new NewsAPI('http://your-api-url');
newsApi.setToken(token.accessToken);
const { data } = await newsApi.getNews(1, 10);
const news = await newsApi.getNewsById('news-id');
보도자료 관리
import { PressReleaseAPI } from '@lumir-company/admin-server-api';
const pressReleaseApi = new PressReleaseAPI('http://your-api-url');
pressReleaseApi.setToken(token.accessToken);
const { data } = await pressReleaseApi.getPressReleases(1, 10);
const pressRelease =
await pressReleaseApi.getPressReleaseById('press-release-id');
S3 파일 관리
import { S3API } from '@lumir-company/admin-server-api';
const s3Api = new S3API('http://your-api-url');
s3Api.setToken(token.accessToken);
const fileResponse = await s3Api.getFile('file-key', true);
페이지뷰 추적
import { PageViewAPI, PageName } from '@lumir-company/admin-server-api';
export enum PageName {
MAIN = '메인 페이지',
DISCLOSURE = '전자공고',
SHAREHOLDER = '주주정보',
NEWS = '루미르스토리',
VIDEO = '영상',
BROCHURE = '정보자료',
}
const pageViewApi = new PageViewAPI('http://your-api-url');
pageViewApi.setToken(token.accessToken);
await pageViewApi.createPageView({
sessionId: 'user-session-id',
pageName: PageName.MAIN,
enterTime: new Date(),
url: 'https://lumir.space/',
title: '주식상장 이야기',
});
await pageViewApi.updatePageView({
sessionId: 'user-session-id',
pageName: PageName.MAIN,
exitTime: new Date(),
stayDuration: 60000,
url: 'https://lumir.space/',
title: '주식상장 이야기',
});
주주총회 관리
import { ShareholderMeetingAPI } from '@lumir-company/admin-server-api';
const shareholderMeetingApi = new ShareholderMeetingAPI('http://your-api-url');
shareholderMeetingApi.setToken(token.accessToken);
const { data } = await shareholderMeetingApi.getMeetings(1, 10);
const meeting = await shareholderMeetingApi.getMeetingById('meeting-id');
전자공고 관리
import { DisclosureAPI } from '@lumir-company/admin-server-api';
const disclosureApi = new DisclosureAPI('http://your-api-url');
disclosureApi.setToken(token.accessToken);
const { data } = await disclosureApi.getDisclosures(1, 10);
const disclosure = await disclosureApi.getDisclosureById('disclosure-id');
비디오 관리
import { VideoAPI } from '@lumir-company/admin-server-api';
const videoApi = new VideoAPI('http://your-api-url');
videoApi.setToken(token.accessToken);
const { data } = await videoApi.getVideos(1, 10);
const video = await videoApi.getVideoById('video-id');
브로슈어 관리
import { BrochureAPI } from '@lumir-company/admin-server-api';
const brochureApi = new BrochureAPI('http://your-api-url');
brochureApi.setToken(token.accessToken);
const { data } = await brochureApi.getBrochures(1, 10);
const brochure = await brochureApi.getBrochureById('brochure-id');
IR Material 관리
import { IRMaterialAPI } from '@lumir-company/admin-server-api';
const irMaterialApi = new IRMaterialAPI('http://your-api-url');
irMaterialApi.setToken(token.accessToken);
const { items, total } = await irMaterialApi.getIRMaterials(1, 10);
const irMaterial = await irMaterialApi.getIRMaterial('ir-material-id');
API 레퍼런스
AuthAPI
login({ accountId, password })
: 로그인하여 토큰을 반환
NoticeAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getNotices(page, limit)
: 공지사항 목록 조회
getNoticeById(id)
: 특정 공지사항 조회
NewsAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getNews(page, limit)
: 뉴스 목록 조회
getNewsById(id)
: 특정 뉴스 조회
PressReleaseAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getPressReleases(page, limit)
: 보도자료 목록 조회
getPressReleaseById(id)
: 특정 보도자료 조회
S3API
setToken(token)
: API 요청에 사용할 토큰 설정
getFile(key, download)
: 파일 다운로드/조회
PageViewAPI
createPageView(data)
: 페이지뷰 데이터 생성
updatePageView(data)
: 페이지뷰 데이터 업데이트 (종료 시간 및 체류 시간)
ShareholderMeetingAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getMeetings(page, limit)
: 주주총회 목록 조회
getMeetingById(id)
: 특정 주주총회 조회
DisclosureAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getDisclosures(page, limit)
: 전자공고 목록 조회
getDisclosureById(id)
: 특정 전자공고 조회
VideoAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getVideos(page, limit)
: 비디오 목록 조회
getVideoById(id)
: 특정 비디오 조회
BrochureAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getBrochures(page, limit)
: 브로슈어 목록 조회
getBrochureById(id)
: 특정 브로슈어 조회
IRMaterialAPI
setToken(token)
: API 요청에 사용할 토큰 설정
getIRMaterials(page, limit)
: IR 자료 목록 조회
getIRMaterial(id)
: 특정 IR 자료 조회
타입 레퍼런스
공통 타입
FileInfo
파일 정보를 나타내는 인터페이스
interface FileInfo {
fileName: string;
filePath: string;
}
Response
API 응답의 기본 형태
interface Response<T> {
result: 'success' | 'fail';
message: string;
status: number;
data: T;
}
페이지네이션된 목록 응답
interface PaginationResponse<T> {
items: T[];
total: number;
page: number;
limit: number;
hasMore: boolean;
}
도메인별 타입
ShareholderMeeting
주주총회 정보
interface ShareholderMeeting {
_id: string;
title: string;
content: string;
date: string;
isPublic: boolean;
files: FileInfo[];
order: number;
createdAt: string;
updatedAt: string;
}
Disclosure
전자공고 정보
interface Disclosure {
_id: string;
title: string;
content: string;
date: string;
isPublic: boolean;
files: FileInfo[];
order: number;
createdAt: string;
updatedAt: string;
}
Category
비디오 카테고리 정보
interface Category {
_id: string;
name: string;
createdAt: string;
updatedAt: string;
}
Video
비디오 정보
interface Video {
_id: string;
title: string;
description?: string;
link: string;
files: FileInfo[];
isPublic: boolean;
category: Category;
order: number;
createdAt: string;
updatedAt: string;
}
Brochure
브로슈어 정보
interface Brochure {
_id: string;
title: string;
description?: string;
files: FileInfo[];
isPublic: boolean;
order: number;
createdAt: string;
updatedAt: string;
}
PageName
페이지 식별자 열거형
enum PageName {
MAIN = '메인 페이지',
DISCLOSURE = '전자공고',
SHAREHOLDER = '주주정보',
NEWS = '루미르스토리',
VIDEO = '영상',
BROCHURE = '정보자료',
}
PageView
페이지뷰 추적 정보
interface PageView {
_id: string;
sessionId: string;
pageName: PageName;
enterTime: Date;
exitTime?: Date;
stayDuration?: number;
url: string;
}
IRMaterial
IR 자료 정보
interface IRMaterial {
_id: string;
title: string;
content?: string;
files: FileInfo[];
isPublic: boolean;
date: string;
order: number;
createdAt: string;
updatedAt: string;
}