maplestory-openapi 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -14
- package/dist/index.js +70 -43
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +71 -44
- package/package.json +4 -3
- package/types/maplestory/api/dto/cubeHistoryDto.d.ts +18 -18
- package/types/maplestory/api/dto/cubeHistoryResponseDto.d.ts +2 -2
- package/types/maplestory/api/dto/cubeResultOptionDto.d.ts +1 -1
- package/types/maplestory/api/mapleStoryApi.d.ts +29 -16
- package/types/maplestory/api/mapleStoryApiError.d.ts +18 -7
- package/types/maplestory/api/response/cubeHistoryDtoBody.d.ts +8 -8
- package/types/maplestory/api/response/cubeHistoryResponseDtoBody.d.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/maplestory-openapi)
|
|
4
4
|
|
|
5
|
-
This JavaScript library enables the use of the MapleStory OpenAPI
|
|
5
|
+
This JavaScript library enables the use of the MapleStory OpenAPI of Nexon.
|
|
6
6
|
|
|
7
7
|
Packages written in other languages can be found [HERE](https://github.com/SpiralMoon/maplestory.openapi).
|
|
8
8
|
|
|
@@ -13,11 +13,15 @@ Packages written in other languages can be found [HERE](https://github.com/Spira
|
|
|
13
13
|
Install the latest version of the JavaScript/TypeScript library in your npm project:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npm install maplestory-openapi@
|
|
16
|
+
npm install maplestory-openapi@2.0.0 # Replace with the latest version
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
|
+
### API Key
|
|
22
|
+
|
|
23
|
+
Before using the library, register your application and obtain an **api key** from the [Nexon Open API Console](https://openapi.nexon.com/my-application/).
|
|
24
|
+
|
|
21
25
|
### Supports
|
|
22
26
|
|
|
23
27
|
1. **CommonJS, ESM Support**: The library supports both CommonJS and ESM usage.
|
|
@@ -45,7 +49,7 @@ api.getCubeResult(1000, {
|
|
|
45
49
|
day: 15
|
|
46
50
|
})
|
|
47
51
|
.then((dto) => {
|
|
48
|
-
const {count,
|
|
52
|
+
const {count, cubeHistory, nextCursor} = dto;
|
|
49
53
|
|
|
50
54
|
console.log('You used ' + count + ' cubes.');
|
|
51
55
|
})
|
|
@@ -62,17 +66,18 @@ api.getCubeResult(1000, {
|
|
|
62
66
|
|
|
63
67
|
### Exception Handling
|
|
64
68
|
|
|
65
|
-
Handle `MapleStoryApiError` to safely make calls, ensuring that specific Status defined in the [MapleStory OpenAPI Guide](https://
|
|
69
|
+
Handle `MapleStoryApiError` to safely make calls, ensuring that specific Status defined in the [MapleStory OpenAPI Guide](https://openapi.nexon.com/guide/request-api) are not encountered.
|
|
66
70
|
|
|
67
71
|
While `MapleStoryApi` is designed to prevent the occurrence of certain Status, exceptions may arise due to developer mistakes.
|
|
68
72
|
|
|
69
|
-
Therefore, it's recommended to use `MapleStoryApiError` for exception handling based on the
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
73
|
+
Therefore, it's recommended to use `MapleStoryApiError` for exception handling based on the `MapleStoryApiErrorCode` list described in the table below.
|
|
74
|
+
|
|
75
|
+
| ErrorCode | Description |
|
|
76
|
+
|--------------|-------------------------------------------------|
|
|
77
|
+
| OPENAPI00001 | Internal server error |
|
|
78
|
+
| OPENAPI00002 | Access denied |
|
|
79
|
+
| OPENAPI00003 | Invalid identifier |
|
|
80
|
+
| OPENAPI00004 | Request format error (incorrect parameter input) |
|
|
81
|
+
| OPENAPI00005 | Invalid api key |
|
|
82
|
+
| OPENAPI00006 | Invalid api path |
|
|
83
|
+
| OPENAPI00007 | Request allowance (Rate Limit) exceeded |
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const potentialOptionGradeFromString = (text) => {
|
|
|
41
41
|
*/
|
|
42
42
|
class CubeResultOptionDto {
|
|
43
43
|
/**
|
|
44
|
-
* 옵션
|
|
44
|
+
* 옵션 명
|
|
45
45
|
*/
|
|
46
46
|
value;
|
|
47
47
|
/**
|
|
@@ -59,31 +59,31 @@ class CubeResultOptionDto {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* 큐브 히스토리
|
|
63
63
|
*/
|
|
64
64
|
class CubeHistoryDto {
|
|
65
65
|
/**
|
|
66
|
-
* 큐브
|
|
66
|
+
* 큐브 히스토리 식별자
|
|
67
67
|
*/
|
|
68
68
|
id;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* 캐릭터 명
|
|
71
71
|
*/
|
|
72
72
|
characterName;
|
|
73
73
|
/**
|
|
74
|
-
* 월드
|
|
74
|
+
* 월드 명
|
|
75
75
|
*/
|
|
76
76
|
worldName;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* 사용 일시
|
|
79
79
|
*/
|
|
80
|
-
|
|
80
|
+
dateCreate;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* 사용 큐브
|
|
83
83
|
*/
|
|
84
84
|
cubeType;
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* 사용 결과
|
|
87
87
|
*/
|
|
88
88
|
itemUpgradeResult;
|
|
89
89
|
/**
|
|
@@ -93,13 +93,13 @@ class CubeHistoryDto {
|
|
|
93
93
|
/**
|
|
94
94
|
* 장비 분류
|
|
95
95
|
*/
|
|
96
|
-
|
|
96
|
+
itemEquipmentPart;
|
|
97
97
|
/**
|
|
98
98
|
* 장비 레벨
|
|
99
99
|
*/
|
|
100
100
|
itemLevel;
|
|
101
101
|
/**
|
|
102
|
-
*
|
|
102
|
+
* 큐브 사용한 장비
|
|
103
103
|
*/
|
|
104
104
|
targetItem;
|
|
105
105
|
/**
|
|
@@ -119,41 +119,41 @@ class CubeHistoryDto {
|
|
|
119
119
|
*/
|
|
120
120
|
upgradeGuaranteeCount;
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* 사용 전 잠재능력 옵션
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
beforePotentialOption;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* 사용 전 에디셔널 잠재능력 옵션
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
beforeAdditionalPotentialOption;
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* 사용 후 잠재능력 옵션
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
afterPotentialOption;
|
|
133
133
|
/**
|
|
134
|
-
*
|
|
134
|
+
* 사용 후 에디셔널 잠재능력 옵션
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
afterAdditionalPotentialOption;
|
|
137
137
|
constructor(obj) {
|
|
138
|
-
const { id, character_name, world_name,
|
|
138
|
+
const { id, character_name, world_name, date_create, cube_type, item_upgrade_result, miracle_time_flag, item_equipment_part, item_level, target_item, potential_option_grade, additional_potential_option_grade, upgrade_guarantee, upgrade_guarantee_count, before_potential_option, before_additional_potential_option, after_potential_option, after_additional_potential_option } = obj;
|
|
139
139
|
this.id = id;
|
|
140
140
|
this.characterName = character_name;
|
|
141
141
|
this.worldName = world_name;
|
|
142
|
-
this.
|
|
142
|
+
this.dateCreate = new Date(date_create);
|
|
143
143
|
this.cubeType = cube_type;
|
|
144
144
|
this.itemUpgradeResult = item_upgrade_result;
|
|
145
145
|
this.miracleTimeFlag = miracle_time_flag;
|
|
146
|
-
this.
|
|
146
|
+
this.itemEquipmentPart = item_equipment_part;
|
|
147
147
|
this.itemLevel = item_level;
|
|
148
148
|
this.targetItem = target_item;
|
|
149
149
|
this.potentialOptionGrade = potential_option_grade;
|
|
150
150
|
this.additionalPotentialOptionGrade = additional_potential_option_grade;
|
|
151
|
-
this.upgradeGuarantee =
|
|
152
|
-
this.upgradeGuaranteeCount =
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
151
|
+
this.upgradeGuarantee = upgrade_guarantee;
|
|
152
|
+
this.upgradeGuaranteeCount = upgrade_guarantee_count;
|
|
153
|
+
this.beforePotentialOption = before_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
154
|
+
this.beforeAdditionalPotentialOption = before_additional_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
155
|
+
this.afterPotentialOption = after_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
156
|
+
this.afterAdditionalPotentialOption = after_additional_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
157
157
|
}
|
|
158
158
|
get isItemUpgrade() {
|
|
159
159
|
return this.itemUpgradeResult === '성공';
|
|
@@ -170,7 +170,7 @@ class CubeHistoryDto {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
*
|
|
173
|
+
* 큐브 히스토리 응답 정보
|
|
174
174
|
*/
|
|
175
175
|
class CubeHistoryResponseDto {
|
|
176
176
|
/**
|
|
@@ -180,15 +180,15 @@ class CubeHistoryResponseDto {
|
|
|
180
180
|
/**
|
|
181
181
|
* 큐브 히스토리
|
|
182
182
|
*/
|
|
183
|
-
|
|
183
|
+
cubeHistory;
|
|
184
184
|
/**
|
|
185
185
|
* 페이징 처리를 위한 cursor
|
|
186
186
|
*/
|
|
187
187
|
nextCursor;
|
|
188
188
|
constructor(obj) {
|
|
189
|
-
const { count,
|
|
189
|
+
const { count, cube_history, next_cursor } = obj;
|
|
190
190
|
this.count = count;
|
|
191
|
-
this.
|
|
191
|
+
this.cubeHistory = cube_history.map(origin => new CubeHistoryDto(origin));
|
|
192
192
|
this.nextCursor = next_cursor;
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -224,19 +224,42 @@ class InspectionInfoDto {
|
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* MapleStory OpenAPI error.<br>
|
|
227
|
-
* Please refer to <a href="https://
|
|
227
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error details.
|
|
228
228
|
*/
|
|
229
229
|
class MapleStoryApiError extends Error {
|
|
230
230
|
name = 'MapleStoryApiError';
|
|
231
|
-
|
|
231
|
+
errorCode;
|
|
232
232
|
message;
|
|
233
|
-
constructor(
|
|
234
|
-
const {
|
|
233
|
+
constructor(errorBody) {
|
|
234
|
+
const { name, message } = errorBody.error;
|
|
235
235
|
super(message);
|
|
236
|
-
this.
|
|
236
|
+
this.errorCode = errorMap[name];
|
|
237
237
|
this.message = message;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* MapleStory OpenAPI error codes.<br>
|
|
242
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error code details.
|
|
243
|
+
*/
|
|
244
|
+
exports.MapleStoryApiErrorCode = void 0;
|
|
245
|
+
(function (MapleStoryApiErrorCode) {
|
|
246
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00001"] = 0] = "OPENAPI00001";
|
|
247
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00002"] = 1] = "OPENAPI00002";
|
|
248
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00003"] = 2] = "OPENAPI00003";
|
|
249
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00004"] = 3] = "OPENAPI00004";
|
|
250
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00005"] = 4] = "OPENAPI00005";
|
|
251
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00006"] = 5] = "OPENAPI00006";
|
|
252
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00007"] = 6] = "OPENAPI00007";
|
|
253
|
+
})(exports.MapleStoryApiErrorCode || (exports.MapleStoryApiErrorCode = {}));
|
|
254
|
+
const errorMap = {
|
|
255
|
+
['OPENAPI00001']: exports.MapleStoryApiErrorCode.OPENAPI00001,
|
|
256
|
+
['OPENAPI00002']: exports.MapleStoryApiErrorCode.OPENAPI00002,
|
|
257
|
+
['OPENAPI00003']: exports.MapleStoryApiErrorCode.OPENAPI00003,
|
|
258
|
+
['OPENAPI00004']: exports.MapleStoryApiErrorCode.OPENAPI00004,
|
|
259
|
+
['OPENAPI00005']: exports.MapleStoryApiErrorCode.OPENAPI00005,
|
|
260
|
+
['OPENAPI00006']: exports.MapleStoryApiErrorCode.OPENAPI00006,
|
|
261
|
+
['OPENAPI00007']: exports.MapleStoryApiErrorCode.OPENAPI00007,
|
|
262
|
+
};
|
|
240
263
|
|
|
241
264
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
242
265
|
|
|
@@ -258,9 +281,13 @@ var utc = utc$1.exports;
|
|
|
258
281
|
|
|
259
282
|
dayjs__default["default"].extend(timezone);
|
|
260
283
|
dayjs__default["default"].extend(utc);
|
|
284
|
+
/**
|
|
285
|
+
* MapleStory OpenAPI client.<br>
|
|
286
|
+
* This is an implementation of <a href="https://openapi.nexon.com/game/maplestory">MapleStory API</a>
|
|
287
|
+
*/
|
|
261
288
|
class MapleStoryApi {
|
|
262
289
|
apiKey;
|
|
263
|
-
static
|
|
290
|
+
static BASE_URL = 'https://open.api.nexon.com/';
|
|
264
291
|
static kstOffset = 540;
|
|
265
292
|
timeout;
|
|
266
293
|
constructor(apiKey) {
|
|
@@ -280,16 +307,16 @@ class MapleStoryApi {
|
|
|
280
307
|
throw new Error('You can only retrieve data after 2022-11-25.');
|
|
281
308
|
}
|
|
282
309
|
const date = dayjs__default["default"](`${year}-${month}-${day}`).utcOffset(MapleStoryApi.kstOffset);
|
|
283
|
-
query.
|
|
310
|
+
query.date_kst = date.format('YYYYMMDD');
|
|
284
311
|
}
|
|
285
312
|
else {
|
|
286
313
|
const now = dayjs__default["default"]().utcOffset(MapleStoryApi.kstOffset);
|
|
287
|
-
query.
|
|
314
|
+
query.date_kst = now.format('YYYYMMDD');
|
|
288
315
|
}
|
|
289
316
|
try {
|
|
290
|
-
const path = '
|
|
317
|
+
const path = 'maplestory/v1/history/cube';
|
|
291
318
|
const response = await axios__default["default"].get(path, {
|
|
292
|
-
baseURL: MapleStoryApi.
|
|
319
|
+
baseURL: MapleStoryApi.BASE_URL,
|
|
293
320
|
timeout: this.timeout,
|
|
294
321
|
headers: this.buildHeaders(),
|
|
295
322
|
params: query
|
|
@@ -342,7 +369,7 @@ class MapleStoryApi {
|
|
|
342
369
|
}
|
|
343
370
|
buildHeaders() {
|
|
344
371
|
return {
|
|
345
|
-
'
|
|
372
|
+
'x-nxopen-api-key': this.apiKey
|
|
346
373
|
};
|
|
347
374
|
}
|
|
348
375
|
}
|
package/dist/index.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("dayjs"),require("xml2js")):"function"==typeof define&&define.amd?define(["exports","axios","dayjs","xml2js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["maplestory-openapi"]={},t.axios,t.dayjs,t.xml2js)}(this,(function(t,e,i,
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("dayjs"),require("xml2js")):"function"==typeof define&&define.amd?define(["exports","axios","dayjs","xml2js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["maplestory-openapi"]={},t.axios,t.dayjs,t.xml2js)}(this,(function(t,e,i,o){"use strict";function a(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var r,n=a(e),s=a(i),u=a(o);t.PotentialOptionGrade=void 0,(r=t.PotentialOptionGrade||(t.PotentialOptionGrade={}))[r.RARE=0]="RARE",r[r.EPIC=1]="EPIC",r[r.UNIQUE=2]="UNIQUE",r[r.LEGENDARY=3]="LEGENDARY";const l=e=>{const i={"레어":t.PotentialOptionGrade.RARE,"에픽":t.PotentialOptionGrade.EPIC,"유니크":t.PotentialOptionGrade.UNIQUE,"레전드리":t.PotentialOptionGrade.LEGENDARY}[e];if(!i)throw new TypeError("No enum constant for string: "+e);return i};class f{value;grade;constructor(t){const{value:e,grade:i}=t;this.value=e,this.grade=i}get gradeEnum(){return l(this.grade)}}class d{id;characterName;worldName;dateCreate;cubeType;itemUpgradeResult;miracleTimeFlag;itemEquipmentPart;itemLevel;targetItem;potentialOptionGrade;additionalPotentialOptionGrade;upgradeGuarantee;upgradeGuaranteeCount;beforePotentialOption;beforeAdditionalPotentialOption;afterPotentialOption;afterAdditionalPotentialOption;constructor(t){const{id:e,character_name:i,world_name:o,date_create:a,cube_type:r,item_upgrade_result:n,miracle_time_flag:s,item_equipment_part:u,item_level:l,target_item:d,potential_option_grade:p,additional_potential_option_grade:c,upgrade_guarantee:h,upgrade_guarantee_count:m,before_potential_option:O,before_additional_potential_option:g,after_potential_option:P,after_additional_potential_option:y}=t;this.id=e,this.characterName=i,this.worldName=o,this.dateCreate=new Date(a),this.cubeType=r,this.itemUpgradeResult=n,this.miracleTimeFlag=s,this.itemEquipmentPart=u,this.itemLevel=l,this.targetItem=d,this.potentialOptionGrade=p,this.additionalPotentialOptionGrade=c,this.upgradeGuarantee=h,this.upgradeGuaranteeCount=m,this.beforePotentialOption=O.map((t=>new f(t))),this.beforeAdditionalPotentialOption=g.map((t=>new f(t))),this.afterPotentialOption=P.map((t=>new f(t))),this.afterAdditionalPotentialOption=y.map((t=>new f(t)))}get isItemUpgrade(){return"성공"===this.itemUpgradeResult}get isMiracleTimeFlag(){return"이벤트 적용되지 않음"!==this.miracleTimeFlag}get potentialOptionGradeEnum(){return l(this.potentialOptionGrade)}get additionalPotentialOptionGradeEnum(){return l(this.additionalPotentialOptionGrade)}}class p{count;cubeHistory;nextCursor;constructor(t){const{count:e,cube_history:i,next_cursor:o}=t;this.count=e,this.cubeHistory=i.map((t=>new d(t))),this.nextCursor=o}}class c{serviceCode;startDateTime;endDateTime;strObstacleContents;constructor(t){const e=t["soap:Envelope"]["soap:Body"][0].GetInspectionInfoResponse[0].GetInspectionInfoResult[0]["diffgr:diffgram"][0].NewDataSet[0].InspectionInfo[0];this.serviceCode=Number(e.serviceCode[0]),this.startDateTime=new Date(e.startDateTime[0]),this.endDateTime=new Date(e.endDateTime[0]),this.strObstacleContents=e.strObstacleContents[0]}}class h extends Error{name="MapleStoryApiError";errorCode;message;constructor(t){const{name:e,message:i}=t.error;super(i),this.errorCode=O[e],this.message=i}}var m;t.MapleStoryApiErrorCode=void 0,(m=t.MapleStoryApiErrorCode||(t.MapleStoryApiErrorCode={}))[m.OPENAPI00001=0]="OPENAPI00001",m[m.OPENAPI00002=1]="OPENAPI00002",m[m.OPENAPI00003=2]="OPENAPI00003",m[m.OPENAPI00004=3]="OPENAPI00004",m[m.OPENAPI00005=4]="OPENAPI00005",m[m.OPENAPI00006=5]="OPENAPI00006",m[m.OPENAPI00007=6]="OPENAPI00007";const O={OPENAPI00001:t.MapleStoryApiErrorCode.OPENAPI00001,OPENAPI00002:t.MapleStoryApiErrorCode.OPENAPI00002,OPENAPI00003:t.MapleStoryApiErrorCode.OPENAPI00003,OPENAPI00004:t.MapleStoryApiErrorCode.OPENAPI00004,OPENAPI00005:t.MapleStoryApiErrorCode.OPENAPI00005,OPENAPI00006:t.MapleStoryApiErrorCode.OPENAPI00006,OPENAPI00007:t.MapleStoryApiErrorCode.OPENAPI00007};"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var g={exports:{}};!function(t,e){var i,o;t.exports=(i={year:0,month:1,day:2,hour:3,minute:4,second:5},o={},function(t,e,a){var r,n=function(t,e,i){void 0===i&&(i={});var a=new Date(t),r=function(t,e){void 0===e&&(e={});var i=e.timeZoneName||"short",a=t+"|"+i,r=o[a];return r||(r=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",timeZoneName:i}),o[a]=r),r}(e,i);return r.formatToParts(a)},s=function(t,e){for(var o=n(t,e),r=[],s=0;s<o.length;s+=1){var u=o[s],l=u.type,f=u.value,d=i[l];d>=0&&(r[d]=parseInt(f,10))}var p=r[3],c=24===p?0:p,h=r[0]+"-"+r[1]+"-"+r[2]+" "+c+":"+r[4]+":"+r[5]+":000",m=+t;return(a.utc(h).valueOf()-(m-=m%1e3))/6e4},u=e.prototype;u.tz=function(t,e){void 0===t&&(t=r);var i=this.utcOffset(),o=this.toDate(),n=o.toLocaleString("en-US",{timeZone:t}),s=Math.round((o-new Date(n))/1e3/60),u=a(n,{locale:this.$L}).$set("millisecond",this.$ms).utcOffset(15*-Math.round(o.getTimezoneOffset()/15)-s,!0);if(e){var l=u.utcOffset();u=u.add(i-l,"minute")}return u.$x.$timezone=t,u},u.offsetName=function(t){var e=this.$x.$timezone||a.tz.guess(),i=n(this.valueOf(),e,{timeZoneName:t}).find((function(t){return"timezonename"===t.type.toLowerCase()}));return i&&i.value};var l=u.startOf;u.startOf=function(t,e){if(!this.$x||!this.$x.$timezone)return l.call(this,t,e);var i=a(this.format("YYYY-MM-DD HH:mm:ss:SSS"),{locale:this.$L});return l.call(i,t,e).tz(this.$x.$timezone,!0)},a.tz=function(t,e,i){var o=i&&e,n=i||e||r,u=s(+a(),n);if("string"!=typeof t)return a(t).tz(n);var l=function(t,e,i){var o=t-60*e*1e3,a=s(o,i);if(e===a)return[o,e];var r=s(o-=60*(a-e)*1e3,i);return a===r?[o,a]:[t-60*Math.min(a,r)*1e3,Math.max(a,r)]}(a.utc(t,o).valueOf(),u,n),f=l[0],d=l[1],p=a(f).utcOffset(d);return p.$x.$timezone=n,p},a.tz.guess=function(){return Intl.DateTimeFormat().resolvedOptions().timeZone},a.tz.setDefault=function(t){r=t}})}(g);var P=g.exports,y={exports:{}};!function(t,e){var i,o,a;t.exports=(i="minute",o=/[+-]\d\d(?::?\d\d)?/g,a=/([+-]|\d\d)/g,function(t,e,r){var n=e.prototype;r.utc=function(t){return new e({date:t,utc:!0,args:arguments})},n.utc=function(t){var e=r(this.toDate(),{locale:this.$L,utc:!0});return t?e.add(this.utcOffset(),i):e},n.local=function(){return r(this.toDate(),{locale:this.$L,utc:!1})};var s=n.parse;n.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),s.call(this,t)};var u=n.init;n.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else u.call(this)};var l=n.utcOffset;n.utcOffset=function(t,e){var r=this.$utils().u;if(r(t))return this.$u?0:r(this.$offset)?l.call(this):this.$offset;if("string"==typeof t&&(t=function(t){void 0===t&&(t="");var e=t.match(o);if(!e)return null;var i=(""+e[0]).match(a)||["-",0,0],r=i[0],n=60*+i[1]+ +i[2];return 0===n?0:"+"===r?n:-n}(t),null===t))return this;var n=Math.abs(t)<=16?60*t:t,s=this;if(e)return s.$offset=n,s.$u=0===t,s;if(0!==t){var u=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(s=this.local().add(n+u,i)).$offset=n,s.$x.$localOffset=u}else s=this.utc();return s};var f=n.format;n.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return f.call(this,e)},n.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},n.isUTC=function(){return!!this.$u},n.toISOString=function(){return this.toDate().toISOString()},n.toString=function(){return this.toDate().toUTCString()};var d=n.toDate;n.toDate=function(t){return"s"===t&&this.$offset?r(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():d.call(this)};var p=n.diff;n.diff=function(t,e,i){if(t&&this.$u===t.$u)return p.call(this,t,e,i);var o=this.local(),a=r(t).local();return p.call(o,a,e,i)}})}(y);var E=y.exports;s.default.extend(P),s.default.extend(E);class v{apiKey;static BASE_URL="https://open.api.nexon.com/";static kstOffset=540;timeout;constructor(t){this.apiKey=t,this.timeout=5e3}async getCubeResult(t,i){const o={count:t};if("string"==typeof i)o.cursor=i;else if("object"==typeof i){const{year:t,month:e,day:a}=i;if(t<=2022&&e<=11&&a<25)throw new Error("You can only retrieve data after 2022-11-25.");const r=s.default(`${t}-${e}-${a}`).utcOffset(v.kstOffset);o.date_kst=r.format("YYYYMMDD")}else{const t=s.default().utcOffset(v.kstOffset);o.date_kst=t.format("YYYYMMDD")}try{const t="maplestory/v1/history/cube",e=await n.default.get(t,{baseURL:v.BASE_URL,timeout:this.timeout,headers:this.buildHeaders(),params:o});return new p(e.data)}catch(t){if(t instanceof e.AxiosError){const e=t.response.data;throw new h(e)}throw t}}async getInspectionInfo(){const t=(new u.default.Builder).buildObject({"soap:Envelope":{$:{"xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","xmlns:xsd":"http://www.w3.org/2001/XMLSchema","xmlns:soap":"http://schemas.xmlsoap.org/soap/envelope/"},"soap:Body":{GetInspectionInfo:{$:{xmlns:"https://api.maplestory.nexon.com/soap/"}}}}}),e=await n.default.post("soap/maplestory.asmx",t,{baseURL:"https://api.maplestory.nexon.com/",timeout:this.timeout,headers:{SOAPAction:"https://api.maplestory.nexon.com/soap/GetInspectionInfo","Content-Type":"text/xml; charset=utf-8"}}),i=await u.default.parseStringPromise(e.data);return new c(i)}buildHeaders(){return{"x-nxopen-api-key":this.apiKey}}}t.CubeHistoryDto=d,t.CubeHistoryResponseDto=p,t.CubeResultOptionDto=f,t.InspectionInfoDto=c,t.MapleStoryApi=v,t.MapleStoryApiError=h,t.potentialOptionGradeFromString=l}));
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ const potentialOptionGradeFromString = (text) => {
|
|
|
33
33
|
*/
|
|
34
34
|
class CubeResultOptionDto {
|
|
35
35
|
/**
|
|
36
|
-
* 옵션
|
|
36
|
+
* 옵션 명
|
|
37
37
|
*/
|
|
38
38
|
value;
|
|
39
39
|
/**
|
|
@@ -51,31 +51,31 @@ class CubeResultOptionDto {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* 큐브 히스토리
|
|
55
55
|
*/
|
|
56
56
|
class CubeHistoryDto {
|
|
57
57
|
/**
|
|
58
|
-
* 큐브
|
|
58
|
+
* 큐브 히스토리 식별자
|
|
59
59
|
*/
|
|
60
60
|
id;
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* 캐릭터 명
|
|
63
63
|
*/
|
|
64
64
|
characterName;
|
|
65
65
|
/**
|
|
66
|
-
* 월드
|
|
66
|
+
* 월드 명
|
|
67
67
|
*/
|
|
68
68
|
worldName;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* 사용 일시
|
|
71
71
|
*/
|
|
72
|
-
|
|
72
|
+
dateCreate;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* 사용 큐브
|
|
75
75
|
*/
|
|
76
76
|
cubeType;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* 사용 결과
|
|
79
79
|
*/
|
|
80
80
|
itemUpgradeResult;
|
|
81
81
|
/**
|
|
@@ -85,13 +85,13 @@ class CubeHistoryDto {
|
|
|
85
85
|
/**
|
|
86
86
|
* 장비 분류
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
itemEquipmentPart;
|
|
89
89
|
/**
|
|
90
90
|
* 장비 레벨
|
|
91
91
|
*/
|
|
92
92
|
itemLevel;
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
94
|
+
* 큐브 사용한 장비
|
|
95
95
|
*/
|
|
96
96
|
targetItem;
|
|
97
97
|
/**
|
|
@@ -111,41 +111,41 @@ class CubeHistoryDto {
|
|
|
111
111
|
*/
|
|
112
112
|
upgradeGuaranteeCount;
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* 사용 전 잠재능력 옵션
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
beforePotentialOption;
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
118
|
+
* 사용 전 에디셔널 잠재능력 옵션
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
beforeAdditionalPotentialOption;
|
|
121
121
|
/**
|
|
122
|
-
*
|
|
122
|
+
* 사용 후 잠재능력 옵션
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
afterPotentialOption;
|
|
125
125
|
/**
|
|
126
|
-
*
|
|
126
|
+
* 사용 후 에디셔널 잠재능력 옵션
|
|
127
127
|
*/
|
|
128
|
-
|
|
128
|
+
afterAdditionalPotentialOption;
|
|
129
129
|
constructor(obj) {
|
|
130
|
-
const { id, character_name, world_name,
|
|
130
|
+
const { id, character_name, world_name, date_create, cube_type, item_upgrade_result, miracle_time_flag, item_equipment_part, item_level, target_item, potential_option_grade, additional_potential_option_grade, upgrade_guarantee, upgrade_guarantee_count, before_potential_option, before_additional_potential_option, after_potential_option, after_additional_potential_option } = obj;
|
|
131
131
|
this.id = id;
|
|
132
132
|
this.characterName = character_name;
|
|
133
133
|
this.worldName = world_name;
|
|
134
|
-
this.
|
|
134
|
+
this.dateCreate = new Date(date_create);
|
|
135
135
|
this.cubeType = cube_type;
|
|
136
136
|
this.itemUpgradeResult = item_upgrade_result;
|
|
137
137
|
this.miracleTimeFlag = miracle_time_flag;
|
|
138
|
-
this.
|
|
138
|
+
this.itemEquipmentPart = item_equipment_part;
|
|
139
139
|
this.itemLevel = item_level;
|
|
140
140
|
this.targetItem = target_item;
|
|
141
141
|
this.potentialOptionGrade = potential_option_grade;
|
|
142
142
|
this.additionalPotentialOptionGrade = additional_potential_option_grade;
|
|
143
|
-
this.upgradeGuarantee =
|
|
144
|
-
this.upgradeGuaranteeCount =
|
|
145
|
-
this.
|
|
146
|
-
this.
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
143
|
+
this.upgradeGuarantee = upgrade_guarantee;
|
|
144
|
+
this.upgradeGuaranteeCount = upgrade_guarantee_count;
|
|
145
|
+
this.beforePotentialOption = before_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
146
|
+
this.beforeAdditionalPotentialOption = before_additional_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
147
|
+
this.afterPotentialOption = after_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
148
|
+
this.afterAdditionalPotentialOption = after_additional_potential_option.map(origin => new CubeResultOptionDto(origin));
|
|
149
149
|
}
|
|
150
150
|
get isItemUpgrade() {
|
|
151
151
|
return this.itemUpgradeResult === '성공';
|
|
@@ -162,7 +162,7 @@ class CubeHistoryDto {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
165
|
+
* 큐브 히스토리 응답 정보
|
|
166
166
|
*/
|
|
167
167
|
class CubeHistoryResponseDto {
|
|
168
168
|
/**
|
|
@@ -172,15 +172,15 @@ class CubeHistoryResponseDto {
|
|
|
172
172
|
/**
|
|
173
173
|
* 큐브 히스토리
|
|
174
174
|
*/
|
|
175
|
-
|
|
175
|
+
cubeHistory;
|
|
176
176
|
/**
|
|
177
177
|
* 페이징 처리를 위한 cursor
|
|
178
178
|
*/
|
|
179
179
|
nextCursor;
|
|
180
180
|
constructor(obj) {
|
|
181
|
-
const { count,
|
|
181
|
+
const { count, cube_history, next_cursor } = obj;
|
|
182
182
|
this.count = count;
|
|
183
|
-
this.
|
|
183
|
+
this.cubeHistory = cube_history.map(origin => new CubeHistoryDto(origin));
|
|
184
184
|
this.nextCursor = next_cursor;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -216,19 +216,42 @@ class InspectionInfoDto {
|
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* MapleStory OpenAPI error.<br>
|
|
219
|
-
* Please refer to <a href="https://
|
|
219
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error details.
|
|
220
220
|
*/
|
|
221
221
|
class MapleStoryApiError extends Error {
|
|
222
222
|
name = 'MapleStoryApiError';
|
|
223
|
-
|
|
223
|
+
errorCode;
|
|
224
224
|
message;
|
|
225
|
-
constructor(
|
|
226
|
-
const {
|
|
225
|
+
constructor(errorBody) {
|
|
226
|
+
const { name, message } = errorBody.error;
|
|
227
227
|
super(message);
|
|
228
|
-
this.
|
|
228
|
+
this.errorCode = errorMap[name];
|
|
229
229
|
this.message = message;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
+
/**
|
|
233
|
+
* MapleStory OpenAPI error codes.<br>
|
|
234
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error code details.
|
|
235
|
+
*/
|
|
236
|
+
var MapleStoryApiErrorCode;
|
|
237
|
+
(function (MapleStoryApiErrorCode) {
|
|
238
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00001"] = 0] = "OPENAPI00001";
|
|
239
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00002"] = 1] = "OPENAPI00002";
|
|
240
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00003"] = 2] = "OPENAPI00003";
|
|
241
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00004"] = 3] = "OPENAPI00004";
|
|
242
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00005"] = 4] = "OPENAPI00005";
|
|
243
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00006"] = 5] = "OPENAPI00006";
|
|
244
|
+
MapleStoryApiErrorCode[MapleStoryApiErrorCode["OPENAPI00007"] = 6] = "OPENAPI00007";
|
|
245
|
+
})(MapleStoryApiErrorCode || (MapleStoryApiErrorCode = {}));
|
|
246
|
+
const errorMap = {
|
|
247
|
+
['OPENAPI00001']: MapleStoryApiErrorCode.OPENAPI00001,
|
|
248
|
+
['OPENAPI00002']: MapleStoryApiErrorCode.OPENAPI00002,
|
|
249
|
+
['OPENAPI00003']: MapleStoryApiErrorCode.OPENAPI00003,
|
|
250
|
+
['OPENAPI00004']: MapleStoryApiErrorCode.OPENAPI00004,
|
|
251
|
+
['OPENAPI00005']: MapleStoryApiErrorCode.OPENAPI00005,
|
|
252
|
+
['OPENAPI00006']: MapleStoryApiErrorCode.OPENAPI00006,
|
|
253
|
+
['OPENAPI00007']: MapleStoryApiErrorCode.OPENAPI00007,
|
|
254
|
+
};
|
|
232
255
|
|
|
233
256
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
234
257
|
|
|
@@ -250,9 +273,13 @@ var utc = utc$1.exports;
|
|
|
250
273
|
|
|
251
274
|
dayjs.extend(timezone);
|
|
252
275
|
dayjs.extend(utc);
|
|
276
|
+
/**
|
|
277
|
+
* MapleStory OpenAPI client.<br>
|
|
278
|
+
* This is an implementation of <a href="https://openapi.nexon.com/game/maplestory">MapleStory API</a>
|
|
279
|
+
*/
|
|
253
280
|
class MapleStoryApi {
|
|
254
281
|
apiKey;
|
|
255
|
-
static
|
|
282
|
+
static BASE_URL = 'https://open.api.nexon.com/';
|
|
256
283
|
static kstOffset = 540;
|
|
257
284
|
timeout;
|
|
258
285
|
constructor(apiKey) {
|
|
@@ -272,16 +299,16 @@ class MapleStoryApi {
|
|
|
272
299
|
throw new Error('You can only retrieve data after 2022-11-25.');
|
|
273
300
|
}
|
|
274
301
|
const date = dayjs(`${year}-${month}-${day}`).utcOffset(MapleStoryApi.kstOffset);
|
|
275
|
-
query.
|
|
302
|
+
query.date_kst = date.format('YYYYMMDD');
|
|
276
303
|
}
|
|
277
304
|
else {
|
|
278
305
|
const now = dayjs().utcOffset(MapleStoryApi.kstOffset);
|
|
279
|
-
query.
|
|
306
|
+
query.date_kst = now.format('YYYYMMDD');
|
|
280
307
|
}
|
|
281
308
|
try {
|
|
282
|
-
const path = '
|
|
309
|
+
const path = 'maplestory/v1/history/cube';
|
|
283
310
|
const response = await axios.get(path, {
|
|
284
|
-
baseURL: MapleStoryApi.
|
|
311
|
+
baseURL: MapleStoryApi.BASE_URL,
|
|
285
312
|
timeout: this.timeout,
|
|
286
313
|
headers: this.buildHeaders(),
|
|
287
314
|
params: query
|
|
@@ -334,9 +361,9 @@ class MapleStoryApi {
|
|
|
334
361
|
}
|
|
335
362
|
buildHeaders() {
|
|
336
363
|
return {
|
|
337
|
-
'
|
|
364
|
+
'x-nxopen-api-key': this.apiKey
|
|
338
365
|
};
|
|
339
366
|
}
|
|
340
367
|
}
|
|
341
368
|
|
|
342
|
-
export { CubeHistoryDto, CubeHistoryResponseDto, CubeResultOptionDto, InspectionInfoDto, MapleStoryApi, MapleStoryApiError, PotentialOptionGrade, potentialOptionGradeFromString };
|
|
369
|
+
export { CubeHistoryDto, CubeHistoryResponseDto, CubeResultOptionDto, InspectionInfoDto, MapleStoryApi, MapleStoryApiError, MapleStoryApiErrorCode, PotentialOptionGrade, potentialOptionGradeFromString };
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "maplestory-openapi",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "This JavaScript library enables the use of the MapleStory OpenAPI
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "This JavaScript library enables the use of the MapleStory OpenAPI of Nexon.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maplestory",
|
|
7
7
|
"maplestory openapi",
|
|
8
8
|
"maplestory api",
|
|
9
9
|
"cube",
|
|
10
10
|
"nexon",
|
|
11
|
-
"nexon developers"
|
|
11
|
+
"nexon developers",
|
|
12
|
+
"nexon openapi"
|
|
12
13
|
],
|
|
13
14
|
"homepage": "https://github.com/SpiralMoon/maplestory.openapi",
|
|
14
15
|
"bugs": {
|
|
@@ -2,31 +2,31 @@ import { CubeResultOptionDto } from "./cubeResultOptionDto";
|
|
|
2
2
|
import { CubeHistoryDtoBody } from "../response/cubeHistoryDtoBody";
|
|
3
3
|
import { PotentialOptionGrade } from "./potentialOptionGrade";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* 큐브 히스토리
|
|
6
6
|
*/
|
|
7
7
|
declare class CubeHistoryDto {
|
|
8
8
|
/**
|
|
9
|
-
* 큐브
|
|
9
|
+
* 큐브 히스토리 식별자
|
|
10
10
|
*/
|
|
11
11
|
id: string;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 캐릭터 명
|
|
14
14
|
*/
|
|
15
15
|
characterName: string;
|
|
16
16
|
/**
|
|
17
|
-
* 월드
|
|
17
|
+
* 월드 명
|
|
18
18
|
*/
|
|
19
19
|
worldName: string;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 사용 일시
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
dateCreate: Date;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 사용 큐브
|
|
26
26
|
*/
|
|
27
27
|
cubeType: string;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 사용 결과
|
|
30
30
|
*/
|
|
31
31
|
itemUpgradeResult: string;
|
|
32
32
|
/**
|
|
@@ -36,13 +36,13 @@ declare class CubeHistoryDto {
|
|
|
36
36
|
/**
|
|
37
37
|
* 장비 분류
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
itemEquipmentPart: string;
|
|
40
40
|
/**
|
|
41
41
|
* 장비 레벨
|
|
42
42
|
*/
|
|
43
43
|
itemLevel: number;
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 큐브 사용한 장비
|
|
46
46
|
*/
|
|
47
47
|
targetItem: string;
|
|
48
48
|
/**
|
|
@@ -62,21 +62,21 @@ declare class CubeHistoryDto {
|
|
|
62
62
|
*/
|
|
63
63
|
upgradeGuaranteeCount: number;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* 사용 전 잠재능력 옵션
|
|
66
66
|
*/
|
|
67
|
-
|
|
67
|
+
beforePotentialOption: CubeResultOptionDto[];
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* 사용 전 에디셔널 잠재능력 옵션
|
|
70
70
|
*/
|
|
71
|
-
|
|
71
|
+
beforeAdditionalPotentialOption: CubeResultOptionDto[];
|
|
72
72
|
/**
|
|
73
|
-
*
|
|
73
|
+
* 사용 후 잠재능력 옵션
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
afterPotentialOption: CubeResultOptionDto[];
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
77
|
+
* 사용 후 에디셔널 잠재능력 옵션
|
|
78
78
|
*/
|
|
79
|
-
|
|
79
|
+
afterAdditionalPotentialOption: CubeResultOptionDto[];
|
|
80
80
|
constructor(obj: CubeHistoryDtoBody);
|
|
81
81
|
get isItemUpgrade(): boolean;
|
|
82
82
|
get isMiracleTimeFlag(): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CubeHistoryDto } from "./cubeHistoryDto";
|
|
2
2
|
import { CubeHistoryResponseDtoBody } from "../response/cubeHistoryResponseDtoBody";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 큐브 히스토리 응답 정보
|
|
5
5
|
*/
|
|
6
6
|
declare class CubeHistoryResponseDto {
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ declare class CubeHistoryResponseDto {
|
|
|
11
11
|
/**
|
|
12
12
|
* 큐브 히스토리
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
cubeHistory: CubeHistoryDto[];
|
|
15
15
|
/**
|
|
16
16
|
* 페이징 처리를 위한 cursor
|
|
17
17
|
*/
|
|
@@ -1,35 +1,42 @@
|
|
|
1
1
|
import { CubeHistoryResponseDto } from "./dto/cubeHistoryResponseDto";
|
|
2
2
|
import { InspectionInfoDto } from "./dto/inspectionInfoDto";
|
|
3
|
+
/**
|
|
4
|
+
* MapleStory OpenAPI client.<br>
|
|
5
|
+
* This is an implementation of <a href="https://openapi.nexon.com/game/maplestory">MapleStory API</a>
|
|
6
|
+
*/
|
|
3
7
|
declare class MapleStoryApi {
|
|
4
8
|
private readonly apiKey;
|
|
5
|
-
private static
|
|
9
|
+
private static BASE_URL;
|
|
6
10
|
private static kstOffset;
|
|
7
11
|
timeout: number;
|
|
8
12
|
constructor(apiKey: string);
|
|
9
13
|
/**
|
|
10
|
-
* 오늘 날짜의
|
|
11
|
-
* 데이터는
|
|
12
|
-
* 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
14
|
+
* 오늘 날짜의 큐브 사용 결과를 조회합니다.<br>
|
|
15
|
+
* 큐브 사용 결과 데이터는 매일 오전 4시, 전일 데이터가 갱신됩니다.<br>
|
|
16
|
+
* 큐브 사용 결과 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
17
|
+
* e.g. 오늘 오후 3시 5분 큐브 확률 정보 조회 시, 어제의 큐브 확률 정보 데이터를 조회할 수 있습니다.<br>
|
|
13
18
|
*
|
|
14
|
-
* @param count 한번에 가져오려는 결과의
|
|
19
|
+
* @param count 한번에 가져오려는 결과의 개수(최소 10, 최대 1000)
|
|
15
20
|
*/
|
|
16
21
|
getCubeResult(count: number): Promise<CubeHistoryResponseDto>;
|
|
17
22
|
/**
|
|
18
|
-
* 지목한 날짜의
|
|
19
|
-
* 데이터는
|
|
20
|
-
* 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
23
|
+
* 지목한 날짜의 큐브 사용 결과를 조회합니다.<br>
|
|
24
|
+
* 큐브 사용 결과 데이터는 매일 오전 4시, 전일 데이터가 갱신됩니다.<br>
|
|
25
|
+
* 큐브 사용 결과 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
26
|
+
* e.g. 오늘 오후 3시 5분 큐브 확률 정보 조회 시, 어제의 큐브 확률 정보 데이터를 조회할 수 있습니다.<br>
|
|
21
27
|
*
|
|
22
|
-
* @param count 한번에 가져오려는 결과의
|
|
23
|
-
* @param dateOptions
|
|
28
|
+
* @param count 한번에 가져오려는 결과의 개수(최소 10, 최대 1000)
|
|
29
|
+
* @param dateOptions 조회 기준일 (KST)
|
|
24
30
|
*/
|
|
25
31
|
getCubeResult(count: number, dateOptions: DateOptions): Promise<CubeHistoryResponseDto>;
|
|
26
32
|
/**
|
|
27
|
-
*
|
|
28
|
-
* 데이터는
|
|
29
|
-
* 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
33
|
+
* 큐브 사용 결과를 조회합니다.<br>
|
|
34
|
+
* 큐브 사용 결과 데이터는 매일 오전 4시, 전일 데이터가 갱신됩니다.<br>
|
|
35
|
+
* 큐브 사용 결과 데이터는 2022년 11월 25일부터 조회할 수 있습니다.<br>
|
|
36
|
+
* e.g. 오늘 오후 3시 5분 큐브 확률 정보 조회 시, 어제의 큐브 확률 정보 데이터를 조회할 수 있습니다.<br>
|
|
30
37
|
*
|
|
31
|
-
* @param count 한번에 가져오려는 결과의
|
|
32
|
-
* @param cursor
|
|
38
|
+
* @param count 한번에 가져오려는 결과의 개수(최소 10, 최대 1000)
|
|
39
|
+
* @param cursor 페이징 처리를 위한 cursor
|
|
33
40
|
*/
|
|
34
41
|
getCubeResult(count: number, cursor: string): Promise<CubeHistoryResponseDto>;
|
|
35
42
|
/**
|
|
@@ -43,4 +50,10 @@ type DateOptions = {
|
|
|
43
50
|
month: number;
|
|
44
51
|
day: number;
|
|
45
52
|
};
|
|
46
|
-
|
|
53
|
+
type MapleStoryErrorBody = {
|
|
54
|
+
error: {
|
|
55
|
+
name: string;
|
|
56
|
+
message: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export { MapleStoryApi, MapleStoryErrorBody };
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
+
import { MapleStoryErrorBody } from "./mapleStoryApi";
|
|
1
2
|
/**
|
|
2
3
|
* MapleStory OpenAPI error.<br>
|
|
3
|
-
* Please refer to <a href="https://
|
|
4
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error details.
|
|
4
5
|
*/
|
|
5
6
|
declare class MapleStoryApiError extends Error {
|
|
6
7
|
readonly name = "MapleStoryApiError";
|
|
7
|
-
readonly
|
|
8
|
+
readonly errorCode: MapleStoryApiErrorCode;
|
|
8
9
|
readonly message: string;
|
|
9
|
-
constructor(
|
|
10
|
-
status: number;
|
|
11
|
-
message: string;
|
|
12
|
-
});
|
|
10
|
+
constructor(errorBody: MapleStoryErrorBody);
|
|
13
11
|
}
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* MapleStory OpenAPI error codes.<br>
|
|
14
|
+
* Please refer to <a href="https://openapi.nexon.com/guide/request-api/">MapleStory API guide</a> for the error code details.
|
|
15
|
+
*/
|
|
16
|
+
declare enum MapleStoryApiErrorCode {
|
|
17
|
+
OPENAPI00001 = 0,
|
|
18
|
+
OPENAPI00002 = 1,
|
|
19
|
+
OPENAPI00003 = 2,
|
|
20
|
+
OPENAPI00004 = 3,
|
|
21
|
+
OPENAPI00005 = 4,
|
|
22
|
+
OPENAPI00006 = 5,
|
|
23
|
+
OPENAPI00007 = 6
|
|
24
|
+
}
|
|
25
|
+
export { MapleStoryApiError, MapleStoryApiErrorCode };
|
|
@@ -3,20 +3,20 @@ type CubeHistoryDtoBody = {
|
|
|
3
3
|
id: string;
|
|
4
4
|
character_name: string;
|
|
5
5
|
world_name: string;
|
|
6
|
-
|
|
6
|
+
date_create: string;
|
|
7
7
|
cube_type: string;
|
|
8
8
|
item_upgrade_result: string;
|
|
9
9
|
miracle_time_flag: string;
|
|
10
|
-
|
|
10
|
+
item_equipment_part: string;
|
|
11
11
|
item_level: number;
|
|
12
12
|
target_item: string;
|
|
13
13
|
potential_option_grade: string;
|
|
14
14
|
additional_potential_option_grade: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
upgrade_guarantee: boolean;
|
|
16
|
+
upgrade_guarantee_count: number;
|
|
17
|
+
before_potential_option: CubeResultOptionDtoBody[];
|
|
18
|
+
before_additional_potential_option: CubeResultOptionDtoBody[];
|
|
19
|
+
after_potential_option: CubeResultOptionDtoBody[];
|
|
20
|
+
after_additional_potential_option: CubeResultOptionDtoBody[];
|
|
21
21
|
};
|
|
22
22
|
export type { CubeHistoryDtoBody };
|