deliveryapi 1.1.0 → 1.2.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 +55 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -82
- package/dist/index.d.ts +61 -82
- package/dist/index.js +55 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -227,8 +227,8 @@ interface CreateEndpointParams {
|
|
|
227
227
|
* 등록 시 서버에서 테스트 POST 요청을 전송하여 URL을 검증합니다.
|
|
228
228
|
*/
|
|
229
229
|
url: string;
|
|
230
|
-
/** 엔드포인트 이름 (
|
|
231
|
-
name
|
|
230
|
+
/** 엔드포인트 이름 (관리용) */
|
|
231
|
+
name: string;
|
|
232
232
|
/**
|
|
233
233
|
* 서명 시크릿 직접 지정 (선택)
|
|
234
234
|
*
|
|
@@ -610,28 +610,6 @@ interface AuthCredentials {
|
|
|
610
610
|
secretKey: string;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
/**
|
|
614
|
-
* 택배 조회 리소스
|
|
615
|
-
*
|
|
616
|
-
* 송장번호로 배송 정보를 즉시 조회합니다.
|
|
617
|
-
* 단건/다건을 모두 지원하며, 여러 택배사를 한 번의 요청으로 조회할 수 있습니다.
|
|
618
|
-
*
|
|
619
|
-
* @example
|
|
620
|
-
* const client = new DeliveryAPIClient({ apiKey: '...', secretKey: '...' })
|
|
621
|
-
*
|
|
622
|
-
* // 단건 조회
|
|
623
|
-
* const result = await client.tracking.trace({
|
|
624
|
-
* items: [{ courierCode: 'cj', trackingNumber: '1234567890' }],
|
|
625
|
-
* })
|
|
626
|
-
*
|
|
627
|
-
* // 다건 조회 (여러 택배사 혼합 가능)
|
|
628
|
-
* const result = await client.tracking.trace({
|
|
629
|
-
* items: [
|
|
630
|
-
* { courierCode: 'cj', trackingNumber: '1111111111', clientId: 'order_001' },
|
|
631
|
-
* { courierCode: 'lotte', trackingNumber: '2222222222', clientId: 'order_002' },
|
|
632
|
-
* ],
|
|
633
|
-
* })
|
|
634
|
-
*/
|
|
635
613
|
declare class TrackingResource {
|
|
636
614
|
private readonly auth;
|
|
637
615
|
constructor(auth: AuthCredentials);
|
|
@@ -640,8 +618,6 @@ declare class TrackingResource {
|
|
|
640
618
|
*
|
|
641
619
|
* 택배사 코드(`trackingApiCode`)는 `trace()`의 `courierCode` 파라미터에 사용합니다.
|
|
642
620
|
*
|
|
643
|
-
* @returns 지원 택배사 목록 및 총 수
|
|
644
|
-
*
|
|
645
621
|
* @example
|
|
646
622
|
* const { couriers } = await client.tracking.getCouriers()
|
|
647
623
|
* // couriers: [{ trackingApiCode: 'cj', displayName: 'CJ대한통운' }, ...]
|
|
@@ -650,25 +626,22 @@ declare class TrackingResource {
|
|
|
650
626
|
/**
|
|
651
627
|
* 송장번호로 배송 정보를 조회합니다.
|
|
652
628
|
*
|
|
653
|
-
* -
|
|
629
|
+
* - 여러 건을 배열로 전달할 수 있습니다.
|
|
654
630
|
* - 결과는 요청 순서와 동일한 인덱스로 반환됩니다.
|
|
655
631
|
* - 일부 아이템이 실패해도 전체 요청이 실패하지 않습니다. `results[].success`로 건별 확인하세요.
|
|
656
632
|
*
|
|
657
633
|
* **과금 안내**: `NOT_FOUND` 에러는 과금됩니다. `results[].error.billable`로 확인하세요.
|
|
658
634
|
*
|
|
659
|
-
* @param
|
|
660
|
-
* @
|
|
635
|
+
* @param items 조회할 택배 목록
|
|
636
|
+
* @param includeProgresses 배송 진행 내역 포함 여부 (기본값: true)
|
|
661
637
|
*
|
|
662
638
|
* @throws {ApiError} API 인증 실패, 요청 한도 초과 등 전체 요청 실패 시
|
|
663
639
|
*
|
|
664
640
|
* @example
|
|
665
|
-
* const { results
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
* ],
|
|
670
|
-
* includeProgresses: true,
|
|
671
|
-
* })
|
|
641
|
+
* const { results } = await client.tracking.trace([
|
|
642
|
+
* { courierCode: 'cj', trackingNumber: '1234567890', clientId: 'order_001' },
|
|
643
|
+
* { courierCode: 'lotte', trackingNumber: '9876543210', clientId: 'order_002' },
|
|
644
|
+
* ])
|
|
672
645
|
*
|
|
673
646
|
* for (const result of results) {
|
|
674
647
|
* if (result.success) {
|
|
@@ -677,18 +650,14 @@ declare class TrackingResource {
|
|
|
677
650
|
* console.warn(result.error?.code) // 'NOT_FOUND'
|
|
678
651
|
* }
|
|
679
652
|
* }
|
|
680
|
-
*
|
|
681
|
-
* console.log(`성공: ${summary.successful} / 전체: ${summary.total}`)
|
|
682
653
|
*/
|
|
683
|
-
trace(
|
|
654
|
+
trace(items: {
|
|
655
|
+
courierCode: string;
|
|
656
|
+
trackingNumber: string;
|
|
657
|
+
clientId?: string;
|
|
658
|
+
}[], includeProgresses?: boolean): Promise<TraceResponse>;
|
|
684
659
|
}
|
|
685
660
|
|
|
686
|
-
/**
|
|
687
|
-
* 웹훅 엔드포인트 관리
|
|
688
|
-
*
|
|
689
|
-
* 웹훅을 수신할 URL을 등록/관리합니다.
|
|
690
|
-
* 엔드포인트는 한 번 설정하면 여러 구독에서 재사용할 수 있습니다.
|
|
691
|
-
*/
|
|
692
661
|
declare class EndpointsResource {
|
|
693
662
|
private readonly auth;
|
|
694
663
|
constructor(auth: AuthCredentials);
|
|
@@ -699,17 +668,21 @@ declare class EndpointsResource {
|
|
|
699
668
|
* 응답의 `webhookSecret`은 **이 응답에서만 평문으로 반환**됩니다.
|
|
700
669
|
* 분실 시 `rotateSecret()`으로 재발급해야 합니다.
|
|
701
670
|
*
|
|
671
|
+
* @param url 웹훅을 수신할 URL (`https://` 필수)
|
|
672
|
+
* @param name 엔드포인트 이름 (관리용)
|
|
673
|
+
* @param webhookSecret 서명 시크릿 직접 지정 (미제공 시 서버 자동 생성, 최소 5자)
|
|
674
|
+
*
|
|
702
675
|
* @throws {ApiError} `WEBHOOK_ENDPOINT_LIMIT` — 엔드포인트 등록 한도 초과
|
|
703
676
|
*
|
|
704
677
|
* @example
|
|
705
|
-
* const endpoint = await client.webhooks.endpoints.create(
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
678
|
+
* const endpoint = await client.webhooks.endpoints.create(
|
|
679
|
+
* 'https://my-server.com/webhook',
|
|
680
|
+
* '운영 서버',
|
|
681
|
+
* )
|
|
709
682
|
* console.log(endpoint.endpointId) // 'ep_xxxx'
|
|
710
683
|
* console.log(endpoint.webhookSecret) // 반드시 저장하세요!
|
|
711
684
|
*/
|
|
712
|
-
create(
|
|
685
|
+
create(url: string, name: string, webhookSecret?: string): Promise<CreateEndpointResponse>;
|
|
713
686
|
/**
|
|
714
687
|
* 등록된 웹훅 엔드포인트 목록을 조회합니다.
|
|
715
688
|
*
|
|
@@ -723,12 +696,15 @@ declare class EndpointsResource {
|
|
|
723
696
|
*
|
|
724
697
|
* URL은 변경할 수 없습니다. URL을 변경해야 한다면 삭제 후 재등록하세요.
|
|
725
698
|
*
|
|
699
|
+
* @param endpointId 수정할 엔드포인트 ID
|
|
700
|
+
* @param name 새 이름
|
|
701
|
+
*
|
|
726
702
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 엔드포인트
|
|
727
703
|
*
|
|
728
704
|
* @example
|
|
729
|
-
* await client.webhooks.endpoints.update('ep_xxxx',
|
|
705
|
+
* await client.webhooks.endpoints.update('ep_xxxx', '스테이징 서버')
|
|
730
706
|
*/
|
|
731
|
-
update(endpointId: string,
|
|
707
|
+
update(endpointId: string, name: string): Promise<void>;
|
|
732
708
|
/**
|
|
733
709
|
* 웹훅 엔드포인트를 삭제합니다.
|
|
734
710
|
*
|
|
@@ -746,20 +722,18 @@ declare class EndpointsResource {
|
|
|
746
722
|
* 기존 시크릿은 즉시 무효화됩니다.
|
|
747
723
|
* 새 시크릿은 **이 응답에서만 평문으로 반환**됩니다.
|
|
748
724
|
*
|
|
725
|
+
* @param endpointId 대상 엔드포인트 ID
|
|
726
|
+
* @param webhookSecret 새 시크릿 직접 지정 (미제공 시 서버 자동 생성)
|
|
727
|
+
*
|
|
749
728
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 엔드포인트
|
|
750
729
|
*
|
|
751
730
|
* @example
|
|
752
731
|
* const { webhookSecret } = await client.webhooks.endpoints.rotateSecret('ep_xxxx')
|
|
753
732
|
* console.log(webhookSecret) // 새 시크릿 — 반드시 저장하세요!
|
|
754
733
|
*/
|
|
755
|
-
rotateSecret(endpointId: string,
|
|
734
|
+
rotateSecret(endpointId: string, webhookSecret?: string): Promise<RotateSecretResponse>;
|
|
756
735
|
}
|
|
757
736
|
|
|
758
|
-
/**
|
|
759
|
-
* 웹훅 구독 관리
|
|
760
|
-
*
|
|
761
|
-
* 택배를 추적하고 배송 상태 변경 시 웹훅 알림을 받습니다.
|
|
762
|
-
*/
|
|
763
737
|
declare class SubscriptionsResource {
|
|
764
738
|
private readonly auth;
|
|
765
739
|
constructor(auth: AuthCredentials);
|
|
@@ -772,25 +746,31 @@ declare class SubscriptionsResource {
|
|
|
772
746
|
* **일회성** (`recurring: false`): 등록 즉시 1회 크롤 후 종료합니다.
|
|
773
747
|
* `endpointId` 없이 사용하면 결과를 `get(requestId)`으로 직접 조회할 수 있습니다.
|
|
774
748
|
*
|
|
749
|
+
* @param items 추적할 택배 목록
|
|
750
|
+
* @param recurring true: 반복 구독, false: 1회성
|
|
751
|
+
* @param endpointId 웹훅 수신 엔드포인트 ID (선택)
|
|
752
|
+
*
|
|
775
753
|
* @example
|
|
776
754
|
* // 구독형 — 상태 변경 시 웹훅 수신
|
|
777
|
-
* const sub = await client.webhooks.subscriptions.register(
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
* recurring: true,
|
|
783
|
-
* })
|
|
755
|
+
* const sub = await client.webhooks.subscriptions.register(
|
|
756
|
+
* [{ courierCode: 'cj', trackingNumber: '1234567890', clientId: 'order_001' }],
|
|
757
|
+
* true,
|
|
758
|
+
* 'ep_xxxx',
|
|
759
|
+
* )
|
|
784
760
|
*
|
|
785
761
|
* @example
|
|
786
|
-
* // 일회성
|
|
787
|
-
* const req = await client.webhooks.subscriptions.register(
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
762
|
+
* // 일회성 — 웹훅 없이 결과를 직접 조회
|
|
763
|
+
* const req = await client.webhooks.subscriptions.register(
|
|
764
|
+
* [{ courierCode: 'lotte', trackingNumber: '9876543210' }],
|
|
765
|
+
* false,
|
|
766
|
+
* )
|
|
791
767
|
* const detail = await client.webhooks.subscriptions.get(req.requestId)
|
|
792
768
|
*/
|
|
793
|
-
register(
|
|
769
|
+
register(items: {
|
|
770
|
+
courierCode: string;
|
|
771
|
+
trackingNumber: string;
|
|
772
|
+
clientId?: string;
|
|
773
|
+
}[], recurring: boolean, endpointId?: string): Promise<RegisterResponse>;
|
|
794
774
|
/**
|
|
795
775
|
* 구독 목록을 조회합니다.
|
|
796
776
|
*
|
|
@@ -811,8 +791,6 @@ declare class SubscriptionsResource {
|
|
|
811
791
|
/**
|
|
812
792
|
* 구독 상세 정보를 조회합니다.
|
|
813
793
|
*
|
|
814
|
-
* 각 택배별 현재 상태 및 최신 배송 데이터를 포함합니다.
|
|
815
|
-
*
|
|
816
794
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 구독
|
|
817
795
|
*
|
|
818
796
|
* @example
|
|
@@ -825,8 +803,6 @@ declare class SubscriptionsResource {
|
|
|
825
803
|
/**
|
|
826
804
|
* 구독을 취소합니다.
|
|
827
805
|
*
|
|
828
|
-
* 취소된 구독은 더 이상 폴링되지 않으며 웹훅도 발송되지 않습니다.
|
|
829
|
-
*
|
|
830
806
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 구독
|
|
831
807
|
*
|
|
832
808
|
* @example
|
|
@@ -838,18 +814,21 @@ declare class SubscriptionsResource {
|
|
|
838
814
|
*
|
|
839
815
|
* 해당 계정에 등록된 구독 중 일치하는 아이템의 최신 상태를 반환합니다.
|
|
840
816
|
*
|
|
817
|
+
* @param items 조회할 택배 목록
|
|
818
|
+
*
|
|
841
819
|
* @example
|
|
842
|
-
* const { results } = await client.webhooks.subscriptions.batchResults(
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* ],
|
|
847
|
-
* })
|
|
820
|
+
* const { results } = await client.webhooks.subscriptions.batchResults([
|
|
821
|
+
* { courierCode: 'cj', trackingNumber: '1111111111' },
|
|
822
|
+
* { courierCode: 'lotte', trackingNumber: '2222222222' },
|
|
823
|
+
* ])
|
|
848
824
|
* for (const r of results) {
|
|
849
825
|
* console.log(r.currentStatus, r.isDelivered)
|
|
850
826
|
* }
|
|
851
827
|
*/
|
|
852
|
-
batchResults(
|
|
828
|
+
batchResults(items: {
|
|
829
|
+
courierCode: string;
|
|
830
|
+
trackingNumber: string;
|
|
831
|
+
}[]): Promise<BatchResultsResponse>;
|
|
853
832
|
}
|
|
854
833
|
|
|
855
834
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -227,8 +227,8 @@ interface CreateEndpointParams {
|
|
|
227
227
|
* 등록 시 서버에서 테스트 POST 요청을 전송하여 URL을 검증합니다.
|
|
228
228
|
*/
|
|
229
229
|
url: string;
|
|
230
|
-
/** 엔드포인트 이름 (
|
|
231
|
-
name
|
|
230
|
+
/** 엔드포인트 이름 (관리용) */
|
|
231
|
+
name: string;
|
|
232
232
|
/**
|
|
233
233
|
* 서명 시크릿 직접 지정 (선택)
|
|
234
234
|
*
|
|
@@ -610,28 +610,6 @@ interface AuthCredentials {
|
|
|
610
610
|
secretKey: string;
|
|
611
611
|
}
|
|
612
612
|
|
|
613
|
-
/**
|
|
614
|
-
* 택배 조회 리소스
|
|
615
|
-
*
|
|
616
|
-
* 송장번호로 배송 정보를 즉시 조회합니다.
|
|
617
|
-
* 단건/다건을 모두 지원하며, 여러 택배사를 한 번의 요청으로 조회할 수 있습니다.
|
|
618
|
-
*
|
|
619
|
-
* @example
|
|
620
|
-
* const client = new DeliveryAPIClient({ apiKey: '...', secretKey: '...' })
|
|
621
|
-
*
|
|
622
|
-
* // 단건 조회
|
|
623
|
-
* const result = await client.tracking.trace({
|
|
624
|
-
* items: [{ courierCode: 'cj', trackingNumber: '1234567890' }],
|
|
625
|
-
* })
|
|
626
|
-
*
|
|
627
|
-
* // 다건 조회 (여러 택배사 혼합 가능)
|
|
628
|
-
* const result = await client.tracking.trace({
|
|
629
|
-
* items: [
|
|
630
|
-
* { courierCode: 'cj', trackingNumber: '1111111111', clientId: 'order_001' },
|
|
631
|
-
* { courierCode: 'lotte', trackingNumber: '2222222222', clientId: 'order_002' },
|
|
632
|
-
* ],
|
|
633
|
-
* })
|
|
634
|
-
*/
|
|
635
613
|
declare class TrackingResource {
|
|
636
614
|
private readonly auth;
|
|
637
615
|
constructor(auth: AuthCredentials);
|
|
@@ -640,8 +618,6 @@ declare class TrackingResource {
|
|
|
640
618
|
*
|
|
641
619
|
* 택배사 코드(`trackingApiCode`)는 `trace()`의 `courierCode` 파라미터에 사용합니다.
|
|
642
620
|
*
|
|
643
|
-
* @returns 지원 택배사 목록 및 총 수
|
|
644
|
-
*
|
|
645
621
|
* @example
|
|
646
622
|
* const { couriers } = await client.tracking.getCouriers()
|
|
647
623
|
* // couriers: [{ trackingApiCode: 'cj', displayName: 'CJ대한통운' }, ...]
|
|
@@ -650,25 +626,22 @@ declare class TrackingResource {
|
|
|
650
626
|
/**
|
|
651
627
|
* 송장번호로 배송 정보를 조회합니다.
|
|
652
628
|
*
|
|
653
|
-
* -
|
|
629
|
+
* - 여러 건을 배열로 전달할 수 있습니다.
|
|
654
630
|
* - 결과는 요청 순서와 동일한 인덱스로 반환됩니다.
|
|
655
631
|
* - 일부 아이템이 실패해도 전체 요청이 실패하지 않습니다. `results[].success`로 건별 확인하세요.
|
|
656
632
|
*
|
|
657
633
|
* **과금 안내**: `NOT_FOUND` 에러는 과금됩니다. `results[].error.billable`로 확인하세요.
|
|
658
634
|
*
|
|
659
|
-
* @param
|
|
660
|
-
* @
|
|
635
|
+
* @param items 조회할 택배 목록
|
|
636
|
+
* @param includeProgresses 배송 진행 내역 포함 여부 (기본값: true)
|
|
661
637
|
*
|
|
662
638
|
* @throws {ApiError} API 인증 실패, 요청 한도 초과 등 전체 요청 실패 시
|
|
663
639
|
*
|
|
664
640
|
* @example
|
|
665
|
-
* const { results
|
|
666
|
-
*
|
|
667
|
-
*
|
|
668
|
-
*
|
|
669
|
-
* ],
|
|
670
|
-
* includeProgresses: true,
|
|
671
|
-
* })
|
|
641
|
+
* const { results } = await client.tracking.trace([
|
|
642
|
+
* { courierCode: 'cj', trackingNumber: '1234567890', clientId: 'order_001' },
|
|
643
|
+
* { courierCode: 'lotte', trackingNumber: '9876543210', clientId: 'order_002' },
|
|
644
|
+
* ])
|
|
672
645
|
*
|
|
673
646
|
* for (const result of results) {
|
|
674
647
|
* if (result.success) {
|
|
@@ -677,18 +650,14 @@ declare class TrackingResource {
|
|
|
677
650
|
* console.warn(result.error?.code) // 'NOT_FOUND'
|
|
678
651
|
* }
|
|
679
652
|
* }
|
|
680
|
-
*
|
|
681
|
-
* console.log(`성공: ${summary.successful} / 전체: ${summary.total}`)
|
|
682
653
|
*/
|
|
683
|
-
trace(
|
|
654
|
+
trace(items: {
|
|
655
|
+
courierCode: string;
|
|
656
|
+
trackingNumber: string;
|
|
657
|
+
clientId?: string;
|
|
658
|
+
}[], includeProgresses?: boolean): Promise<TraceResponse>;
|
|
684
659
|
}
|
|
685
660
|
|
|
686
|
-
/**
|
|
687
|
-
* 웹훅 엔드포인트 관리
|
|
688
|
-
*
|
|
689
|
-
* 웹훅을 수신할 URL을 등록/관리합니다.
|
|
690
|
-
* 엔드포인트는 한 번 설정하면 여러 구독에서 재사용할 수 있습니다.
|
|
691
|
-
*/
|
|
692
661
|
declare class EndpointsResource {
|
|
693
662
|
private readonly auth;
|
|
694
663
|
constructor(auth: AuthCredentials);
|
|
@@ -699,17 +668,21 @@ declare class EndpointsResource {
|
|
|
699
668
|
* 응답의 `webhookSecret`은 **이 응답에서만 평문으로 반환**됩니다.
|
|
700
669
|
* 분실 시 `rotateSecret()`으로 재발급해야 합니다.
|
|
701
670
|
*
|
|
671
|
+
* @param url 웹훅을 수신할 URL (`https://` 필수)
|
|
672
|
+
* @param name 엔드포인트 이름 (관리용)
|
|
673
|
+
* @param webhookSecret 서명 시크릿 직접 지정 (미제공 시 서버 자동 생성, 최소 5자)
|
|
674
|
+
*
|
|
702
675
|
* @throws {ApiError} `WEBHOOK_ENDPOINT_LIMIT` — 엔드포인트 등록 한도 초과
|
|
703
676
|
*
|
|
704
677
|
* @example
|
|
705
|
-
* const endpoint = await client.webhooks.endpoints.create(
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
678
|
+
* const endpoint = await client.webhooks.endpoints.create(
|
|
679
|
+
* 'https://my-server.com/webhook',
|
|
680
|
+
* '운영 서버',
|
|
681
|
+
* )
|
|
709
682
|
* console.log(endpoint.endpointId) // 'ep_xxxx'
|
|
710
683
|
* console.log(endpoint.webhookSecret) // 반드시 저장하세요!
|
|
711
684
|
*/
|
|
712
|
-
create(
|
|
685
|
+
create(url: string, name: string, webhookSecret?: string): Promise<CreateEndpointResponse>;
|
|
713
686
|
/**
|
|
714
687
|
* 등록된 웹훅 엔드포인트 목록을 조회합니다.
|
|
715
688
|
*
|
|
@@ -723,12 +696,15 @@ declare class EndpointsResource {
|
|
|
723
696
|
*
|
|
724
697
|
* URL은 변경할 수 없습니다. URL을 변경해야 한다면 삭제 후 재등록하세요.
|
|
725
698
|
*
|
|
699
|
+
* @param endpointId 수정할 엔드포인트 ID
|
|
700
|
+
* @param name 새 이름
|
|
701
|
+
*
|
|
726
702
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 엔드포인트
|
|
727
703
|
*
|
|
728
704
|
* @example
|
|
729
|
-
* await client.webhooks.endpoints.update('ep_xxxx',
|
|
705
|
+
* await client.webhooks.endpoints.update('ep_xxxx', '스테이징 서버')
|
|
730
706
|
*/
|
|
731
|
-
update(endpointId: string,
|
|
707
|
+
update(endpointId: string, name: string): Promise<void>;
|
|
732
708
|
/**
|
|
733
709
|
* 웹훅 엔드포인트를 삭제합니다.
|
|
734
710
|
*
|
|
@@ -746,20 +722,18 @@ declare class EndpointsResource {
|
|
|
746
722
|
* 기존 시크릿은 즉시 무효화됩니다.
|
|
747
723
|
* 새 시크릿은 **이 응답에서만 평문으로 반환**됩니다.
|
|
748
724
|
*
|
|
725
|
+
* @param endpointId 대상 엔드포인트 ID
|
|
726
|
+
* @param webhookSecret 새 시크릿 직접 지정 (미제공 시 서버 자동 생성)
|
|
727
|
+
*
|
|
749
728
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 엔드포인트
|
|
750
729
|
*
|
|
751
730
|
* @example
|
|
752
731
|
* const { webhookSecret } = await client.webhooks.endpoints.rotateSecret('ep_xxxx')
|
|
753
732
|
* console.log(webhookSecret) // 새 시크릿 — 반드시 저장하세요!
|
|
754
733
|
*/
|
|
755
|
-
rotateSecret(endpointId: string,
|
|
734
|
+
rotateSecret(endpointId: string, webhookSecret?: string): Promise<RotateSecretResponse>;
|
|
756
735
|
}
|
|
757
736
|
|
|
758
|
-
/**
|
|
759
|
-
* 웹훅 구독 관리
|
|
760
|
-
*
|
|
761
|
-
* 택배를 추적하고 배송 상태 변경 시 웹훅 알림을 받습니다.
|
|
762
|
-
*/
|
|
763
737
|
declare class SubscriptionsResource {
|
|
764
738
|
private readonly auth;
|
|
765
739
|
constructor(auth: AuthCredentials);
|
|
@@ -772,25 +746,31 @@ declare class SubscriptionsResource {
|
|
|
772
746
|
* **일회성** (`recurring: false`): 등록 즉시 1회 크롤 후 종료합니다.
|
|
773
747
|
* `endpointId` 없이 사용하면 결과를 `get(requestId)`으로 직접 조회할 수 있습니다.
|
|
774
748
|
*
|
|
749
|
+
* @param items 추적할 택배 목록
|
|
750
|
+
* @param recurring true: 반복 구독, false: 1회성
|
|
751
|
+
* @param endpointId 웹훅 수신 엔드포인트 ID (선택)
|
|
752
|
+
*
|
|
775
753
|
* @example
|
|
776
754
|
* // 구독형 — 상태 변경 시 웹훅 수신
|
|
777
|
-
* const sub = await client.webhooks.subscriptions.register(
|
|
778
|
-
*
|
|
779
|
-
*
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
* recurring: true,
|
|
783
|
-
* })
|
|
755
|
+
* const sub = await client.webhooks.subscriptions.register(
|
|
756
|
+
* [{ courierCode: 'cj', trackingNumber: '1234567890', clientId: 'order_001' }],
|
|
757
|
+
* true,
|
|
758
|
+
* 'ep_xxxx',
|
|
759
|
+
* )
|
|
784
760
|
*
|
|
785
761
|
* @example
|
|
786
|
-
* // 일회성
|
|
787
|
-
* const req = await client.webhooks.subscriptions.register(
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
762
|
+
* // 일회성 — 웹훅 없이 결과를 직접 조회
|
|
763
|
+
* const req = await client.webhooks.subscriptions.register(
|
|
764
|
+
* [{ courierCode: 'lotte', trackingNumber: '9876543210' }],
|
|
765
|
+
* false,
|
|
766
|
+
* )
|
|
791
767
|
* const detail = await client.webhooks.subscriptions.get(req.requestId)
|
|
792
768
|
*/
|
|
793
|
-
register(
|
|
769
|
+
register(items: {
|
|
770
|
+
courierCode: string;
|
|
771
|
+
trackingNumber: string;
|
|
772
|
+
clientId?: string;
|
|
773
|
+
}[], recurring: boolean, endpointId?: string): Promise<RegisterResponse>;
|
|
794
774
|
/**
|
|
795
775
|
* 구독 목록을 조회합니다.
|
|
796
776
|
*
|
|
@@ -811,8 +791,6 @@ declare class SubscriptionsResource {
|
|
|
811
791
|
/**
|
|
812
792
|
* 구독 상세 정보를 조회합니다.
|
|
813
793
|
*
|
|
814
|
-
* 각 택배별 현재 상태 및 최신 배송 데이터를 포함합니다.
|
|
815
|
-
*
|
|
816
794
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 구독
|
|
817
795
|
*
|
|
818
796
|
* @example
|
|
@@ -825,8 +803,6 @@ declare class SubscriptionsResource {
|
|
|
825
803
|
/**
|
|
826
804
|
* 구독을 취소합니다.
|
|
827
805
|
*
|
|
828
|
-
* 취소된 구독은 더 이상 폴링되지 않으며 웹훅도 발송되지 않습니다.
|
|
829
|
-
*
|
|
830
806
|
* @throws {ApiError} `NOT_FOUND` — 존재하지 않는 구독
|
|
831
807
|
*
|
|
832
808
|
* @example
|
|
@@ -838,18 +814,21 @@ declare class SubscriptionsResource {
|
|
|
838
814
|
*
|
|
839
815
|
* 해당 계정에 등록된 구독 중 일치하는 아이템의 최신 상태를 반환합니다.
|
|
840
816
|
*
|
|
817
|
+
* @param items 조회할 택배 목록
|
|
818
|
+
*
|
|
841
819
|
* @example
|
|
842
|
-
* const { results } = await client.webhooks.subscriptions.batchResults(
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* ],
|
|
847
|
-
* })
|
|
820
|
+
* const { results } = await client.webhooks.subscriptions.batchResults([
|
|
821
|
+
* { courierCode: 'cj', trackingNumber: '1111111111' },
|
|
822
|
+
* { courierCode: 'lotte', trackingNumber: '2222222222' },
|
|
823
|
+
* ])
|
|
848
824
|
* for (const r of results) {
|
|
849
825
|
* console.log(r.currentStatus, r.isDelivered)
|
|
850
826
|
* }
|
|
851
827
|
*/
|
|
852
|
-
batchResults(
|
|
828
|
+
batchResults(items: {
|
|
829
|
+
courierCode: string;
|
|
830
|
+
trackingNumber: string;
|
|
831
|
+
}[]): Promise<BatchResultsResponse>;
|
|
853
832
|
}
|
|
854
833
|
|
|
855
834
|
/**
|