maplestory-openapi 2.12.1 → 2.13.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/dist/index.js CHANGED
@@ -7345,6 +7345,78 @@ class UnionArtifactDto {
7345
7345
  }
7346
7346
  }
7347
7347
 
7348
+ /**
7349
+ * 유니온 챔피언 휘장 정보
7350
+ */
7351
+ class UnionChampionBadgeInfoDto {
7352
+ /**
7353
+ * 유니온 챔피언 휘장 효과
7354
+ */
7355
+ stat;
7356
+ constructor(obj) {
7357
+ const { stat } = obj;
7358
+ this.stat = stat;
7359
+ }
7360
+ }
7361
+
7362
+ /**
7363
+ * 유니온 챔피언 상세 정보
7364
+ */
7365
+ class UnionChampionInfoDto {
7366
+ /**
7367
+ * 유니온 챔피언 캐릭터 명
7368
+ */
7369
+ championName;
7370
+ /**
7371
+ * 유니온 챔피언 슬롯
7372
+ */
7373
+ championSlot;
7374
+ /**
7375
+ * 유니온 챔피언 등급
7376
+ */
7377
+ championGrade;
7378
+ /**
7379
+ * 유니온 챔피언 캐릭터의 직업
7380
+ */
7381
+ championClass;
7382
+ /**
7383
+ * 챔피언 휘장 효과
7384
+ */
7385
+ championBadgeInfo;
7386
+ constructor(obj) {
7387
+ const { champion_name, champion_slot, champion_grade, champion_class, champion_badge_info } = obj;
7388
+ this.championName = champion_name;
7389
+ this.championSlot = champion_slot;
7390
+ this.championGrade = champion_grade;
7391
+ this.championClass = champion_class;
7392
+ this.championBadgeInfo = champion_badge_info.map((info) => new UnionChampionBadgeInfoDto(info));
7393
+ }
7394
+ }
7395
+
7396
+ /**
7397
+ * 유니온 챔피언 정보
7398
+ */
7399
+ class UnionChampionDto {
7400
+ /**
7401
+ * 조회 기준일
7402
+ */
7403
+ date;
7404
+ /**
7405
+ * 유니온 챔피언 정보
7406
+ */
7407
+ unionChampion;
7408
+ /**
7409
+ * 유니온 챔피언 휘장 정보
7410
+ */
7411
+ championBadgeTotalInfo;
7412
+ constructor(obj) {
7413
+ const { date, union_champion, champion_badge_total_info } = obj;
7414
+ this.date = date ? new Date(date) : null;
7415
+ this.unionChampion = union_champion.map((info) => new UnionChampionInfoDto(info));
7416
+ this.championBadgeTotalInfo = champion_badge_total_info.map((info) => new UnionChampionBadgeInfoDto(info));
7417
+ }
7418
+ }
7419
+
7348
7420
  /**
7349
7421
  * 유니온 정보
7350
7422
  */
@@ -7622,78 +7694,6 @@ const errorMap = {
7622
7694
  ['OPENAPI00011']: exports.MapleStoryApiErrorCode.OPENAPI00011,
7623
7695
  };
7624
7696
 
7625
- /**
7626
- * 유니온 챔피언 휘장 정보
7627
- */
7628
- class UnionChampionBadgeInfoDto {
7629
- /**
7630
- * 유니온 챔피언 휘장 효과
7631
- */
7632
- stat;
7633
- constructor(obj) {
7634
- const { stat } = obj;
7635
- this.stat = stat;
7636
- }
7637
- }
7638
-
7639
- /**
7640
- * 유니온 챔피언 상세 정보
7641
- */
7642
- class UnionChampionInfoDto {
7643
- /**
7644
- * 유니온 챔피언 캐릭터 명
7645
- */
7646
- championName;
7647
- /**
7648
- * 유니온 챔피언 슬롯
7649
- */
7650
- championSlot;
7651
- /**
7652
- * 유니온 챔피언 등급
7653
- */
7654
- championGrade;
7655
- /**
7656
- * 유니온 챔피언 캐릭터의 직업
7657
- */
7658
- championClass;
7659
- /**
7660
- * 챔피언 휘장 효과
7661
- */
7662
- championBadgeInfo;
7663
- constructor(obj) {
7664
- const { champion_name, champion_slot, champion_grade, champion_class, champion_badge_info } = obj;
7665
- this.championName = champion_name;
7666
- this.championSlot = champion_slot;
7667
- this.championGrade = champion_grade;
7668
- this.championClass = champion_class;
7669
- this.championBadgeInfo = champion_badge_info.map((info) => new UnionChampionBadgeInfoDto(info));
7670
- }
7671
- }
7672
-
7673
- /**
7674
- * 유니온 챔피언 정보
7675
- */
7676
- class UnionChampionDto {
7677
- /**
7678
- * 조회 기준일
7679
- */
7680
- date;
7681
- /**
7682
- * 유니온 챔피언 정보
7683
- */
7684
- unionChampion;
7685
- /**
7686
- * 유니온 챔피언 휘장 정보
7687
- */
7688
- championBadgeTotalInfo;
7689
- constructor(obj) {
7690
- const { date, union_champion, champion_badge_total_info } = obj;
7691
- this.date = date ? new Date(date) : null;
7692
- this.unionChampion = union_champion.map((info) => new UnionChampionInfoDto(info));
7693
- this.championBadgeTotalInfo = champion_badge_total_info.map((info) => new UnionChampionBadgeInfoDto(info));
7694
- }
7695
- }
7696
-
7697
7697
  dayjs__default["default"].extend(timezone);
7698
7698
  dayjs__default["default"].extend(utc);
7699
7699
  /**
@@ -7705,7 +7705,6 @@ class MapleStoryApi {
7705
7705
  client;
7706
7706
  static BASE_URL = 'https://open.api.nexon.com/';
7707
7707
  static DEFAULT_TIMEOUT = 5000;
7708
- static kstOffset = 540;
7709
7708
  get timeout() {
7710
7709
  return this.client.defaults.timeout;
7711
7710
  }
@@ -7772,11 +7771,11 @@ class MapleStoryApi {
7772
7771
  async getCharacterBasic(ocid, dateOptions) {
7773
7772
  const path = 'maplestory/v1/character/basic';
7774
7773
  const date = dateOptions
7775
- ? MapleStoryApi.toDateString({
7774
+ ? toDateString(dateOptions, {
7776
7775
  year: 2023,
7777
7776
  month: 12,
7778
7777
  day: 21,
7779
- }, dateOptions)
7778
+ })
7780
7779
  : undefined;
7781
7780
  const query = {
7782
7781
  ocid: ocid,
@@ -7860,11 +7859,11 @@ class MapleStoryApi {
7860
7859
  async getCharacterPopularity(ocid, dateOptions) {
7861
7860
  const path = 'maplestory/v1/character/popularity';
7862
7861
  const date = dateOptions
7863
- ? MapleStoryApi.toDateString({
7862
+ ? toDateString(dateOptions, {
7864
7863
  year: 2023,
7865
7864
  month: 12,
7866
7865
  day: 21,
7867
- }, dateOptions)
7866
+ })
7868
7867
  : undefined;
7869
7868
  const query = {
7870
7869
  ocid: ocid,
@@ -7888,11 +7887,11 @@ class MapleStoryApi {
7888
7887
  async getCharacterStat(ocid, dateOptions) {
7889
7888
  const path = 'maplestory/v1/character/stat';
7890
7889
  const date = dateOptions
7891
- ? MapleStoryApi.toDateString({
7890
+ ? toDateString(dateOptions, {
7892
7891
  year: 2023,
7893
7892
  month: 12,
7894
7893
  day: 21,
7895
- }, dateOptions)
7894
+ })
7896
7895
  : undefined;
7897
7896
  const query = {
7898
7897
  ocid: ocid,
@@ -7916,11 +7915,11 @@ class MapleStoryApi {
7916
7915
  async getCharacterHyperStat(ocid, dateOptions) {
7917
7916
  const path = 'maplestory/v1/character/hyper-stat';
7918
7917
  const date = dateOptions
7919
- ? MapleStoryApi.toDateString({
7918
+ ? toDateString(dateOptions, {
7920
7919
  year: 2023,
7921
7920
  month: 12,
7922
7921
  day: 21,
7923
- }, dateOptions)
7922
+ })
7924
7923
  : undefined;
7925
7924
  const query = {
7926
7925
  ocid: ocid,
@@ -7944,11 +7943,11 @@ class MapleStoryApi {
7944
7943
  async getCharacterPropensity(ocid, dateOptions) {
7945
7944
  const path = 'maplestory/v1/character/propensity';
7946
7945
  const date = dateOptions
7947
- ? MapleStoryApi.toDateString({
7946
+ ? toDateString(dateOptions, {
7948
7947
  year: 2023,
7949
7948
  month: 12,
7950
7949
  day: 21,
7951
- }, dateOptions)
7950
+ })
7952
7951
  : undefined;
7953
7952
  const query = {
7954
7953
  ocid: ocid,
@@ -7972,11 +7971,11 @@ class MapleStoryApi {
7972
7971
  async getCharacterAbility(ocid, dateOptions) {
7973
7972
  const path = 'maplestory/v1/character/ability';
7974
7973
  const date = dateOptions
7975
- ? MapleStoryApi.toDateString({
7974
+ ? toDateString(dateOptions, {
7976
7975
  year: 2023,
7977
7976
  month: 12,
7978
7977
  day: 21,
7979
- }, dateOptions)
7978
+ })
7980
7979
  : undefined;
7981
7980
  const query = {
7982
7981
  ocid: ocid,
@@ -8000,11 +7999,11 @@ class MapleStoryApi {
8000
7999
  async getCharacterItemEquipment(ocid, dateOptions) {
8001
8000
  const path = 'maplestory/v1/character/item-equipment';
8002
8001
  const date = dateOptions
8003
- ? MapleStoryApi.toDateString({
8002
+ ? toDateString(dateOptions, {
8004
8003
  year: 2023,
8005
8004
  month: 12,
8006
8005
  day: 21,
8007
- }, dateOptions)
8006
+ })
8008
8007
  : undefined;
8009
8008
  const query = {
8010
8009
  ocid: ocid,
@@ -8028,11 +8027,11 @@ class MapleStoryApi {
8028
8027
  async getCharacterCashItemEquipment(ocid, dateOptions) {
8029
8028
  const path = 'maplestory/v1/character/cashitem-equipment';
8030
8029
  const date = dateOptions
8031
- ? MapleStoryApi.toDateString({
8030
+ ? toDateString(dateOptions, {
8032
8031
  year: 2023,
8033
8032
  month: 12,
8034
8033
  day: 21,
8035
- }, dateOptions)
8034
+ })
8036
8035
  : undefined;
8037
8036
  const query = {
8038
8037
  ocid: ocid,
@@ -8056,11 +8055,11 @@ class MapleStoryApi {
8056
8055
  async getCharacterSymbolEquipment(ocid, dateOptions) {
8057
8056
  const path = 'maplestory/v1/character/symbol-equipment';
8058
8057
  const date = dateOptions
8059
- ? MapleStoryApi.toDateString({
8058
+ ? toDateString(dateOptions, {
8060
8059
  year: 2023,
8061
8060
  month: 12,
8062
8061
  day: 21,
8063
- }, dateOptions)
8062
+ })
8064
8063
  : undefined;
8065
8064
  const query = {
8066
8065
  ocid: ocid,
@@ -8084,11 +8083,11 @@ class MapleStoryApi {
8084
8083
  async getCharacterSetEffect(ocid, dateOptions) {
8085
8084
  const path = 'maplestory/v1/character/set-effect';
8086
8085
  const date = dateOptions
8087
- ? MapleStoryApi.toDateString({
8086
+ ? toDateString(dateOptions, {
8088
8087
  year: 2023,
8089
8088
  month: 12,
8090
8089
  day: 21,
8091
- }, dateOptions)
8090
+ })
8092
8091
  : undefined;
8093
8092
  const query = {
8094
8093
  ocid: ocid,
@@ -8111,13 +8110,16 @@ class MapleStoryApi {
8111
8110
  */
8112
8111
  async getCharacterBeautyEquipment(ocid, dateOptions) {
8113
8112
  const path = 'maplestory/v1/character/beauty-equipment';
8114
- const query = {
8115
- ocid: ocid,
8116
- date: dateOptions ? MapleStoryApi.toDateString({
8113
+ const date = dateOptions
8114
+ ? toDateString(dateOptions, {
8117
8115
  year: 2023,
8118
8116
  month: 12,
8119
8117
  day: 21,
8120
- }, dateOptions) : undefined,
8118
+ })
8119
+ : undefined;
8120
+ const query = {
8121
+ ocid: ocid,
8122
+ date: date,
8121
8123
  };
8122
8124
  const { data } = await this.client.get(path, {
8123
8125
  params: query,
@@ -8137,11 +8139,11 @@ class MapleStoryApi {
8137
8139
  async getCharacterAndroidEquipment(ocid, dateOptions) {
8138
8140
  const path = 'maplestory/v1/character/android-equipment';
8139
8141
  const date = dateOptions
8140
- ? MapleStoryApi.toDateString({
8142
+ ? toDateString(dateOptions, {
8141
8143
  year: 2023,
8142
8144
  month: 12,
8143
8145
  day: 21,
8144
- }, dateOptions)
8146
+ })
8145
8147
  : undefined;
8146
8148
  const query = {
8147
8149
  ocid: ocid,
@@ -8165,11 +8167,11 @@ class MapleStoryApi {
8165
8167
  async getCharacterPetEquipment(ocid, dateOptions) {
8166
8168
  const path = 'maplestory/v1/character/pet-equipment';
8167
8169
  const date = dateOptions
8168
- ? MapleStoryApi.toDateString({
8170
+ ? toDateString(dateOptions, {
8169
8171
  year: 2023,
8170
8172
  month: 12,
8171
8173
  day: 21,
8172
- }, dateOptions)
8174
+ })
8173
8175
  : undefined;
8174
8176
  const query = {
8175
8177
  ocid: ocid,
@@ -8205,11 +8207,11 @@ class MapleStoryApi {
8205
8207
  async getCharacterSkill(ocid, characterSkillGrade, dateOptions) {
8206
8208
  const path = 'maplestory/v1/character/skill';
8207
8209
  const date = dateOptions
8208
- ? MapleStoryApi.toDateString({
8210
+ ? toDateString(dateOptions, {
8209
8211
  year: 2023,
8210
8212
  month: 12,
8211
8213
  day: 21,
8212
- }, dateOptions)
8214
+ })
8213
8215
  : undefined;
8214
8216
  const query = {
8215
8217
  ocid: ocid,
@@ -8234,11 +8236,11 @@ class MapleStoryApi {
8234
8236
  async getCharacterLinkSkill(ocid, dateOptions) {
8235
8237
  const path = 'maplestory/v1/character/link-skill';
8236
8238
  const date = dateOptions
8237
- ? MapleStoryApi.toDateString({
8239
+ ? toDateString(dateOptions, {
8238
8240
  year: 2023,
8239
8241
  month: 12,
8240
8242
  day: 21,
8241
- }, dateOptions)
8243
+ })
8242
8244
  : undefined;
8243
8245
  const query = {
8244
8246
  ocid: ocid,
@@ -8262,11 +8264,11 @@ class MapleStoryApi {
8262
8264
  async getCharacterVMatrix(ocid, dateOptions) {
8263
8265
  const path = 'maplestory/v1/character/vmatrix';
8264
8266
  const date = dateOptions
8265
- ? MapleStoryApi.toDateString({
8267
+ ? toDateString(dateOptions, {
8266
8268
  year: 2023,
8267
8269
  month: 12,
8268
8270
  day: 21,
8269
- }, dateOptions)
8271
+ })
8270
8272
  : undefined;
8271
8273
  const query = {
8272
8274
  ocid: ocid,
@@ -8290,11 +8292,11 @@ class MapleStoryApi {
8290
8292
  async getCharacterHexaMatrix(ocid, dateOptions) {
8291
8293
  const path = 'maplestory/v1/character/hexamatrix';
8292
8294
  const date = dateOptions
8293
- ? MapleStoryApi.toDateString({
8295
+ ? toDateString(dateOptions, {
8294
8296
  year: 2023,
8295
8297
  month: 12,
8296
8298
  day: 21,
8297
- }, dateOptions)
8299
+ })
8298
8300
  : undefined;
8299
8301
  const query = {
8300
8302
  ocid: ocid,
@@ -8318,11 +8320,11 @@ class MapleStoryApi {
8318
8320
  async getCharacterHexaMatrixStat(ocid, dateOptions) {
8319
8321
  const path = 'maplestory/v1/character/hexamatrix-stat';
8320
8322
  const date = dateOptions
8321
- ? MapleStoryApi.toDateString({
8323
+ ? toDateString(dateOptions, {
8322
8324
  year: 2023,
8323
8325
  month: 12,
8324
8326
  day: 21,
8325
- }, dateOptions)
8327
+ })
8326
8328
  : undefined;
8327
8329
  const query = {
8328
8330
  ocid: ocid,
@@ -8346,11 +8348,11 @@ class MapleStoryApi {
8346
8348
  async getCharacterDojang(ocid, dateOptions) {
8347
8349
  const path = 'maplestory/v1/character/dojang';
8348
8350
  const date = dateOptions
8349
- ? MapleStoryApi.toDateString({
8351
+ ? toDateString(dateOptions, {
8350
8352
  year: 2023,
8351
8353
  month: 12,
8352
8354
  day: 21,
8353
- }, dateOptions)
8355
+ })
8354
8356
  : undefined;
8355
8357
  const query = {
8356
8358
  ocid: ocid,
@@ -8376,11 +8378,11 @@ class MapleStoryApi {
8376
8378
  async getUnion(ocid, dateOptions) {
8377
8379
  const path = 'maplestory/v1/user/union';
8378
8380
  const date = dateOptions
8379
- ? MapleStoryApi.toDateString({
8381
+ ? toDateString(dateOptions, {
8380
8382
  year: 2023,
8381
8383
  month: 12,
8382
8384
  day: 21,
8383
- }, dateOptions)
8385
+ })
8384
8386
  : undefined;
8385
8387
  const query = {
8386
8388
  ocid: ocid,
@@ -8404,11 +8406,11 @@ class MapleStoryApi {
8404
8406
  async getUnionRaider(ocid, dateOptions) {
8405
8407
  const path = 'maplestory/v1/user/union-raider';
8406
8408
  const date = dateOptions
8407
- ? MapleStoryApi.toDateString({
8409
+ ? toDateString(dateOptions, {
8408
8410
  year: 2023,
8409
8411
  month: 12,
8410
8412
  day: 21,
8411
- }, dateOptions)
8413
+ })
8412
8414
  : undefined;
8413
8415
  const query = {
8414
8416
  ocid: ocid,
@@ -8432,11 +8434,11 @@ class MapleStoryApi {
8432
8434
  async getUnionArtifact(ocid, dateOptions) {
8433
8435
  const path = 'maplestory/v1/user/union-artifact';
8434
8436
  const date = dateOptions
8435
- ? MapleStoryApi.toDateString({
8437
+ ? toDateString(dateOptions, {
8436
8438
  year: 2023,
8437
8439
  month: 12,
8438
8440
  day: 21,
8439
- }, dateOptions)
8441
+ })
8440
8442
  : undefined;
8441
8443
  const query = {
8442
8444
  ocid: ocid,
@@ -8461,11 +8463,11 @@ class MapleStoryApi {
8461
8463
  async getUnionChampion(ocid, dateOptions) {
8462
8464
  const path = 'maplestory/v1/user/union-champion';
8463
8465
  const date = dateOptions
8464
- ? MapleStoryApi.toDateString({
8466
+ ? toDateString(dateOptions, {
8465
8467
  year: 2023,
8466
8468
  month: 12,
8467
8469
  day: 21,
8468
- }, dateOptions)
8470
+ })
8469
8471
  : undefined;
8470
8472
  const query = {
8471
8473
  ocid: ocid,
@@ -8511,11 +8513,11 @@ class MapleStoryApi {
8511
8513
  async getGuildBasic(guildId, dateOptions) {
8512
8514
  const path = 'maplestory/v1/guild/basic';
8513
8515
  const date = dateOptions
8514
- ? MapleStoryApi.toDateString({
8516
+ ? toDateString(dateOptions, {
8515
8517
  year: 2023,
8516
8518
  month: 12,
8517
8519
  day: 21,
8518
- }, dateOptions)
8520
+ })
8519
8521
  : undefined;
8520
8522
  const query = {
8521
8523
  oguild_id: guildId,
@@ -8535,16 +8537,16 @@ class MapleStoryApi {
8535
8537
  query.cursor = parameter;
8536
8538
  }
8537
8539
  else if (typeof parameter === 'object' || parameter === undefined) {
8538
- query.date = MapleStoryApi.toDateString({
8539
- year: 2023,
8540
- month: 12,
8541
- day: 27,
8542
- }, parameter ??
8543
- MapleStoryApi.getProperDefaultDateOptions({
8540
+ query.date = toDateString(parameter ??
8541
+ getProperDefaultDateOptions({
8544
8542
  hour: 0,
8545
8543
  minute: 0,
8546
8544
  dateOffset: 0,
8547
- }));
8545
+ }), {
8546
+ year: 2023,
8547
+ month: 12,
8548
+ day: 27,
8549
+ });
8548
8550
  }
8549
8551
  const { data } = await this.client.get(path, {
8550
8552
  params: query,
@@ -8560,15 +8562,11 @@ class MapleStoryApi {
8560
8562
  query.cursor = parameter;
8561
8563
  }
8562
8564
  else if (typeof parameter === 'object' || parameter === undefined) {
8563
- query.date = MapleStoryApi.toDateString({
8564
- year: 2022,
8565
- month: 11,
8566
- day: 25,
8567
- }, parameter ??
8568
- MapleStoryApi.getProperDefaultDateOptions({
8569
- hour: 4,
8565
+ query.date = toDateString(parameter ??
8566
+ getProperDefaultDateOptions({
8567
+ hour: 0,
8570
8568
  minute: 0,
8571
- dateOffset: 1,
8569
+ dateOffset: 0,
8572
8570
  }));
8573
8571
  }
8574
8572
  const { data } = await this.client.get(path, {
@@ -8585,16 +8583,16 @@ class MapleStoryApi {
8585
8583
  query.cursor = parameter;
8586
8584
  }
8587
8585
  else if (typeof parameter === 'object' || parameter === undefined) {
8588
- query.date = MapleStoryApi.toDateString({
8586
+ query.date = toDateString(parameter ??
8587
+ getProperDefaultDateOptions({
8588
+ hour: 0,
8589
+ minute: 0,
8590
+ dateOffset: 0,
8591
+ }), {
8589
8592
  year: 2024,
8590
8593
  month: 1,
8591
8594
  day: 25,
8592
- }, parameter ??
8593
- MapleStoryApi.getProperDefaultDateOptions({
8594
- hour: 4,
8595
- minute: 0,
8596
- dateOffset: 1,
8597
- }));
8595
+ });
8598
8596
  }
8599
8597
  const { data } = await this.client.get(path, {
8600
8598
  params: query,
@@ -8613,18 +8611,18 @@ class MapleStoryApi {
8613
8611
  * @param dateOptions 조회 기준일 (KST).
8614
8612
  *
8615
8613
  */
8616
- async getOverallRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8614
+ async getOverallRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8617
8615
  hour: 8,
8618
8616
  minute: 30,
8619
8617
  dateOffset: 0,
8620
8618
  })) {
8621
8619
  const path = 'maplestory/v1/ranking/overall';
8622
8620
  const query = {
8623
- date: MapleStoryApi.toDateString({
8621
+ date: toDateString(dateOptions, {
8624
8622
  year: 2023,
8625
8623
  month: 12,
8626
8624
  day: 22,
8627
- }, dateOptions),
8625
+ }),
8628
8626
  };
8629
8627
  if (filterOptions) {
8630
8628
  const { worldName, worldType, characterClass, ocid, page } = filterOptions;
@@ -8648,18 +8646,18 @@ class MapleStoryApi {
8648
8646
  * @param filterOptions 검색 기준
8649
8647
  * @param dateOptions 조회 기준일 (KST)
8650
8648
  */
8651
- async getUnionRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8649
+ async getUnionRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8652
8650
  hour: 8,
8653
8651
  minute: 30,
8654
8652
  dateOffset: 0,
8655
8653
  })) {
8656
8654
  const path = 'maplestory/v1/ranking/union';
8657
8655
  const query = {
8658
- date: MapleStoryApi.toDateString({
8656
+ date: toDateString(dateOptions, {
8659
8657
  year: 2023,
8660
8658
  month: 12,
8661
8659
  day: 22,
8662
- }, dateOptions),
8660
+ }),
8663
8661
  };
8664
8662
  if (filterOptions) {
8665
8663
  const { worldName, ocid, page } = filterOptions;
@@ -8681,18 +8679,18 @@ class MapleStoryApi {
8681
8679
  * @param filterOptions 검색 기준
8682
8680
  * @param dateOptions 조회 기준일 (KST)
8683
8681
  */
8684
- async getGuildRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8682
+ async getGuildRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8685
8683
  hour: 8,
8686
8684
  minute: 30,
8687
8685
  dateOffset: 0,
8688
8686
  })) {
8689
8687
  const path = 'maplestory/v1/ranking/guild';
8690
8688
  const query = {
8691
- date: MapleStoryApi.toDateString({
8689
+ date: toDateString(dateOptions, {
8692
8690
  year: 2023,
8693
8691
  month: 12,
8694
8692
  day: 22,
8695
- }, dateOptions),
8693
+ }),
8696
8694
  ranking_type: 0,
8697
8695
  };
8698
8696
  if (filterOptions) {
@@ -8716,18 +8714,18 @@ class MapleStoryApi {
8716
8714
  * @param filterOptions 검색 기준
8717
8715
  * @param dateOptions 조회 기준일 (KST)
8718
8716
  */
8719
- async getDojangRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8717
+ async getDojangRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8720
8718
  hour: 8,
8721
8719
  minute: 30,
8722
8720
  dateOffset: 0,
8723
8721
  })) {
8724
8722
  const path = 'maplestory/v1/ranking/dojang';
8725
8723
  const query = {
8726
- date: MapleStoryApi.toDateString({
8724
+ date: toDateString(dateOptions, {
8727
8725
  year: 2023,
8728
8726
  month: 12,
8729
8727
  day: 22,
8730
- }, dateOptions),
8728
+ }),
8731
8729
  difficulty: 0,
8732
8730
  };
8733
8731
  if (filterOptions) {
@@ -8752,18 +8750,18 @@ class MapleStoryApi {
8752
8750
  * @param filterOptions 검색 기준
8753
8751
  * @param dateOptions 조회 기준일 (KST)
8754
8752
  */
8755
- async getSeedRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8753
+ async getSeedRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8756
8754
  hour: 8,
8757
8755
  minute: 30,
8758
8756
  dateOffset: 0,
8759
8757
  })) {
8760
8758
  const path = 'maplestory/v1/ranking/theseed';
8761
8759
  const query = {
8762
- date: MapleStoryApi.toDateString({
8760
+ date: toDateString(dateOptions, {
8763
8761
  year: 2023,
8764
8762
  month: 12,
8765
8763
  day: 22,
8766
- }, dateOptions),
8764
+ }),
8767
8765
  };
8768
8766
  if (filterOptions) {
8769
8767
  const { worldName, ocid, page } = filterOptions;
@@ -8785,18 +8783,18 @@ class MapleStoryApi {
8785
8783
  * @param filterOptions 검색 기준
8786
8784
  * @param dateOptions 조회 기준일 (KST)
8787
8785
  */
8788
- async getAchievementRanking(filterOptions, dateOptions = MapleStoryApi.getProperDefaultDateOptions({
8786
+ async getAchievementRanking(filterOptions, dateOptions = getProperDefaultDateOptions({
8789
8787
  hour: 8,
8790
8788
  minute: 30,
8791
8789
  dateOffset: 0,
8792
8790
  })) {
8793
8791
  const path = 'maplestory/v1/ranking/achievement';
8794
8792
  const query = {
8795
- date: MapleStoryApi.toDateString({
8793
+ date: toDateString(dateOptions, {
8796
8794
  year: 2023,
8797
8795
  month: 12,
8798
8796
  day: 22,
8799
- }, dateOptions),
8797
+ }),
8800
8798
  };
8801
8799
  if (filterOptions) {
8802
8800
  const { ocid, page } = filterOptions;
@@ -8959,53 +8957,55 @@ class MapleStoryApi {
8959
8957
  const xml = (await xml2js__default["default"].parseStringPromise(response.data));
8960
8958
  return new InspectionInfoDto(xml);
8961
8959
  }
8962
- /**
8963
- * API 서버의 데이터 갱신 시간에 따라 데이터가 조회 가능한 최신 날짜를 반환합니다.
8964
- *
8965
- * @param options
8966
- * @private
8967
- */
8968
- static getProperDefaultDateOptions(options) {
8969
- const { hour, minute, dateOffset } = options;
8970
- const kstNow = dayjs__default["default"]().utcOffset(MapleStoryApi.kstOffset);
8971
- const updateDate = dayjs__default["default"]()
8972
- .utcOffset(MapleStoryApi.kstOffset)
8973
- .hour(hour)
8974
- .minute(minute);
8975
- let adjustedDate;
8976
- if (kstNow.isAfter(updateDate)) {
8977
- adjustedDate = kstNow;
8978
- }
8979
- else {
8980
- adjustedDate = kstNow.subtract(1, 'day');
8981
- }
8982
- adjustedDate = adjustedDate.subtract(dateOffset ?? 0, 'day');
8983
- return {
8984
- year: adjustedDate.year(),
8985
- month: adjustedDate.month() + 1,
8986
- day: adjustedDate.date(),
8987
- };
8988
- }
8989
- /**
8990
- * 날짜 정보를 API 서버에서 요구하는 포맷으로 변환합니다.
8991
- *
8992
- * @param minDateOptions API 호출 가능한 최소 날짜
8993
- * @param dateOptions 조회 하려는 날짜
8994
- * @private
8995
- */
8996
- static toDateString(minDateOptions, dateOptions) {
8960
+ }
8961
+ const KST_OFFSET = 540;
8962
+ /**
8963
+ * API 서버의 데이터 갱신 시간에 따라 데이터가 조회 가능한 최신 날짜를 반환합니다.
8964
+ *
8965
+ * @param options
8966
+ */
8967
+ const getProperDefaultDateOptions = (options) => {
8968
+ const { hour, minute, dateOffset } = options;
8969
+ const kstNow = dayjs__default["default"]().utcOffset(KST_OFFSET);
8970
+ const updateDate = dayjs__default["default"]()
8971
+ .utcOffset(KST_OFFSET)
8972
+ .hour(hour)
8973
+ .minute(minute);
8974
+ let adjustedDate;
8975
+ if (kstNow.isAfter(updateDate)) {
8976
+ adjustedDate = kstNow;
8977
+ }
8978
+ else {
8979
+ adjustedDate = kstNow.subtract(1, 'day');
8980
+ }
8981
+ adjustedDate = adjustedDate.subtract(dateOffset ?? 0, 'day');
8982
+ return {
8983
+ year: adjustedDate.year(),
8984
+ month: adjustedDate.month() + 1,
8985
+ day: adjustedDate.date(),
8986
+ };
8987
+ };
8988
+ /**
8989
+ * 날짜 정보를 API 서버에서 요구하는 포맷으로 변환합니다.
8990
+ *
8991
+ * @param dateOptions 조회 하려는 날짜
8992
+ * @param minDateOptions API 호출 가능한 최소 날짜
8993
+ */
8994
+ const toDateString = (dateOptions, minDateOptions) => {
8995
+ const { year, month, day } = dateOptions;
8996
+ const str = dayjs__default["default"](`${year}-${month}-${day}`)
8997
+ .utcOffset(KST_OFFSET)
8998
+ .format('YYYY-MM-DD');
8999
+ if (minDateOptions) {
8997
9000
  const { year: minYear, month: minMonth, day: minDay } = minDateOptions;
8998
- const { year, month, day } = dateOptions;
8999
9001
  if (year < minYear ||
9000
9002
  (year === minYear && month < minMonth) ||
9001
9003
  (year === minYear && month === minMonth && day < minDay)) {
9002
9004
  throw new Error(`You can only retrieve data after ${dayjs__default["default"](`${minYear}-${minMonth}-${minDay}`).format('YYYY-MM-DD')}.`);
9003
9005
  }
9004
- return dayjs__default["default"](`${year}-${month}-${day}`)
9005
- .utcOffset(MapleStoryApi.kstOffset)
9006
- .format('YYYY-MM-DD');
9007
9006
  }
9008
- }
9007
+ return str;
9008
+ };
9009
9009
 
9010
9010
  exports.AchievementRankingDto = AchievementRankingDto;
9011
9011
  exports.AchievementRankingResponseDto = AchievementRankingResponseDto;