Skip to content

green1052/bser.js

Repository files navigation

bser.js

이터널 리턴 API 래퍼

빠른 시작

bun install bser.js
import {BserClient, Language, MatchingMode, MatchingTeamMode, RegionServerCode} from "bser.js";

const client = new BserClient({apiKey: "your-api-key"});

// 닉네임으로 유저 검색
const user = await client.user.getByNickname("닉네임");

// 최근 게임 기록 (최대 90일)
const games = await client.user.getGames(user.uid);

// 상위 랭커 조회
const top = await client.ranking.getTop(33, MatchingTeamMode.Squad);

// 언어 데이터 다운로드 경로
const {l10Path} = await client.data.getLanguage(Language.Korean);

옵션

옵션 필수 기본값 설명
apiKey - API 키
timeout 아니오 10000 요청 타임아웃 (ms)

API 구성

모듈 메서드
client.data getGameDataHash(), getGameData<T>(metaType), getLanguage(language), getWeaponRoutes(routeId?), getWeaponRouteDesc(routeId)
client.ranking getTop(seasonId, matchingTeamMode), getTopByServer(seasonId, matchingTeamMode, serverCode)
client.user getByNickname(nickname), getGames(uid), getRank(userId, seasonId, matchingTeamMode), getStats(userId, seasonId, matchingMode), getUnionTeam(userId, seasonId)
client.match getById(gameId)

전체 내용은 API 레퍼런스 를 참조하세요.

에러 처리

모든 메서드는 API 응답 code가 200이 아닌 경우 BserApiError 를 throw 합니다:

import {BserApiError} from "bser.js";

try {
    const user = await client.user.getByNickname("존재하지_않는_닉네임");
} catch (e) {
    if (e instanceof BserApiError) {
        console.log(e.code);       // 404
        console.log(e.apiMessage); // "..."
    }
}
Code 의미
200 성공
400 파라미터 오류
403 금지 / 레이트 리밋
404 찾을 수 없음
429 요청 과다
500 서버 오류

테스트

BSER_API_KEY=your-key bun test

통합 테스트는 실제 API 요청을 보내며, data → ranking → user → match 순서로 체인 실행됩니다.

문서

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors