npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

maplestory-openapi

v2.7.2

Published

This JavaScript library enables the use of the MapleStory OpenAPI of Nexon.

Downloads

47

Readme

MapleStory OpenAPI JavaScript Library

npm JS

넥슨의 MapleStory OpenAPI를 Javascript 환경에서 사용할 수 있게 해주는 라이브러리입니다.

다른 언어로 작성된 패키지는 여기에서 확인할 수 있습니다.

(English document is HERE)

Installation

npm 기반 프로젝트에 아래 정보를 입력하여 패키지를 추가하세요:

npm install maplestory-openapi

Usage

API Key

라이브러리를 사용하기 전에 Nexon Open API 콘솔에서 애플리케이션을 등록하고 api key를 발급 받으세요.

Supports

  1. CommonJS, ESM 지원: 이 라이브러리는 CommonJS 와 ESM 방식을 모두 지원합니다.
const {MapleStoryApi, MapleStoryApiError} = require('maplestory-openapi'); // CommonJS
import {MapleStoryApi, MapleStoryApiError} from 'maplestory-openapi'; // ESM
  1. TypeScript 지원: 타입 정의가 포함되어 있으므로 타입스크립트 환경에서도 사용 가능합니다.

Sample Code

아래 코드는 닉네임을 바탕으로 특정 캐릭터의 식별자를 조회한 후 캐릭터의 기본 정보를 조회하는 예시입니다.

const {MapleStoryApi, MapleStoryApiError} = require('maplestory-openapi');

const apiKey = '{Your API Key}';
const api = new MapleStoryApi(apiKey);

try {
  // run your code
  
  const character = await api.getCharacter('{Your Character Name}');
  const characterBasic = await api.getCharacterBasic(character.ocid);
  
  console.log(characterBasic);
} catch (e) {
  // exception handling
  
  if (e instanceof MapleStoryApiError) {
    // handle MapleStoryApiError
  } else {
    // handle other errors
  }
}

더 많은 예시는 아래 링크의 테스트 케이스에서 확인할 수 있습니다.

Exception Handling

MapleStory OpenAPI 가이드에 서술된 에러 사유를 MapleStoryApiError를 통해 예외 처리 해야합니다.

MapleStoryApi는 특정 상태의 예외를 발생시키지 않도록 설계되었으나, 라이브러리를 사용하는 개발자의 실수로 인해 여전히 일부 상태의 예외가 발생할 수 있습니다.

따라서 아래 표에 설명된 MapleStoryApiErrorCode 목록을 기반으로 MapleStoryApiError를 예외 처리하시기 바랍니다.

| ErrorCode | Description | |--------------|--------------------| | OPENAPI00001 | 서버 내부 오류 | | OPENAPI00002 | 권한이 없는 경우 | | OPENAPI00003 | 유효하지 않은 식별자 | | OPENAPI00004 | 파라미터 누락 또는 유효하지 않음 | | OPENAPI00005 | 유효하지 않은 API KEY | | OPENAPI00006 | 유효하지 않은 API PATH | | OPENAPI00007 | API 호출량 초과 | | OPENAPI00009 | 데이터 준비 중 | | OPENAPI00010 | 게임 점검 중 | | OPENAPI00011 | API 점검 중 |