deliveryapi 0.1.1 → 0.1.2

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 CHANGED
@@ -107,11 +107,19 @@ var SubscriptionsResource = class {
107
107
  this.http = http;
108
108
  }
109
109
  /**
110
- * 택배 구독 생성
110
+ * 택배 구독 생성 (단건)
111
111
  * 상태 변경 시 등록된 웹훅 엔드포인트로 알림 전송
112
112
  */
113
113
  async create(data) {
114
- return this.http.post("/v1/tracking/subscriptions", data);
114
+ return this.http.post("/v1/tracking/subscriptions", {
115
+ items: [data]
116
+ });
117
+ }
118
+ /**
119
+ * 택배 구독 일괄 생성 (최대 100건)
120
+ */
121
+ async createBatch(items) {
122
+ return this.http.post("/v1/tracking/subscriptions", { items });
115
123
  }
116
124
  /**
117
125
  * 택배 구독 목록 조회
@@ -119,8 +127,8 @@ var SubscriptionsResource = class {
119
127
  async list(options) {
120
128
  const params = {};
121
129
  if (options?.status) params["status"] = options.status;
122
- if (options?.page) params["page"] = String(options.page);
123
- if (options?.pageSize) params["pageSize"] = String(options.pageSize);
130
+ if (options?.limit) params["limit"] = String(options.limit);
131
+ if (options?.cursor) params["cursor"] = options.cursor;
124
132
  return this.http.get("/v1/tracking/subscriptions", params);
125
133
  }
126
134
  /**
@@ -130,11 +138,19 @@ var SubscriptionsResource = class {
130
138
  return this.http.get(`/v1/tracking/subscriptions/${subscriptionId}`);
131
139
  }
132
140
  /**
133
- * 택배 구독 취소
141
+ * 택배 구독 취소 (ID)
134
142
  */
135
143
  async cancel(subscriptionId) {
136
144
  await this.http.delete(`/v1/tracking/subscriptions/${subscriptionId}`);
137
145
  }
146
+ /**
147
+ * 택배 구독 취소 (송장번호)
148
+ */
149
+ async cancelByTracking(courierCode, trackingNumber) {
150
+ return this.http.delete(
151
+ `/v1/tracking/subscriptions?courierCode=${encodeURIComponent(courierCode)}&trackingNumber=${encodeURIComponent(trackingNumber)}`
152
+ );
153
+ }
138
154
  };
139
155
 
140
156
  // src/resources/webhooks.ts
@@ -155,10 +171,10 @@ var WebhooksResource = class {
155
171
  return this.http.get("/v1/webhook-v2/endpoints");
156
172
  }
157
173
  /**
158
- * 웹훅 엔드포인트 상세 조회
174
+ * 웹훅 엔드포인트 이름 수정
159
175
  */
160
- async retrieve(endpointId) {
161
- return this.http.get(`/v1/webhook-v2/endpoints/${endpointId}`);
176
+ async update(endpointId, data) {
177
+ await this.http.patch(`/v1/webhook-v2/endpoints/${endpointId}`, data);
162
178
  }
163
179
  /**
164
180
  * 웹훅 엔드포인트 삭제
@@ -167,10 +183,13 @@ var WebhooksResource = class {
167
183
  await this.http.delete(`/v1/webhook-v2/endpoints/${endpointId}`);
168
184
  }
169
185
  /**
170
- * 웹훅 엔드포인트 테스트 전송
186
+ * 웹훅 시크릿 재발급
171
187
  */
172
- async test(endpointId) {
173
- return this.http.post(`/v1/webhook-v2/endpoints/${endpointId}/test`);
188
+ async rotateSecret(endpointId, webhookSecret) {
189
+ return this.http.post(
190
+ `/v1/webhook-v2/endpoints/${endpointId}/rotate`,
191
+ webhookSecret ? { webhookSecret } : void 0
192
+ );
174
193
  }
175
194
  };
176
195
 
package/dist/index.d.cts CHANGED
@@ -268,25 +268,55 @@ export interface SubscriptionCreateInput {
268
268
  trackingNumber: string;
269
269
  endpointId: string;
270
270
  subscribedStatuses?: CourierDeliveryStatus[];
271
- clientId?: string;
271
+ id?: string;
272
272
  metadata?: Record<string, string>;
273
273
  }
274
+ export interface SubscriptionCreateResult {
275
+ id?: string;
276
+ courierCode: string;
277
+ trackingNumber: string;
278
+ subscriptionId?: string;
279
+ success: boolean;
280
+ currentStatus?: CourierDeliveryStatus;
281
+ error?: string;
282
+ }
283
+ export interface SubscriptionCreateBatchResult {
284
+ results: SubscriptionCreateResult[];
285
+ summary: {
286
+ total: number;
287
+ successful: number;
288
+ failed: number;
289
+ };
290
+ }
274
291
  export interface SubscriptionListResult {
275
- subscriptions: TrackingSubscription[];
292
+ subscriptions: {
293
+ id: string;
294
+ courierCode: string;
295
+ trackingNumber: string;
296
+ endpointId: string;
297
+ subscribedStatuses: CourierDeliveryStatus[];
298
+ currentStatus: CourierDeliveryStatus;
299
+ status: "active" | "completed" | "cancelled" | "failed";
300
+ metadata?: Record<string, string>;
301
+ dateCreated: string;
302
+ dateModified: string;
303
+ }[];
276
304
  total: number;
305
+ nextCursor?: string;
277
306
  }
278
307
  export interface WebhookCreateInput {
279
308
  url: string;
280
309
  name?: string;
281
310
  }
311
+ export interface WebhookUpdateInput {
312
+ name: string;
313
+ }
282
314
  export interface WebhookListResult {
283
315
  endpoints: WebhookEndpoint[];
284
316
  total: number;
285
317
  }
286
- export interface WebhookTestResult {
287
- success: boolean;
288
- statusCode?: number;
289
- message?: string;
318
+ export interface WebhookRotateSecretResult {
319
+ webhookSecret: string;
290
320
  }
291
321
  export interface CourierListResult {
292
322
  couriers: CourierInfo[];
@@ -312,26 +342,36 @@ declare class SubscriptionsResource {
312
342
  private readonly http;
313
343
  constructor(http: HttpClient);
314
344
  /**
315
- * 택배 구독 생성
345
+ * 택배 구독 생성 (단건)
316
346
  * 상태 변경 시 등록된 웹훅 엔드포인트로 알림 전송
317
347
  */
318
- create(data: SubscriptionCreateInput): Promise<TrackingSubscription>;
348
+ create(data: SubscriptionCreateInput): Promise<SubscriptionCreateBatchResult>;
349
+ /**
350
+ * 택배 구독 일괄 생성 (최대 100건)
351
+ */
352
+ createBatch(items: SubscriptionCreateInput[]): Promise<SubscriptionCreateBatchResult>;
319
353
  /**
320
354
  * 택배 구독 목록 조회
321
355
  */
322
356
  list(options?: {
323
- status?: string;
324
- page?: number;
325
- pageSize?: number;
357
+ status?: "active" | "completed" | "cancelled" | "failed";
358
+ limit?: number;
359
+ cursor?: string;
326
360
  }): Promise<SubscriptionListResult>;
327
361
  /**
328
362
  * 택배 구독 상세 조회
329
363
  */
330
- retrieve(subscriptionId: string): Promise<TrackingSubscription>;
364
+ retrieve(subscriptionId: string): Promise<SubscriptionListResult["subscriptions"][number]>;
331
365
  /**
332
- * 택배 구독 취소
366
+ * 택배 구독 취소 (ID)
333
367
  */
334
368
  cancel(subscriptionId: string): Promise<void>;
369
+ /**
370
+ * 택배 구독 취소 (송장번호)
371
+ */
372
+ cancelByTracking(courierCode: string, trackingNumber: string): Promise<{
373
+ cancelledCount: number;
374
+ }>;
335
375
  }
336
376
  declare class WebhooksResource {
337
377
  private readonly http;
@@ -345,17 +385,17 @@ declare class WebhooksResource {
345
385
  */
346
386
  list(): Promise<WebhookListResult>;
347
387
  /**
348
- * 웹훅 엔드포인트 상세 조회
388
+ * 웹훅 엔드포인트 이름 수정
349
389
  */
350
- retrieve(endpointId: string): Promise<WebhookEndpoint>;
390
+ update(endpointId: string, data: WebhookUpdateInput): Promise<void>;
351
391
  /**
352
392
  * 웹훅 엔드포인트 삭제
353
393
  */
354
394
  delete(endpointId: string): Promise<void>;
355
395
  /**
356
- * 웹훅 엔드포인트 테스트 전송
396
+ * 웹훅 시크릿 재발급
357
397
  */
358
- test(endpointId: string): Promise<WebhookTestResult>;
398
+ rotateSecret(endpointId: string, webhookSecret?: string): Promise<WebhookRotateSecretResult>;
359
399
  }
360
400
  declare class CouriersResource {
361
401
  private readonly http;
package/dist/index.d.ts CHANGED
@@ -268,25 +268,55 @@ export interface SubscriptionCreateInput {
268
268
  trackingNumber: string;
269
269
  endpointId: string;
270
270
  subscribedStatuses?: CourierDeliveryStatus[];
271
- clientId?: string;
271
+ id?: string;
272
272
  metadata?: Record<string, string>;
273
273
  }
274
+ export interface SubscriptionCreateResult {
275
+ id?: string;
276
+ courierCode: string;
277
+ trackingNumber: string;
278
+ subscriptionId?: string;
279
+ success: boolean;
280
+ currentStatus?: CourierDeliveryStatus;
281
+ error?: string;
282
+ }
283
+ export interface SubscriptionCreateBatchResult {
284
+ results: SubscriptionCreateResult[];
285
+ summary: {
286
+ total: number;
287
+ successful: number;
288
+ failed: number;
289
+ };
290
+ }
274
291
  export interface SubscriptionListResult {
275
- subscriptions: TrackingSubscription[];
292
+ subscriptions: {
293
+ id: string;
294
+ courierCode: string;
295
+ trackingNumber: string;
296
+ endpointId: string;
297
+ subscribedStatuses: CourierDeliveryStatus[];
298
+ currentStatus: CourierDeliveryStatus;
299
+ status: "active" | "completed" | "cancelled" | "failed";
300
+ metadata?: Record<string, string>;
301
+ dateCreated: string;
302
+ dateModified: string;
303
+ }[];
276
304
  total: number;
305
+ nextCursor?: string;
277
306
  }
278
307
  export interface WebhookCreateInput {
279
308
  url: string;
280
309
  name?: string;
281
310
  }
311
+ export interface WebhookUpdateInput {
312
+ name: string;
313
+ }
282
314
  export interface WebhookListResult {
283
315
  endpoints: WebhookEndpoint[];
284
316
  total: number;
285
317
  }
286
- export interface WebhookTestResult {
287
- success: boolean;
288
- statusCode?: number;
289
- message?: string;
318
+ export interface WebhookRotateSecretResult {
319
+ webhookSecret: string;
290
320
  }
291
321
  export interface CourierListResult {
292
322
  couriers: CourierInfo[];
@@ -312,26 +342,36 @@ declare class SubscriptionsResource {
312
342
  private readonly http;
313
343
  constructor(http: HttpClient);
314
344
  /**
315
- * 택배 구독 생성
345
+ * 택배 구독 생성 (단건)
316
346
  * 상태 변경 시 등록된 웹훅 엔드포인트로 알림 전송
317
347
  */
318
- create(data: SubscriptionCreateInput): Promise<TrackingSubscription>;
348
+ create(data: SubscriptionCreateInput): Promise<SubscriptionCreateBatchResult>;
349
+ /**
350
+ * 택배 구독 일괄 생성 (최대 100건)
351
+ */
352
+ createBatch(items: SubscriptionCreateInput[]): Promise<SubscriptionCreateBatchResult>;
319
353
  /**
320
354
  * 택배 구독 목록 조회
321
355
  */
322
356
  list(options?: {
323
- status?: string;
324
- page?: number;
325
- pageSize?: number;
357
+ status?: "active" | "completed" | "cancelled" | "failed";
358
+ limit?: number;
359
+ cursor?: string;
326
360
  }): Promise<SubscriptionListResult>;
327
361
  /**
328
362
  * 택배 구독 상세 조회
329
363
  */
330
- retrieve(subscriptionId: string): Promise<TrackingSubscription>;
364
+ retrieve(subscriptionId: string): Promise<SubscriptionListResult["subscriptions"][number]>;
331
365
  /**
332
- * 택배 구독 취소
366
+ * 택배 구독 취소 (ID)
333
367
  */
334
368
  cancel(subscriptionId: string): Promise<void>;
369
+ /**
370
+ * 택배 구독 취소 (송장번호)
371
+ */
372
+ cancelByTracking(courierCode: string, trackingNumber: string): Promise<{
373
+ cancelledCount: number;
374
+ }>;
335
375
  }
336
376
  declare class WebhooksResource {
337
377
  private readonly http;
@@ -345,17 +385,17 @@ declare class WebhooksResource {
345
385
  */
346
386
  list(): Promise<WebhookListResult>;
347
387
  /**
348
- * 웹훅 엔드포인트 상세 조회
388
+ * 웹훅 엔드포인트 이름 수정
349
389
  */
350
- retrieve(endpointId: string): Promise<WebhookEndpoint>;
390
+ update(endpointId: string, data: WebhookUpdateInput): Promise<void>;
351
391
  /**
352
392
  * 웹훅 엔드포인트 삭제
353
393
  */
354
394
  delete(endpointId: string): Promise<void>;
355
395
  /**
356
- * 웹훅 엔드포인트 테스트 전송
396
+ * 웹훅 시크릿 재발급
357
397
  */
358
- test(endpointId: string): Promise<WebhookTestResult>;
398
+ rotateSecret(endpointId: string, webhookSecret?: string): Promise<WebhookRotateSecretResult>;
359
399
  }
360
400
  declare class CouriersResource {
361
401
  private readonly http;
package/dist/index.js CHANGED
@@ -105,11 +105,19 @@ var SubscriptionsResource = class {
105
105
  this.http = http;
106
106
  }
107
107
  /**
108
- * 택배 구독 생성
108
+ * 택배 구독 생성 (단건)
109
109
  * 상태 변경 시 등록된 웹훅 엔드포인트로 알림 전송
110
110
  */
111
111
  async create(data) {
112
- return this.http.post("/v1/tracking/subscriptions", data);
112
+ return this.http.post("/v1/tracking/subscriptions", {
113
+ items: [data]
114
+ });
115
+ }
116
+ /**
117
+ * 택배 구독 일괄 생성 (최대 100건)
118
+ */
119
+ async createBatch(items) {
120
+ return this.http.post("/v1/tracking/subscriptions", { items });
113
121
  }
114
122
  /**
115
123
  * 택배 구독 목록 조회
@@ -117,8 +125,8 @@ var SubscriptionsResource = class {
117
125
  async list(options) {
118
126
  const params = {};
119
127
  if (options?.status) params["status"] = options.status;
120
- if (options?.page) params["page"] = String(options.page);
121
- if (options?.pageSize) params["pageSize"] = String(options.pageSize);
128
+ if (options?.limit) params["limit"] = String(options.limit);
129
+ if (options?.cursor) params["cursor"] = options.cursor;
122
130
  return this.http.get("/v1/tracking/subscriptions", params);
123
131
  }
124
132
  /**
@@ -128,11 +136,19 @@ var SubscriptionsResource = class {
128
136
  return this.http.get(`/v1/tracking/subscriptions/${subscriptionId}`);
129
137
  }
130
138
  /**
131
- * 택배 구독 취소
139
+ * 택배 구독 취소 (ID)
132
140
  */
133
141
  async cancel(subscriptionId) {
134
142
  await this.http.delete(`/v1/tracking/subscriptions/${subscriptionId}`);
135
143
  }
144
+ /**
145
+ * 택배 구독 취소 (송장번호)
146
+ */
147
+ async cancelByTracking(courierCode, trackingNumber) {
148
+ return this.http.delete(
149
+ `/v1/tracking/subscriptions?courierCode=${encodeURIComponent(courierCode)}&trackingNumber=${encodeURIComponent(trackingNumber)}`
150
+ );
151
+ }
136
152
  };
137
153
 
138
154
  // src/resources/webhooks.ts
@@ -153,10 +169,10 @@ var WebhooksResource = class {
153
169
  return this.http.get("/v1/webhook-v2/endpoints");
154
170
  }
155
171
  /**
156
- * 웹훅 엔드포인트 상세 조회
172
+ * 웹훅 엔드포인트 이름 수정
157
173
  */
158
- async retrieve(endpointId) {
159
- return this.http.get(`/v1/webhook-v2/endpoints/${endpointId}`);
174
+ async update(endpointId, data) {
175
+ await this.http.patch(`/v1/webhook-v2/endpoints/${endpointId}`, data);
160
176
  }
161
177
  /**
162
178
  * 웹훅 엔드포인트 삭제
@@ -165,10 +181,13 @@ var WebhooksResource = class {
165
181
  await this.http.delete(`/v1/webhook-v2/endpoints/${endpointId}`);
166
182
  }
167
183
  /**
168
- * 웹훅 엔드포인트 테스트 전송
184
+ * 웹훅 시크릿 재발급
169
185
  */
170
- async test(endpointId) {
171
- return this.http.post(`/v1/webhook-v2/endpoints/${endpointId}/test`);
186
+ async rotateSecret(endpointId, webhookSecret) {
187
+ return this.http.post(
188
+ `/v1/webhook-v2/endpoints/${endpointId}/rotate`,
189
+ webhookSecret ? { webhookSecret } : void 0
190
+ );
172
191
  }
173
192
  };
174
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deliveryapi",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Official JavaScript/TypeScript SDK for the DeliveryAPI",
5
5
  "keywords": [
6
6
  "delivery",