deliveryapi 1.8.1 → 1.11.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.cjs +403 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1011 -373
- package/dist/index.d.ts +1011 -373
- package/dist/index.js +411 -19
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
8
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,14 +20,51 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
20
|
}
|
|
16
21
|
return to;
|
|
17
22
|
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
18
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
32
|
|
|
33
|
+
// ../shared-types/dist/courier/CourierDeliveryStatus.js
|
|
34
|
+
var require_CourierDeliveryStatus = __commonJS({
|
|
35
|
+
"../shared-types/dist/courier/CourierDeliveryStatus.js"(exports2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38
|
+
exports2.CourierDeliveryStatus = void 0;
|
|
39
|
+
var CourierDeliveryStatus2;
|
|
40
|
+
(function(CourierDeliveryStatus3) {
|
|
41
|
+
CourierDeliveryStatus3["PENDING"] = "PENDING";
|
|
42
|
+
CourierDeliveryStatus3["REGISTERED"] = "REGISTERED";
|
|
43
|
+
CourierDeliveryStatus3["PICKUP_READY"] = "PICKUP_READY";
|
|
44
|
+
CourierDeliveryStatus3["PICKED_UP"] = "PICKED_UP";
|
|
45
|
+
CourierDeliveryStatus3["IN_TRANSIT"] = "IN_TRANSIT";
|
|
46
|
+
CourierDeliveryStatus3["OUT_FOR_DELIVERY"] = "OUT_FOR_DELIVERY";
|
|
47
|
+
CourierDeliveryStatus3["DELIVERED"] = "DELIVERED";
|
|
48
|
+
CourierDeliveryStatus3["FAILED"] = "FAILED";
|
|
49
|
+
CourierDeliveryStatus3["RETURNED"] = "RETURNED";
|
|
50
|
+
CourierDeliveryStatus3["CANCELLED"] = "CANCELLED";
|
|
51
|
+
CourierDeliveryStatus3["HOLD"] = "HOLD";
|
|
52
|
+
CourierDeliveryStatus3["UNKNOWN"] = "UNKNOWN";
|
|
53
|
+
})(CourierDeliveryStatus2 || (exports2.CourierDeliveryStatus = CourierDeliveryStatus2 = {}));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
20
57
|
// src/index.ts
|
|
21
58
|
var index_exports = {};
|
|
22
59
|
__export(index_exports, {
|
|
60
|
+
AccountsResource: () => AccountsResource,
|
|
23
61
|
ApiError: () => ApiError,
|
|
24
|
-
CourierDeliveryStatus: () => CourierDeliveryStatus,
|
|
25
|
-
|
|
62
|
+
CourierDeliveryStatus: () => import_CourierDeliveryStatus.CourierDeliveryStatus,
|
|
63
|
+
CourierResource: () => CourierResource,
|
|
64
|
+
DeliveriesResource: () => DeliveriesResource,
|
|
65
|
+
DeliveryAPIClient: () => DeliveryAPIClient,
|
|
66
|
+
HistoriesResource: () => HistoriesResource,
|
|
67
|
+
PrintResource: () => PrintResource
|
|
26
68
|
});
|
|
27
69
|
module.exports = __toCommonJS(index_exports);
|
|
28
70
|
|
|
@@ -56,7 +98,7 @@ async function request(path, options, auth) {
|
|
|
56
98
|
throw new ApiError(
|
|
57
99
|
json.errorCode ?? "INTERNAL_ERROR",
|
|
58
100
|
json.error ?? json.message ?? `HTTP ${res.status}`,
|
|
59
|
-
|
|
101
|
+
res.status,
|
|
60
102
|
json.data
|
|
61
103
|
);
|
|
62
104
|
}
|
|
@@ -282,7 +324,7 @@ var SubscriptionsResource = class {
|
|
|
282
324
|
async list(params) {
|
|
283
325
|
return request(
|
|
284
326
|
"/v1/webhooks/subscriptions",
|
|
285
|
-
{ params: { cursor: params?.cursor, limit: params?.limit } },
|
|
327
|
+
{ params: { cursor: params?.cursor, limit: params?.limit, status: params?.status, from: params?.from, to: params?.to } },
|
|
286
328
|
this.auth
|
|
287
329
|
);
|
|
288
330
|
}
|
|
@@ -352,6 +394,355 @@ var WebhooksResource = class {
|
|
|
352
394
|
}
|
|
353
395
|
};
|
|
354
396
|
|
|
397
|
+
// src/resources/accounts.ts
|
|
398
|
+
var AccountsResource = class {
|
|
399
|
+
constructor(auth) {
|
|
400
|
+
this.auth = auth;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* 택배사 계정을 등록합니다.
|
|
404
|
+
*
|
|
405
|
+
* 롯데택배, CJ대한통운 계정을 등록할 수 있습니다.
|
|
406
|
+
* CJ대한통운은 2FA(OTP) 인증이 필요할 수 있으며, 이 경우 `COURIER_OTP_REQUIRED` 에러가 발생합니다.
|
|
407
|
+
*
|
|
408
|
+
* @param params - 계정 등록 파라미터
|
|
409
|
+
* @returns 등록된 계정 정보 (courierAccountKey 포함)
|
|
410
|
+
* @throws {ApiError} COURIER_OTP_REQUIRED — CJ 계정 OTP 인증 필요
|
|
411
|
+
* @throws {ApiError} COURIER_AUTH_FAILED — 계정 인증 실패 (아이디/비밀번호 오류)
|
|
412
|
+
* @throws {ApiError} FORBIDDEN — 계정 슬롯 한도 초과
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* const account = await client.courier.accounts.register({
|
|
416
|
+
* providerId: 'lotte',
|
|
417
|
+
* accountId: 'my-lotte-id',
|
|
418
|
+
* accountPassword: 'my-password',
|
|
419
|
+
* accountName: '메인 롯데 계정',
|
|
420
|
+
* })
|
|
421
|
+
* console.log(account.courierAccountKey) // 이후 API 호출에 사용
|
|
422
|
+
*/
|
|
423
|
+
async register(params) {
|
|
424
|
+
return request(
|
|
425
|
+
"/v1/courier/accounts/register",
|
|
426
|
+
{ method: "POST", body: params },
|
|
427
|
+
this.auth
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* 등록된 택배사 계정 목록을 조회합니다.
|
|
432
|
+
*
|
|
433
|
+
* @returns 계정 목록 (courierAccountKey, providerId, isActive 등)
|
|
434
|
+
*
|
|
435
|
+
* @example
|
|
436
|
+
* const accounts = await client.courier.accounts.list()
|
|
437
|
+
* const active = accounts.filter(a => a.isActive)
|
|
438
|
+
* console.log(active[0].courierAccountKey)
|
|
439
|
+
*/
|
|
440
|
+
async list() {
|
|
441
|
+
return request(
|
|
442
|
+
"/v1/courier/accounts",
|
|
443
|
+
{},
|
|
444
|
+
this.auth
|
|
445
|
+
);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* 특정 택배사 계정의 상세 정보를 조회합니다.
|
|
449
|
+
*
|
|
450
|
+
* 목록 조회와 달리 `accountPassword` 필드가 포함됩니다 (항상 마스킹된 값).
|
|
451
|
+
* `expiresAt` 필드는 포함되지 않습니다.
|
|
452
|
+
*
|
|
453
|
+
* @param accountKey - 조회할 계정의 courierAccountKey
|
|
454
|
+
* @returns 계정 상세 정보
|
|
455
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* const detail = await client.courier.accounts.get('your-account-key')
|
|
459
|
+
* console.log(detail.accountId) // 'my-lotte-id'
|
|
460
|
+
* console.log(detail.accountPassword) // '(암호화하여 저장중)'
|
|
461
|
+
*/
|
|
462
|
+
async get(accountKey) {
|
|
463
|
+
return request(
|
|
464
|
+
`/v1/courier/accounts/${accountKey}`,
|
|
465
|
+
{},
|
|
466
|
+
this.auth
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* 택배사 계정을 삭제합니다.
|
|
471
|
+
*
|
|
472
|
+
* @param accountKey - 삭제할 계정의 courierAccountKey
|
|
473
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* await client.courier.accounts.delete('your-account-key')
|
|
477
|
+
*/
|
|
478
|
+
async delete(accountKey) {
|
|
479
|
+
await request(
|
|
480
|
+
`/v1/courier/accounts/${accountKey}`,
|
|
481
|
+
{ method: "DELETE" },
|
|
482
|
+
this.auth
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// src/resources/histories.ts
|
|
488
|
+
var HistoriesResource = class {
|
|
489
|
+
constructor(auth) {
|
|
490
|
+
this.auth = auth;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* 대량 등록 이력 목록을 조회합니다.
|
|
494
|
+
*
|
|
495
|
+
* @param params - 조회 파라미터 (providerId 필수)
|
|
496
|
+
* @returns 이력 목록 (histories 배열)
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* const { histories } = await client.courier.deliveries.histories.list({
|
|
500
|
+
* providerId: 'lotte',
|
|
501
|
+
* courierAccountKey: 'your-key',
|
|
502
|
+
* limit: 20,
|
|
503
|
+
* })
|
|
504
|
+
* const completed = histories.filter(h => h.status === 'completed')
|
|
505
|
+
*/
|
|
506
|
+
async list(params) {
|
|
507
|
+
return request(
|
|
508
|
+
"/v1/courier/deliveries/bulk-upload-histories",
|
|
509
|
+
{
|
|
510
|
+
method: "GET",
|
|
511
|
+
params: {
|
|
512
|
+
providerId: params.providerId,
|
|
513
|
+
courierAccountKey: params.courierAccountKey,
|
|
514
|
+
fromDate: params.fromDate,
|
|
515
|
+
toDate: params.toDate,
|
|
516
|
+
limit: params.limit
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
this.auth
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* 대량 등록 이력의 상세 정보를 조회합니다.
|
|
524
|
+
*
|
|
525
|
+
* 택배사 API를 호출하여 실시간 배송 상태를 함께 반환합니다.
|
|
526
|
+
*
|
|
527
|
+
* @param historyId - 이력 ID
|
|
528
|
+
* @param params - 조회 파라미터 (courierAccountKey 필수)
|
|
529
|
+
* @returns 이력 정보 + 실시간 배송 상태 (detailItems)
|
|
530
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 이력 또는 계정
|
|
531
|
+
*
|
|
532
|
+
* @example
|
|
533
|
+
* const { history, detailItems } = await client.courier.deliveries.histories.get(
|
|
534
|
+
* '202603221456_a1b2c',
|
|
535
|
+
* { courierAccountKey: 'your-key' },
|
|
536
|
+
* )
|
|
537
|
+
* const delivered = detailItems.filter(d => d.isDelivered)
|
|
538
|
+
*/
|
|
539
|
+
async get(historyId, params) {
|
|
540
|
+
return request(
|
|
541
|
+
`/v1/courier/deliveries/bulk-upload-histories/${historyId}/detail`,
|
|
542
|
+
{
|
|
543
|
+
method: "GET",
|
|
544
|
+
params: { courierAccountKey: params.courierAccountKey }
|
|
545
|
+
},
|
|
546
|
+
this.auth
|
|
547
|
+
);
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
// src/resources/deliveries.ts
|
|
552
|
+
var DeliveriesResource = class {
|
|
553
|
+
constructor(auth) {
|
|
554
|
+
this.auth = auth;
|
|
555
|
+
this.histories = new HistoriesResource(auth);
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* 택배를 대량 등록합니다. 최대 1,000건까지 한 번에 등록 가능합니다.
|
|
559
|
+
*
|
|
560
|
+
* 등록 직후에는 관리번호(courierDeliveryId)만 발급됩니다.
|
|
561
|
+
* 송장번호(trackingNumber)는 **송장 출력 시점에 발급**됩니다.
|
|
562
|
+
*
|
|
563
|
+
* HTTP 200으로 응답하며, `success`는 전체 성공 여부입니다.
|
|
564
|
+
* 부분 실패가 가능하므로 반드시 `results[].success`로 개별 확인하세요.
|
|
565
|
+
*
|
|
566
|
+
* @param params - 대량 등록 요청 파라미터
|
|
567
|
+
* @returns 등록 결과 (부분 성공 포함, results[].success로 개별 확인)
|
|
568
|
+
* @throws {ApiError} RATE_LIMITED — 요청 한도 초과
|
|
569
|
+
* @throws {ApiError} FORBIDDEN — 계정 슬롯 한도 초과
|
|
570
|
+
*
|
|
571
|
+
* @example
|
|
572
|
+
* const result = await client.courier.deliveries.bulkUpload({
|
|
573
|
+
* courierAccountKey: 'your-key',
|
|
574
|
+
* items: [{
|
|
575
|
+
* clientOrderId: 'ORD-001',
|
|
576
|
+
* receiverName: '홍길동',
|
|
577
|
+
* receiverPhone1: '01012345678',
|
|
578
|
+
* receiverAddress: '서울특별시 중구 세종대로 110',
|
|
579
|
+
* productName: '테스트 상품',
|
|
580
|
+
* quantity: 1,
|
|
581
|
+
* }],
|
|
582
|
+
* })
|
|
583
|
+
* const failed = result.results.filter(r => !r.success)
|
|
584
|
+
* const ids = result.results.filter(r => r.success).map(r => r.courierDeliveryId)
|
|
585
|
+
*/
|
|
586
|
+
async bulkUpload(params) {
|
|
587
|
+
return request(
|
|
588
|
+
"/v1/courier/deliveries/bulk-upload",
|
|
589
|
+
{ method: "POST", body: params },
|
|
590
|
+
this.auth
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* 택배사 계정의 배송 목록을 조회합니다.
|
|
595
|
+
*
|
|
596
|
+
* 택배사 API를 실시간으로 호출하여 최신 배송 상태를 반환합니다.
|
|
597
|
+
*
|
|
598
|
+
* @param params - 조회 파라미터
|
|
599
|
+
* @returns 배송 목록 (items) + 요약 통계 (summary)
|
|
600
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정
|
|
601
|
+
*
|
|
602
|
+
* @example
|
|
603
|
+
* const result = await client.courier.deliveries.inquiry({
|
|
604
|
+
* courierAccountKey: 'your-key',
|
|
605
|
+
* fromDate: '2026-03-01',
|
|
606
|
+
* toDate: '2026-03-22',
|
|
607
|
+
* })
|
|
608
|
+
* console.log(result.summary.delivered) // 배송 완료 건수
|
|
609
|
+
* const pending = result.items.filter(i => i.deliveryStatus === 'PENDING')
|
|
610
|
+
*/
|
|
611
|
+
async inquiry(params) {
|
|
612
|
+
return request(
|
|
613
|
+
"/v1/courier/deliveries/inquiry",
|
|
614
|
+
{ method: "POST", body: params },
|
|
615
|
+
this.auth
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* 택배사 계정의 배송 통계(대시보드)를 조회합니다.
|
|
620
|
+
*
|
|
621
|
+
* @param params - 조회 파라미터
|
|
622
|
+
* @returns 배송 통계 (items: 상세 행, summary: 요약)
|
|
623
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정
|
|
624
|
+
*
|
|
625
|
+
* @example
|
|
626
|
+
* const stats = await client.courier.deliveries.dashboard({
|
|
627
|
+
* courierAccountKey: 'your-key',
|
|
628
|
+
* fromDate: '2026-03-01',
|
|
629
|
+
* toDate: '2026-03-22',
|
|
630
|
+
* })
|
|
631
|
+
* console.log(stats.summary.totalCount) // 전체 건수
|
|
632
|
+
* console.log(stats.summary.delivered) // 배송 완료 건수
|
|
633
|
+
*/
|
|
634
|
+
async dashboard(params) {
|
|
635
|
+
return request(
|
|
636
|
+
"/v1/courier/deliveries/dashboard",
|
|
637
|
+
{
|
|
638
|
+
method: "GET",
|
|
639
|
+
params: {
|
|
640
|
+
courierAccountKey: params.courierAccountKey,
|
|
641
|
+
fromDate: params.fromDate,
|
|
642
|
+
toDate: params.toDate
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
this.auth
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* 배송을 취소합니다. 3가지 사용 방식을 지원합니다.
|
|
650
|
+
*
|
|
651
|
+
* 1. **historyId만**: 해당 이력의 전체 배송 취소 + 이력 soft delete
|
|
652
|
+
* 2. **historyId + courierDeliveryIds**: 이력 내 부분 취소
|
|
653
|
+
* 3. **courierDeliveryIds만**: 택배사 직접 취소 (이력 무관, 최근 7일 이내)
|
|
654
|
+
*
|
|
655
|
+
* `historyId`와 `courierDeliveryIds` 중 하나는 반드시 필요합니다.
|
|
656
|
+
*
|
|
657
|
+
* @param params - 취소 파라미터
|
|
658
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정 또는 이력
|
|
659
|
+
* @throws {ApiError} INVALID_PARAMS — 택배사가 배송 취소를 지원하지 않음
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* // 이력 전체 취소
|
|
663
|
+
* await client.courier.deliveries.cancel({
|
|
664
|
+
* courierAccountKey: 'your-key',
|
|
665
|
+
* historyId: '202603221456_a1b2c',
|
|
666
|
+
* })
|
|
667
|
+
*
|
|
668
|
+
* // 이력 내 부분 취소
|
|
669
|
+
* await client.courier.deliveries.cancel({
|
|
670
|
+
* courierAccountKey: 'your-key',
|
|
671
|
+
* historyId: '202603221456_a1b2c',
|
|
672
|
+
* courierDeliveryIds: ['7705241632'],
|
|
673
|
+
* })
|
|
674
|
+
*
|
|
675
|
+
* // 직접 취소 (이력 없이)
|
|
676
|
+
* await client.courier.deliveries.cancel({
|
|
677
|
+
* courierAccountKey: 'your-key',
|
|
678
|
+
* courierDeliveryIds: ['7705241632', '7705241633'],
|
|
679
|
+
* })
|
|
680
|
+
*/
|
|
681
|
+
async cancel(params) {
|
|
682
|
+
await request(
|
|
683
|
+
"/v1/courier/deliveries/cancel",
|
|
684
|
+
{ method: "POST", body: params },
|
|
685
|
+
this.auth
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
// src/resources/print.ts
|
|
691
|
+
var PrintResource = class {
|
|
692
|
+
constructor(auth) {
|
|
693
|
+
this.auth = auth;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* 송장 출력 세션을 생성합니다.
|
|
697
|
+
*
|
|
698
|
+
* 세션 ID로 출력 페이지(`https://print.deliveryapi.co.kr?session={sessionId}`)에 접속할 수 있습니다.
|
|
699
|
+
* 세션은 **10분 유효, 1회용**입니다. OZ Viewer 설치가 필요합니다.
|
|
700
|
+
*
|
|
701
|
+
* `courierTrackingIds` 또는 `bulkUploadHistoryId` 중 하나를 지정하세요.
|
|
702
|
+
*
|
|
703
|
+
* **중요**: 대부분의 택배사에서 송장번호(trackingNumber)는 이 출력 시점에 발급됩니다.
|
|
704
|
+
* 출력 후 `client.courier.deliveries.inquiry()`로 발급된 송장번호를 확인하세요.
|
|
705
|
+
*
|
|
706
|
+
* @param params - 출력 세션 생성 파라미터
|
|
707
|
+
* @returns 세션 정보 (sessionId, expiresAt)
|
|
708
|
+
* @throws {ApiError} NOT_FOUND — 존재하지 않는 계정 또는 배송 ID
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* // 개별 ID로 출력
|
|
712
|
+
* const session = await client.courier.print.createSession({
|
|
713
|
+
* courierAccountKey: 'your-key',
|
|
714
|
+
* providerId: 'lotte',
|
|
715
|
+
* courierTrackingIds: ['7705241632', '7705241633'],
|
|
716
|
+
* })
|
|
717
|
+
* // 브라우저에서 출력 페이지 열기
|
|
718
|
+
* window.open(`https://print.deliveryapi.co.kr?session=${session.sessionId}`)
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* // 이력 전체 출력
|
|
722
|
+
* const session = await client.courier.print.createSession({
|
|
723
|
+
* courierAccountKey: 'your-key',
|
|
724
|
+
* providerId: 'lotte',
|
|
725
|
+
* bulkUploadHistoryId: '202603221456_a1b2c',
|
|
726
|
+
* })
|
|
727
|
+
*/
|
|
728
|
+
async createSession(params) {
|
|
729
|
+
return request(
|
|
730
|
+
"/v1/courier/print/sessions",
|
|
731
|
+
{ method: "POST", body: params },
|
|
732
|
+
this.auth
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
// src/resources/courier.ts
|
|
738
|
+
var CourierResource = class {
|
|
739
|
+
constructor(auth) {
|
|
740
|
+
this.accounts = new AccountsResource(auth);
|
|
741
|
+
this.deliveries = new DeliveriesResource(auth);
|
|
742
|
+
this.print = new PrintResource(auth);
|
|
743
|
+
}
|
|
744
|
+
};
|
|
745
|
+
|
|
355
746
|
// src/client.ts
|
|
356
747
|
var DeliveryAPIClient = class {
|
|
357
748
|
constructor(options) {
|
|
@@ -360,29 +751,21 @@ var DeliveryAPIClient = class {
|
|
|
360
751
|
const auth = { apiKey: options.apiKey, secretKey: options.secretKey };
|
|
361
752
|
this.tracking = new TrackingResource(auth);
|
|
362
753
|
this.webhooks = new WebhooksResource(auth);
|
|
754
|
+
this.courier = new CourierResource(auth);
|
|
363
755
|
}
|
|
364
756
|
};
|
|
365
757
|
|
|
366
758
|
// src/types.ts
|
|
367
|
-
var
|
|
368
|
-
CourierDeliveryStatus2["PENDING"] = "PENDING";
|
|
369
|
-
CourierDeliveryStatus2["REGISTERED"] = "REGISTERED";
|
|
370
|
-
CourierDeliveryStatus2["PICKUP_READY"] = "PICKUP_READY";
|
|
371
|
-
CourierDeliveryStatus2["PICKED_UP"] = "PICKED_UP";
|
|
372
|
-
CourierDeliveryStatus2["IN_TRANSIT"] = "IN_TRANSIT";
|
|
373
|
-
CourierDeliveryStatus2["OUT_FOR_DELIVERY"] = "OUT_FOR_DELIVERY";
|
|
374
|
-
CourierDeliveryStatus2["DELIVERED"] = "DELIVERED";
|
|
375
|
-
CourierDeliveryStatus2["FAILED"] = "FAILED";
|
|
376
|
-
CourierDeliveryStatus2["RETURNED"] = "RETURNED";
|
|
377
|
-
CourierDeliveryStatus2["CANCELLED"] = "CANCELLED";
|
|
378
|
-
CourierDeliveryStatus2["HOLD"] = "HOLD";
|
|
379
|
-
CourierDeliveryStatus2["UNKNOWN"] = "UNKNOWN";
|
|
380
|
-
return CourierDeliveryStatus2;
|
|
381
|
-
})(CourierDeliveryStatus || {});
|
|
759
|
+
var import_CourierDeliveryStatus = __toESM(require_CourierDeliveryStatus(), 1);
|
|
382
760
|
// Annotate the CommonJS export names for ESM import in node:
|
|
383
761
|
0 && (module.exports = {
|
|
762
|
+
AccountsResource,
|
|
384
763
|
ApiError,
|
|
385
764
|
CourierDeliveryStatus,
|
|
386
|
-
|
|
765
|
+
CourierResource,
|
|
766
|
+
DeliveriesResource,
|
|
767
|
+
DeliveryAPIClient,
|
|
768
|
+
HistoriesResource,
|
|
769
|
+
PrintResource
|
|
387
770
|
});
|
|
388
771
|
//# sourceMappingURL=index.cjs.map
|