@lumir-company/admin-server-api
관리자 시스템 API SDK
Installation
npm install @lumir-company/admin-server-api
Usage
인증
import {
AuthAPI,
NoticeAPI,
PressReleaseAPI,
} from '@lumir-company/admin-server-api';
const authApi = new AuthAPI('http://your-api-url');
const noticeApi = new NoticeAPI('http://your-api-url');
const pressReleaseApi = new PressReleaseAPI('http://your-api-url');
const token = await authApi.login({
accountId: 'your-id',
password: 'your-password',
});
noticeApi.setToken(token.accessToken);
pressReleaseApi.setToken(token.accessToken);
팝업 관리
const { items, total } = await noticeApi.getNotices(1, 10);
const newNotice = await noticeApi.createNotice({
title: '제목',
content: '내용',
isPublic: true,
});
const notice = await noticeApi.getNoticeById('notice-id');
await noticeApi.updateNotice('notice-id', {
title: '수정된 제목',
});
await noticeApi.deleteNotice('notice-id');
await noticeApi.toggleNoticePublic('notice-id');
보도자료 관리
const { items, total } = await pressReleaseApi.getPressReleases(1, 10);
const newPressRelease = await pressReleaseApi.createPressRelease({
title: '신규 보도자료',
externalLink: 'https://example.com/news',
isPublic: true,
});
const pressRelease =
await pressReleaseApi.getPressReleaseById('press-release-id');
await pressReleaseApi.updatePressReleaseById('press-release-id', {
title: '수정된 보도자료',
});
await pressReleaseApi.deletePressReleaseById('press-release-id');
await pressReleaseApi.bulkUpdatePressReleases([
{
_id: 'press-release-id-1',
title: '수정된 제목 1',
isPublic: true,
},
{
_id: 'press-release-id-2',
title: '수정된 제목 2',
isPublic: false,
},
]);
API Reference
AuthAPI
login({ accountId, password })
: 로그인하여 토큰을 반환
NoticeAPI
setToken(token)
: API 요청에 사용할 토큰 설정getNotices(page, limit)
: 팝업 목록 조회getNoticeById(id)
: 특정 팝업 조회
PressReleaseAPI
setToken(token)
: API 요청에 사용할 토큰 설정getPressReleases(page, limit)
: 보도자료 목록 조회getPressReleaseById(id)
: 특정 보도자료 조회