@teamlearners/clawops 0.28.0 → 0.29.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.d.cts CHANGED
@@ -230,7 +230,7 @@ type AssignmentLink = z.infer<typeof AssignmentLinkSchema>;
230
230
  type AssignmentLinkCreateResponse = z.infer<typeof AssignmentLinkCreateResponseSchema>;
231
231
  type AssignmentLinkStatus = AssignmentLink['status'];
232
232
 
233
- type RequestOptions$1 = {
233
+ type RequestOptions$2 = {
234
234
  extraHeaders?: Record<string, string>;
235
235
  extraQuery?: Record<string, unknown>;
236
236
  timeout?: number;
@@ -246,13 +246,13 @@ declare class AssignmentLinks extends APIResource {
246
246
  webhookUrl?: string;
247
247
  webhookMethod?: 'POST' | 'GET';
248
248
  note?: string;
249
- }, options?: RequestOptions$1): Promise<AssignmentLinkCreateResponse>;
249
+ }, options?: RequestOptions$2): Promise<AssignmentLinkCreateResponse>;
250
250
  list(params?: {
251
251
  status?: AssignmentLinkStatus;
252
252
  page?: number;
253
253
  pageSize?: number;
254
- }, options?: RequestOptions$1): Promise<Page<AssignmentLink>>;
255
- retrieve(linkId: string, options?: RequestOptions$1): Promise<AssignmentLink>;
254
+ }, options?: RequestOptions$2): Promise<Page<AssignmentLink>>;
255
+ retrieve(linkId: string, options?: RequestOptions$2): Promise<AssignmentLink>;
256
256
  revoke(linkId: string, options?: {
257
257
  extraHeaders?: Record<string, string>;
258
258
  timeout?: number;
@@ -316,7 +316,7 @@ type BlockedChannel = BlockedRecipient['channel'];
316
316
  type BlockedRecipientStatus = 'active' | 'released' | 'all';
317
317
  type BlockedRecipientSource = 'api' | 'console' | 'import';
318
318
 
319
- type RequestOptions = {
319
+ type RequestOptions$1 = {
320
320
  extraHeaders?: Record<string, string>;
321
321
  extraQuery?: Record<string, unknown>;
322
322
  timeout?: number;
@@ -345,7 +345,7 @@ declare class BlockedRecipients extends APIResource {
345
345
  source?: BlockedRecipientSource;
346
346
  sourceRef?: string;
347
347
  note?: string;
348
- }, options?: RequestOptions): Promise<BlockedRecipient>;
348
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
349
349
  /**
350
350
  * 수신거부 목록을 조회합니다. 기본은 **현재 차단 중인 항목만** 이며,
351
351
  * 해제 이력까지 보려면 `status` 를 `'released'` 또는 `'all'` 로 지정합니다.
@@ -356,9 +356,9 @@ declare class BlockedRecipients extends APIResource {
356
356
  status?: BlockedRecipientStatus;
357
357
  page?: number;
358
358
  pageSize?: number;
359
- }, options?: RequestOptions): Promise<Page<BlockedRecipient>>;
359
+ }, options?: RequestOptions$1): Promise<Page<BlockedRecipient>>;
360
360
  /** 항목 상세를 조회합니다. 해제된 항목도 이력으로 남아 조회됩니다(`active: false`). */
361
- retrieve(blockId: string, options?: RequestOptions): Promise<BlockedRecipient>;
361
+ retrieve(blockId: string, options?: RequestOptions$1): Promise<BlockedRecipient>;
362
362
  /**
363
363
  * 메모를 수정합니다.
364
364
  *
@@ -367,7 +367,7 @@ declare class BlockedRecipients extends APIResource {
367
367
  */
368
368
  update(blockId: string, params?: {
369
369
  note?: string | null;
370
- }, options?: RequestOptions): Promise<BlockedRecipient>;
370
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
371
371
  /**
372
372
  * 수신거부를 해제해 다시 발신할 수 있게 합니다.
373
373
  *
@@ -379,7 +379,7 @@ declare class BlockedRecipients extends APIResource {
379
379
  */
380
380
  release(blockId: string, params?: {
381
381
  note?: string;
382
- }, options?: RequestOptions): Promise<BlockedRecipient>;
382
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
383
383
  }
384
384
 
385
385
  declare const CallSchema: z.ZodObject<{
@@ -838,70 +838,156 @@ declare class Messages extends APIResource {
838
838
  }): Promise<Message>;
839
839
  }
840
840
 
841
+ /**
842
+ * 착신 라우팅 모드.
843
+ *
844
+ * - `webhook` : webhookUrl 의 VoiceML 이 처리.
845
+ * - `agent` : agentId 의 매니지드 에이전트가 착신.
846
+ * - `callflow` : callFlowId 의 콜 플로우(ARS)가 착신.
847
+ * - `forward` : forwardTo(같은 계정 보유 번호)로 내부 착신전환.
848
+ * - `sip` : sipEndpointId 의 라우트로 외부 PBX 다이얼.
849
+ * - `softphone` : sipCredentialId 의 등록 단말로 착신.
850
+ */
851
+ declare const ROUTING_TYPES: readonly ["webhook", "sip", "softphone", "forward", "agent", "callflow"];
852
+ type RoutingType = (typeof ROUTING_TYPES)[number];
841
853
  declare const PhoneNumberSchema: z.ZodObject<{
842
854
  number: z.ZodString;
855
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
856
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
844
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
845
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
846
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
857
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
858
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
859
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
860
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
861
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
848
862
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
863
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
864
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
865
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
866
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
867
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
868
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
869
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
849
870
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
850
871
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
851
872
  number: z.ZodString;
873
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
852
874
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
853
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
854
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
855
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
875
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
876
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
877
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
878
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
856
879
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
857
880
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
881
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
882
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
884
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
885
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
886
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
887
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
858
888
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
859
889
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
860
890
  number: z.ZodString;
891
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
861
892
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
862
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
863
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
864
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
893
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
894
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
895
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
896
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
865
897
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
866
898
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
899
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
900
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
901
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
902
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
903
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
904
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
905
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
867
906
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
868
907
  }, z.ZodTypeAny, "passthrough">>;
869
- type PhoneNumber = z.infer<typeof PhoneNumberSchema>;
908
+ /**
909
+ * 전화번호. `routingType` 은 알려진 값에 자동완성이 뜨지만, 서버가 새 라우팅을 추가해도
910
+ * 파싱이 깨지지 않도록 임의의 문자열을 허용한다.
911
+ */
912
+ type PhoneNumber = Omit<z.infer<typeof PhoneNumberSchema>, 'routingType'> & {
913
+ routingType?: RoutingType | (string & {}) | null;
914
+ };
870
915
  type NumberListItem = PhoneNumber;
871
916
  type NumberUpdateResponse = PhoneNumber;
872
917
 
873
918
  interface NumberCreateParams {
919
+ /** 수신 전화 처리용 Webhook URL. */
874
920
  webhookUrl?: string;
921
+ /** Webhook 호출 HTTP 메서드. */
922
+ webhookMethod?: 'POST' | 'GET';
923
+ /** Webhook 호출 시 덧붙일 헤더. 키는 'X-' 로 시작해야 한다. */
924
+ webhookHeaders?: Record<string, string>;
925
+ /** 수신(inbound) 통화 상태 통지 URL. */
926
+ statusCallback?: string;
927
+ /** 구독할 상태 이벤트(공백 구분). 미지정 시 'initiated ringing answered completed'. */
928
+ statusCallbackEvents?: string;
875
929
  }
876
930
  interface NumberUpdateParams {
877
- webhookUrl?: string;
878
- webhookMethod?: 'POST' | 'GET';
879
- /** inbound 라우팅: webhook | sip | softphone. */
880
- routingType?: 'webhook' | 'sip' | 'softphone';
881
- /** routingType='sip' 일 때 라우팅할 SipEndpoint id. */
931
+ /** 착신 라우팅 모드. */
932
+ routingType?: RoutingType;
933
+ /** routingType='agent' 필수. 같은 계정의 에이전트 id. */
934
+ agentId?: string | null;
935
+ /** routingType='callflow' 일 때 필수. 같은 계정의 콜 플로우 id. */
936
+ callFlowId?: string | null;
937
+ /** routingType='forward' 일 때 필수. 같은 계정이 보유한 번호. */
938
+ forwardTo?: string | null;
939
+ /** routingType='sip' 일 때 필수. SipEndpoint id. */
882
940
  sipEndpointId?: string | null;
883
- /** routingType='softphone' 일 때 착신할 등록 SIP credential(단말) id. */
941
+ /** routingType='softphone' 일 때 필수. 등록 단말의 SIP credential id. */
884
942
  sipCredentialId?: string | null;
943
+ /** 수신 전화 처리용 Webhook URL. */
944
+ webhookUrl?: string;
945
+ /** Webhook 호출 HTTP 메서드. */
946
+ webhookMethod?: 'POST' | 'GET';
947
+ /** Webhook 호출 시 덧붙일 헤더. */
948
+ webhookHeaders?: Record<string, string> | null;
949
+ /** routingType='agent' 에서 통화별 컨텍스트를 조회할 endpoint. */
950
+ callContextUrl?: string | null;
951
+ /** 수신(inbound) 통화 상태 통지 URL. */
952
+ statusCallback?: string | null;
953
+ /** 구독할 상태 이벤트(공백 구분). */
954
+ statusCallbackEvents?: string | null;
955
+ /** 이 번호의 통화 전사에 적용할 받아쓰기 사전 id. */
956
+ dictionaryId?: string | null;
885
957
  }
886
958
 
959
+ interface RequestOptions {
960
+ extraHeaders?: Record<string, string>;
961
+ extraQuery?: Record<string, unknown>;
962
+ timeout?: number;
963
+ }
887
964
  declare class Numbers extends APIResource {
888
- create(params?: {
889
- webhookUrl?: string;
890
- }, options?: {
891
- extraHeaders?: Record<string, string>;
892
- extraQuery?: Record<string, unknown>;
893
- timeout?: number;
894
- }): Promise<PhoneNumber>;
895
- list(options?: {
896
- extraHeaders?: Record<string, string>;
897
- extraQuery?: Record<string, unknown>;
898
- timeout?: number;
899
- }): Promise<NumberListItem[]>;
900
- update(number: string, params?: NumberUpdateParams, options?: {
901
- extraHeaders?: Record<string, string>;
902
- extraQuery?: Record<string, unknown>;
903
- timeout?: number;
904
- }): Promise<NumberUpdateResponse>;
965
+ /**
966
+ * 번호를 발급합니다. 번호 풀에서 자동으로 배정되며 어떤 번호가 나올지는 지정할 수 없습니다.
967
+ *
968
+ * 발급 직후 번호는 `routingType: "webhook"` 이고 `webhookUrl` 이 비어 있어, 그대로 두면
969
+ * 걸려온 전화가 거절됩니다. 이어서 `update()` 로 착신 라우팅을 지정하세요.
970
+ */
971
+ create(params?: NumberCreateParams, options?: RequestOptions): Promise<PhoneNumber>;
972
+ /**
973
+ * 등록된 번호 목록을 조회합니다. 페이지네이션과 필터가 없으며 보유한 번호가 한 번에 전부
974
+ * 반환됩니다.
975
+ */
976
+ list(options?: RequestOptions): Promise<NumberListItem[]>;
977
+ /**
978
+ * 번호 설정을 수정합니다. 착신 라우팅(webhook/agent/callflow/forward/sip/softphone)과
979
+ * webhook, 상태 통지, 받아쓰기 사전을 변경할 수 있습니다. 보낸 필드만 반영되고 생략한
980
+ * 필드는 유지됩니다.
981
+ *
982
+ * 라우팅을 바꾸면 다른 라우팅 필드는 서버에서 자동으로 비워집니다. `agent` 에서
983
+ * `webhook` 으로 되돌리면 `agentId` 가 null 이 되므로, 다시 `agent` 로 돌아갈 때
984
+ * `agentId` 를 새로 지정해야 합니다.
985
+ */
986
+ update(number: string, params?: NumberUpdateParams, options?: RequestOptions): Promise<NumberUpdateResponse>;
987
+ /**
988
+ * 번호를 반납합니다. 번호는 풀로 복귀하며 되돌릴 수 없습니다. 같은 번호를 다시
989
+ * 발급받는다는 보장이 없습니다.
990
+ */
905
991
  delete(number: string, options?: {
906
992
  extraHeaders?: Record<string, string>;
907
993
  timeout?: number;
@@ -1337,4 +1423,4 @@ declare const PaginationMetaSchema: z.ZodObject<{
1337
1423
  }, z.ZodTypeAny, "passthrough">>;
1338
1424
  type PaginationMeta = z.infer<typeof PaginationMetaSchema>;
1339
1425
 
1340
- export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type BlockedChannel, type BlockedRecipient, type BlockedRecipientSource, type BlockedRecipientStatus, BlockedRecipients, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, ServiceUnavailableError, type SipCredential, SipCredentials, type SipEndpoint, SipEndpoints, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };
1426
+ export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type BlockedChannel, type BlockedRecipient, type BlockedRecipientSource, type BlockedRecipientStatus, BlockedRecipients, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, type RoutingType, ServiceUnavailableError, type SipCredential, SipCredentials, type SipEndpoint, SipEndpoints, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };
package/dist/index.d.ts CHANGED
@@ -230,7 +230,7 @@ type AssignmentLink = z.infer<typeof AssignmentLinkSchema>;
230
230
  type AssignmentLinkCreateResponse = z.infer<typeof AssignmentLinkCreateResponseSchema>;
231
231
  type AssignmentLinkStatus = AssignmentLink['status'];
232
232
 
233
- type RequestOptions$1 = {
233
+ type RequestOptions$2 = {
234
234
  extraHeaders?: Record<string, string>;
235
235
  extraQuery?: Record<string, unknown>;
236
236
  timeout?: number;
@@ -246,13 +246,13 @@ declare class AssignmentLinks extends APIResource {
246
246
  webhookUrl?: string;
247
247
  webhookMethod?: 'POST' | 'GET';
248
248
  note?: string;
249
- }, options?: RequestOptions$1): Promise<AssignmentLinkCreateResponse>;
249
+ }, options?: RequestOptions$2): Promise<AssignmentLinkCreateResponse>;
250
250
  list(params?: {
251
251
  status?: AssignmentLinkStatus;
252
252
  page?: number;
253
253
  pageSize?: number;
254
- }, options?: RequestOptions$1): Promise<Page<AssignmentLink>>;
255
- retrieve(linkId: string, options?: RequestOptions$1): Promise<AssignmentLink>;
254
+ }, options?: RequestOptions$2): Promise<Page<AssignmentLink>>;
255
+ retrieve(linkId: string, options?: RequestOptions$2): Promise<AssignmentLink>;
256
256
  revoke(linkId: string, options?: {
257
257
  extraHeaders?: Record<string, string>;
258
258
  timeout?: number;
@@ -316,7 +316,7 @@ type BlockedChannel = BlockedRecipient['channel'];
316
316
  type BlockedRecipientStatus = 'active' | 'released' | 'all';
317
317
  type BlockedRecipientSource = 'api' | 'console' | 'import';
318
318
 
319
- type RequestOptions = {
319
+ type RequestOptions$1 = {
320
320
  extraHeaders?: Record<string, string>;
321
321
  extraQuery?: Record<string, unknown>;
322
322
  timeout?: number;
@@ -345,7 +345,7 @@ declare class BlockedRecipients extends APIResource {
345
345
  source?: BlockedRecipientSource;
346
346
  sourceRef?: string;
347
347
  note?: string;
348
- }, options?: RequestOptions): Promise<BlockedRecipient>;
348
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
349
349
  /**
350
350
  * 수신거부 목록을 조회합니다. 기본은 **현재 차단 중인 항목만** 이며,
351
351
  * 해제 이력까지 보려면 `status` 를 `'released'` 또는 `'all'` 로 지정합니다.
@@ -356,9 +356,9 @@ declare class BlockedRecipients extends APIResource {
356
356
  status?: BlockedRecipientStatus;
357
357
  page?: number;
358
358
  pageSize?: number;
359
- }, options?: RequestOptions): Promise<Page<BlockedRecipient>>;
359
+ }, options?: RequestOptions$1): Promise<Page<BlockedRecipient>>;
360
360
  /** 항목 상세를 조회합니다. 해제된 항목도 이력으로 남아 조회됩니다(`active: false`). */
361
- retrieve(blockId: string, options?: RequestOptions): Promise<BlockedRecipient>;
361
+ retrieve(blockId: string, options?: RequestOptions$1): Promise<BlockedRecipient>;
362
362
  /**
363
363
  * 메모를 수정합니다.
364
364
  *
@@ -367,7 +367,7 @@ declare class BlockedRecipients extends APIResource {
367
367
  */
368
368
  update(blockId: string, params?: {
369
369
  note?: string | null;
370
- }, options?: RequestOptions): Promise<BlockedRecipient>;
370
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
371
371
  /**
372
372
  * 수신거부를 해제해 다시 발신할 수 있게 합니다.
373
373
  *
@@ -379,7 +379,7 @@ declare class BlockedRecipients extends APIResource {
379
379
  */
380
380
  release(blockId: string, params?: {
381
381
  note?: string;
382
- }, options?: RequestOptions): Promise<BlockedRecipient>;
382
+ }, options?: RequestOptions$1): Promise<BlockedRecipient>;
383
383
  }
384
384
 
385
385
  declare const CallSchema: z.ZodObject<{
@@ -838,70 +838,156 @@ declare class Messages extends APIResource {
838
838
  }): Promise<Message>;
839
839
  }
840
840
 
841
+ /**
842
+ * 착신 라우팅 모드.
843
+ *
844
+ * - `webhook` : webhookUrl 의 VoiceML 이 처리.
845
+ * - `agent` : agentId 의 매니지드 에이전트가 착신.
846
+ * - `callflow` : callFlowId 의 콜 플로우(ARS)가 착신.
847
+ * - `forward` : forwardTo(같은 계정 보유 번호)로 내부 착신전환.
848
+ * - `sip` : sipEndpointId 의 라우트로 외부 PBX 다이얼.
849
+ * - `softphone` : sipCredentialId 의 등록 단말로 착신.
850
+ */
851
+ declare const ROUTING_TYPES: readonly ["webhook", "sip", "softphone", "forward", "agent", "callflow"];
852
+ type RoutingType = (typeof ROUTING_TYPES)[number];
841
853
  declare const PhoneNumberSchema: z.ZodObject<{
842
854
  number: z.ZodString;
855
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
843
856
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
844
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
845
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
846
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
857
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
858
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
859
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
860
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
847
861
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
848
862
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
863
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
864
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
865
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
866
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
867
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
868
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
869
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
849
870
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
850
871
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
851
872
  number: z.ZodString;
873
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
852
874
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
853
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
854
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
855
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
875
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
876
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
877
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
878
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
856
879
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
857
880
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
881
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
882
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
883
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
884
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
885
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
886
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
887
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
858
888
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
859
889
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
860
890
  number: z.ZodString;
891
+ numberType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
861
892
  source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
862
- webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
863
- webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodEnum<["POST", "GET"]>>>;
864
- routingType: z.ZodOptional<z.ZodNullable<z.ZodEnum<["webhook", "sip", "softphone"]>>>;
893
+ routingType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
894
+ agentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
895
+ callFlowId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
896
+ forwardTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
865
897
  sipEndpointId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
866
898
  sipCredentialId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
899
+ webhookUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
900
+ webhookMethod: z.ZodOptional<z.ZodNullable<z.ZodString>>;
901
+ webhookHeaders: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
902
+ callContextUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
903
+ statusCallback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
904
+ statusCallbackEvents: z.ZodOptional<z.ZodNullable<z.ZodString>>;
905
+ dictionaryId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
867
906
  createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
868
907
  }, z.ZodTypeAny, "passthrough">>;
869
- type PhoneNumber = z.infer<typeof PhoneNumberSchema>;
908
+ /**
909
+ * 전화번호. `routingType` 은 알려진 값에 자동완성이 뜨지만, 서버가 새 라우팅을 추가해도
910
+ * 파싱이 깨지지 않도록 임의의 문자열을 허용한다.
911
+ */
912
+ type PhoneNumber = Omit<z.infer<typeof PhoneNumberSchema>, 'routingType'> & {
913
+ routingType?: RoutingType | (string & {}) | null;
914
+ };
870
915
  type NumberListItem = PhoneNumber;
871
916
  type NumberUpdateResponse = PhoneNumber;
872
917
 
873
918
  interface NumberCreateParams {
919
+ /** 수신 전화 처리용 Webhook URL. */
874
920
  webhookUrl?: string;
921
+ /** Webhook 호출 HTTP 메서드. */
922
+ webhookMethod?: 'POST' | 'GET';
923
+ /** Webhook 호출 시 덧붙일 헤더. 키는 'X-' 로 시작해야 한다. */
924
+ webhookHeaders?: Record<string, string>;
925
+ /** 수신(inbound) 통화 상태 통지 URL. */
926
+ statusCallback?: string;
927
+ /** 구독할 상태 이벤트(공백 구분). 미지정 시 'initiated ringing answered completed'. */
928
+ statusCallbackEvents?: string;
875
929
  }
876
930
  interface NumberUpdateParams {
877
- webhookUrl?: string;
878
- webhookMethod?: 'POST' | 'GET';
879
- /** inbound 라우팅: webhook | sip | softphone. */
880
- routingType?: 'webhook' | 'sip' | 'softphone';
881
- /** routingType='sip' 일 때 라우팅할 SipEndpoint id. */
931
+ /** 착신 라우팅 모드. */
932
+ routingType?: RoutingType;
933
+ /** routingType='agent' 필수. 같은 계정의 에이전트 id. */
934
+ agentId?: string | null;
935
+ /** routingType='callflow' 일 때 필수. 같은 계정의 콜 플로우 id. */
936
+ callFlowId?: string | null;
937
+ /** routingType='forward' 일 때 필수. 같은 계정이 보유한 번호. */
938
+ forwardTo?: string | null;
939
+ /** routingType='sip' 일 때 필수. SipEndpoint id. */
882
940
  sipEndpointId?: string | null;
883
- /** routingType='softphone' 일 때 착신할 등록 SIP credential(단말) id. */
941
+ /** routingType='softphone' 일 때 필수. 등록 단말의 SIP credential id. */
884
942
  sipCredentialId?: string | null;
943
+ /** 수신 전화 처리용 Webhook URL. */
944
+ webhookUrl?: string;
945
+ /** Webhook 호출 HTTP 메서드. */
946
+ webhookMethod?: 'POST' | 'GET';
947
+ /** Webhook 호출 시 덧붙일 헤더. */
948
+ webhookHeaders?: Record<string, string> | null;
949
+ /** routingType='agent' 에서 통화별 컨텍스트를 조회할 endpoint. */
950
+ callContextUrl?: string | null;
951
+ /** 수신(inbound) 통화 상태 통지 URL. */
952
+ statusCallback?: string | null;
953
+ /** 구독할 상태 이벤트(공백 구분). */
954
+ statusCallbackEvents?: string | null;
955
+ /** 이 번호의 통화 전사에 적용할 받아쓰기 사전 id. */
956
+ dictionaryId?: string | null;
885
957
  }
886
958
 
959
+ interface RequestOptions {
960
+ extraHeaders?: Record<string, string>;
961
+ extraQuery?: Record<string, unknown>;
962
+ timeout?: number;
963
+ }
887
964
  declare class Numbers extends APIResource {
888
- create(params?: {
889
- webhookUrl?: string;
890
- }, options?: {
891
- extraHeaders?: Record<string, string>;
892
- extraQuery?: Record<string, unknown>;
893
- timeout?: number;
894
- }): Promise<PhoneNumber>;
895
- list(options?: {
896
- extraHeaders?: Record<string, string>;
897
- extraQuery?: Record<string, unknown>;
898
- timeout?: number;
899
- }): Promise<NumberListItem[]>;
900
- update(number: string, params?: NumberUpdateParams, options?: {
901
- extraHeaders?: Record<string, string>;
902
- extraQuery?: Record<string, unknown>;
903
- timeout?: number;
904
- }): Promise<NumberUpdateResponse>;
965
+ /**
966
+ * 번호를 발급합니다. 번호 풀에서 자동으로 배정되며 어떤 번호가 나올지는 지정할 수 없습니다.
967
+ *
968
+ * 발급 직후 번호는 `routingType: "webhook"` 이고 `webhookUrl` 이 비어 있어, 그대로 두면
969
+ * 걸려온 전화가 거절됩니다. 이어서 `update()` 로 착신 라우팅을 지정하세요.
970
+ */
971
+ create(params?: NumberCreateParams, options?: RequestOptions): Promise<PhoneNumber>;
972
+ /**
973
+ * 등록된 번호 목록을 조회합니다. 페이지네이션과 필터가 없으며 보유한 번호가 한 번에 전부
974
+ * 반환됩니다.
975
+ */
976
+ list(options?: RequestOptions): Promise<NumberListItem[]>;
977
+ /**
978
+ * 번호 설정을 수정합니다. 착신 라우팅(webhook/agent/callflow/forward/sip/softphone)과
979
+ * webhook, 상태 통지, 받아쓰기 사전을 변경할 수 있습니다. 보낸 필드만 반영되고 생략한
980
+ * 필드는 유지됩니다.
981
+ *
982
+ * 라우팅을 바꾸면 다른 라우팅 필드는 서버에서 자동으로 비워집니다. `agent` 에서
983
+ * `webhook` 으로 되돌리면 `agentId` 가 null 이 되므로, 다시 `agent` 로 돌아갈 때
984
+ * `agentId` 를 새로 지정해야 합니다.
985
+ */
986
+ update(number: string, params?: NumberUpdateParams, options?: RequestOptions): Promise<NumberUpdateResponse>;
987
+ /**
988
+ * 번호를 반납합니다. 번호는 풀로 복귀하며 되돌릴 수 없습니다. 같은 번호를 다시
989
+ * 발급받는다는 보장이 없습니다.
990
+ */
905
991
  delete(number: string, options?: {
906
992
  extraHeaders?: Record<string, string>;
907
993
  timeout?: number;
@@ -1337,4 +1423,4 @@ declare const PaginationMetaSchema: z.ZodObject<{
1337
1423
  }, z.ZodTypeAny, "passthrough">>;
1338
1424
  type PaginationMeta = z.infer<typeof PaginationMetaSchema>;
1339
1425
 
1340
- export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type BlockedChannel, type BlockedRecipient, type BlockedRecipientSource, type BlockedRecipientStatus, BlockedRecipients, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, ServiceUnavailableError, type SipCredential, SipCredentials, type SipEndpoint, SipEndpoints, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };
1426
+ export { APIClient, type APIClientOptions, APIConnectionError, APIError, APIResponseValidationError, APIStatusError, APITimeoutError, AccountContext, AgentConnectionError, AgentError, type AssignmentLink, type AssignmentLinkAssignment, type AssignmentLinkCreateResponse, type AssignmentLinkStatus, AssignmentLinks, AuthenticationError, BadRequestError, type BlockedChannel, type BlockedRecipient, type BlockedRecipientSource, type BlockedRecipientStatus, BlockedRecipients, type Call, type CallControlResponse, type CallCreateParams, type CallListParams, type CallUpdateParams, Calls, ClawOps, ClawOpsError, type ClawOpsOptions, ConflictError, InternalServerError, type Message, type MessageCreateParams, type MessageListParams, Messages, NotFoundError, type NumberCreateParams, type NumberListItem, type NumberUpdateParams, type NumberUpdateResponse, Numbers, Page, type PaginationMeta, PermissionDeniedError, type PhoneNumber, RateLimitError, type RecordingDownload, Recordings, type RoutingType, ServiceUnavailableError, type SipCredential, SipCredentials, type SipEndpoint, SipEndpoints, UnprocessableEntityError, VERSION, type WebhookLog, WebhookLogs, WebhookVerificationError, Webhooks, ClawOps as default };