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
21
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 provided by Nexon.

  • 1.1.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 provided by 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@1.1.0 # Replace with the latest version

Usage

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.getCubeResult(1000, {
    year: 2023,
    month: 10,
    day: 15
})
    .then((dto) => {
        const {count, cubeHistories, 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 Status list described in the table below.

StatusMessage
400Request format error (incorrect parameter input)
401Unauthorized service (unsupported service, service type)
403Unauthorized AccessToken usage
429AccessToken's request allowance (Rate Limit) exceeded
500Internal server error
504Internal server processing timeout

Keywords

FAQs

Package last updated on 03 Dec 2023

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