Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

maplestory-openapi

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maplestory-openapi

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

  • 2.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
674
increased by554.37%
Maintainers
1
Weekly downloads
 
Created
Source

MapleStory OpenAPI JavaScript Library

npm

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

Packages written in other languages can be found HERE.

(한국어 문서는 이쪽입니다.)

Installation

Install the latest version of the JavaScript/TypeScript library in your npm project:

npm install maplestory-openapi@2.4.0 # Replace with the latest version

Usage

API Key

Before using the library, register your application and obtain an api key from the Nexon Open API Console.

Supports

  1. CommonJS, ESM Support: The library supports both CommonJS and ESM usage.
const {MapleStoryApi, MapleStoryApiError} = require('maplestory-openapi'); // CommonJS
import {MapleStoryApi, MapleStoryApiError} from 'maplestory-openapi'; // ESM
  1. TypeScript Support: TypeScript is fully supported. Type definitions are included.

Sample Code

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

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

api.getCubeHistory(1000, {
    year: 2023,
    month: 10,
    day: 15
})
    .then((dto) => {
        const {count, cubeHistory, nextCursor} = dto;

        console.log('You used ' + count + ' cubes.');
    })
    .catch((e) => {
        if (e instanceof MapleStoryApiError) {
            // handle MapleStoryApiError
        } else {
            // handle other errors
        }

        console.log(e);
    });

Exception Handling

Handle MapleStoryApiError to safely make calls, ensuring that specific Status defined in the MapleStory OpenAPI Guide are not encountered.

While MapleStoryApi is designed to prevent the occurrence of certain Status, exceptions may arise due to developer mistakes.

Therefore, it's recommended to use MapleStoryApiError for exception handling based on the MapleStoryApiErrorCode list described in the table below.

ErrorCodeDescription
OPENAPI00001Internal server error
OPENAPI00002Access denied
OPENAPI00003Invalid identifier
OPENAPI00004Request format error (incorrect parameter input)
OPENAPI00005Invalid api key
OPENAPI00006Invalid api path
OPENAPI00007Request allowance (Rate Limit) exceeded

Keywords

FAQs

Package last updated on 26 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc