327 lines
8.2 KiB
TypeScript
327 lines
8.2 KiB
TypeScript
import type { FileResponse, PageRequest, PageResponse } from "../types.js";
|
|
|
|
export enum MessageType {
|
|
EMAIL = 11,
|
|
SMS = 21,
|
|
LMS_MMS = 22,
|
|
KKO = 31
|
|
}
|
|
|
|
export enum ChannelType{
|
|
EMAIL = 1,
|
|
SMS = 2,
|
|
KKO = 3
|
|
}
|
|
|
|
export enum TemplatePurpose {
|
|
NORMAL = 0,
|
|
PHONE_VERIFICATION = 1
|
|
}
|
|
|
|
export const SMS_TYPE_ARRAY = [MessageType.SMS, MessageType.LMS_MMS] as const;
|
|
export type SmsType = typeof SMS_TYPE_ARRAY[number];
|
|
|
|
export type TemplateSummary = {
|
|
tmplatIdx: number;
|
|
tmplatNm: string;
|
|
tmplatPurpose?: TemplatePurpose;
|
|
}
|
|
|
|
export type TemplateBasic = {
|
|
tmplatIdx?: number;
|
|
itrntPrjctCd: string;
|
|
tmplatNm: string;
|
|
tmplatBody: string;
|
|
sendNm: string;
|
|
};
|
|
|
|
export type TemplateSms = TemplateBasic & {
|
|
tmplatTy: SmsType;
|
|
tmplatPurpose?: TemplatePurpose;
|
|
tmplatTitle?: string;
|
|
sendTel: string;
|
|
/** 조회 응답 전용. 파이프(|)로 구분한 첨부파일명 목록 */
|
|
atchFl?: string;
|
|
}
|
|
|
|
export type TemplateEmail = TemplateBasic & {
|
|
tmplatTy: MessageType.EMAIL;
|
|
tmplatTitle: string;
|
|
sendEml: string;
|
|
/** 조회 응답 전용. 파이프(|)로 구분한 첨부파일명 목록 */
|
|
atchFl?: string;
|
|
}
|
|
|
|
/** 알림톡 템플릿. 본문은 서버가 외부 템플릿을 조회해 채우므로 요청에서는 tmplatBody, tmplatTitle을 생략한다. */
|
|
export type TemplateKko = {
|
|
tmplatIdx?: number;
|
|
itrntPrjctCd: string;
|
|
tmplatTy: MessageType.KKO;
|
|
/** 현재 알림톡은 NORMAL(0)만 지원한다. */
|
|
tmplatPurpose?: TemplatePurpose;
|
|
tmplatNm: string;
|
|
sendNm: string;
|
|
sendTel: string;
|
|
kkoTmplatCd: string;
|
|
/** 생략하거나 공백이면 서버에서 82를 사용한다. */
|
|
nationCd?: string;
|
|
tmplatBody?: string;
|
|
tmplatTitle?: string;
|
|
};
|
|
|
|
export type Template = TemplateSms | TemplateEmail | TemplateKko;
|
|
|
|
export type KkoTemplateListRequest = {
|
|
keyword?: string;
|
|
};
|
|
|
|
export type KkoTemplateSummary = {
|
|
templateCode: string;
|
|
templateName: string;
|
|
serviceStatus: string | null;
|
|
createdAt: string | null;
|
|
modifiedAt: string | null;
|
|
};
|
|
|
|
export type KkoTemplateListResponse = {
|
|
totalCount: number;
|
|
totalPage: number;
|
|
currentPage: number;
|
|
list: KkoTemplateSummary[];
|
|
};
|
|
|
|
export type KkoTemplateDetailRequest = {
|
|
templateCode: string;
|
|
};
|
|
|
|
export type KkoTemplateDetail = {
|
|
templateCode: string;
|
|
templateName: string;
|
|
templateContent: string;
|
|
templatePreviewMessage: string | null;
|
|
templateMessageType: string | null;
|
|
templateEmphasizeType: string | null;
|
|
inspectionStatus: string | null;
|
|
status: string | null;
|
|
block: boolean | null;
|
|
dormant: boolean | null;
|
|
templateExtra: string | null;
|
|
templateImageName: string | null;
|
|
templateImageUrl: string | null;
|
|
templateTitle: string | null;
|
|
templateSubtitle: string | null;
|
|
templateHeader: string | null;
|
|
templateItemHighlight: unknown | null;
|
|
templateItem: unknown | null;
|
|
templateRepresentLink: unknown | null;
|
|
buttons: unknown[] | null;
|
|
quickReplies: unknown[] | null;
|
|
};
|
|
|
|
export type BulkSendCreateRequest = {
|
|
reqstCmpn: string;
|
|
reqstUser: string;
|
|
reqstSvc: string;
|
|
prjctCd?: string;
|
|
tmplatIdx: number;
|
|
resve: boolean;
|
|
sendDt?: string;
|
|
trgtCnt: number;
|
|
};
|
|
|
|
export type DestInfo = {
|
|
sid?: string;
|
|
destEml?: string;
|
|
destTel?: string;
|
|
destNm?: string;
|
|
msgParam?: Record<string, string>;
|
|
};
|
|
|
|
export type SendRequestBulk = {
|
|
sendEml?: string;
|
|
sendTel?: string;
|
|
sendNm?: string;
|
|
bulkSendKey: string;
|
|
destInfoList: DestInfo[];
|
|
};
|
|
|
|
export type BulkSendResponse = {
|
|
bulkSendKey: string;
|
|
requestCount: number;
|
|
acceptCount: number;
|
|
failCount: number;
|
|
};
|
|
|
|
export type BulkSendFailedChunk = {
|
|
chunkIndex: number;
|
|
from: number;
|
|
to: number;
|
|
targetCount: number;
|
|
errorMessage: string | null;
|
|
};
|
|
|
|
export type BulkSendResult = {
|
|
bulkSendKey?: string;
|
|
targetCount: number;
|
|
requestCount: number;
|
|
acceptCount: number;
|
|
failCount: number;
|
|
failedChunks?: BulkSendFailedChunk[];
|
|
};
|
|
|
|
/** 벌크의 현재 취소 상태. cancelDt 이력과 구분한다. */
|
|
export type SendCancellationStatus = 'NONE' | 'PARTIAL' | 'ALL';
|
|
|
|
/** POST /api/v1/message-send/cancel/single 요청. */
|
|
export type SendCancelSingleRequest = {
|
|
/** 필수 양의 정수. cmid가 아닌 개별 발송 식별자. */
|
|
sendIdx: number;
|
|
};
|
|
|
|
/** POST /api/v1/message-send/cancel/bulk 요청. */
|
|
export type SendCancelBulkRequest = {
|
|
/** 필수 벌크 발송 키. 최대 32자. */
|
|
bulkSendKey: string;
|
|
};
|
|
|
|
/**
|
|
* 단건·벌크 공통 취소 응답. 취소 불가 건이 있어도 HTTP 200일 수 있다.
|
|
* 항상 targetCount = canceledCount + alreadyCanceledCount + notCancelableCount.
|
|
*/
|
|
export type SendCancelResponse = {
|
|
/** 대상 건수. 벌크는 현재 등록된 상세 행 기준. */
|
|
targetCount: number;
|
|
/** 이번 요청에서 취소한 건수. */
|
|
canceledCount: number;
|
|
/** 이미 취소 상태인 건수. */
|
|
alreadyCanceledCount: number;
|
|
/** 발송 시작·완료 등으로 취소하지 못한 건수. */
|
|
notCancelableCount: number;
|
|
};
|
|
|
|
export type SendResultSummaryRequest = {
|
|
bulkSendKey?: string;
|
|
itrntPrjctCd?: string;
|
|
reqstSvc?: string;
|
|
prjctCd?: string;
|
|
sendStartDt?: string;
|
|
sendEndDt?: string;
|
|
};
|
|
|
|
export type SendResultSummaryResponse = {
|
|
sendTy?: number;
|
|
sendCorp?: number;
|
|
successCount?: number;
|
|
failCount?: number;
|
|
standByCount?: number;
|
|
canceledCount?: number;
|
|
totalCount?: number;
|
|
price?: number;
|
|
cost?: number;
|
|
};
|
|
|
|
export type BulkSendDetailRequest<TSortBy extends string = string> = PageRequest<TSortBy>;
|
|
|
|
export type BulkSendDetailResponse = PageResponse<SendInfo>;
|
|
|
|
export type ReportExcelResponse = FileResponse;
|
|
|
|
/** 현재 취소 상태는 cancellationStatus로 판단하며 cancelDt만으로 판단하지 않는다. */
|
|
export type BulkSendInfo = {
|
|
/** 벌크 취소 요청자 이력. */
|
|
cancelUser?: string;
|
|
/** 벌크 취소 요청 일시 이력. 현재 상태 판정에 사용하지 않는다. */
|
|
cancelDt?: string;
|
|
/** 현재 취소 상태인 상세 건수. */
|
|
canceledCount?: number;
|
|
/** 벌크의 현재 취소 상태. */
|
|
cancellationStatus?: SendCancellationStatus;
|
|
bulkSendKey: string;
|
|
reqstSvc: string;
|
|
prjctCd: string;
|
|
tmplatIdx?: number;
|
|
resve: boolean;
|
|
sendDt: string;
|
|
trgtCnt: number;
|
|
sendCnt: number;
|
|
succesCnt: number;
|
|
failCnt: number;
|
|
completeDt?: string;
|
|
regUser?: string;
|
|
regDt?: string;
|
|
};
|
|
|
|
/**
|
|
* 개별 건의 현재 취소 상태는 resultCode로 판단한다.
|
|
* 표시명은 서버의 resultLabel을 그대로 사용한다("예약 취소"). 별도 결과 코드 목록 API는 없다.
|
|
*/
|
|
export type SendInfo = {
|
|
/** 개별 취소 식별자. cmid가 아니다. */
|
|
sendIdx?: number;
|
|
/** 취소 요청자. */
|
|
cancelUser?: string;
|
|
/** 취소 요청 일시 이력. 현재 상태 판정에 사용하지 않는다. */
|
|
cancelDt?: string;
|
|
cmid: string;
|
|
bulkSendKey?: string;
|
|
sendTyCode: number;
|
|
sendTyLabel: string;
|
|
resve: boolean;
|
|
sendStatusCode: number;
|
|
sendStatusLabel: string;
|
|
resultCode: number;
|
|
resultLabel: string;
|
|
reqstSvc: string;
|
|
prjctCd: string;
|
|
tmplatIdx?: number;
|
|
sendFrom?: string;
|
|
sendNm?: string;
|
|
sendDt: string;
|
|
sid: string;
|
|
destTo?: string;
|
|
destNm?: string;
|
|
reportDt?: string;
|
|
regCmpn: string;
|
|
regUser: string;
|
|
regDt: string;
|
|
};
|
|
|
|
/**
|
|
* 개별 건의 현재 취소 상태는 resultCode로 판단한다.
|
|
* 최신 발송 축약 조회(/api/v1/report/last/send/...)에는 sendIdx가 없다.
|
|
* 표시명은 서버의 resultViewLabel/resultLabel을 그대로 사용한다("예약 취소").
|
|
* 별도 결과 코드 목록 API는 없다.
|
|
*/
|
|
export type SendResultInfo = {
|
|
/** 개별 취소 식별자. cmid가 아니다. 최신 발송 축약 조회에는 제공되지 않는다. */
|
|
sendIdx?: number;
|
|
/** 취소 요청자. */
|
|
cancelUser?: string;
|
|
/** 취소 요청 일시 이력. 현재 상태 판정에 사용하지 않는다. */
|
|
cancelDt?: string;
|
|
cmid: string;
|
|
bulkSendKey?: string;
|
|
/** MessageType 코드 */
|
|
sendTy: number;
|
|
itrntPrjctCd: string;
|
|
reqstSvc: string;
|
|
prjctCd: string;
|
|
sid: string;
|
|
resve: boolean;
|
|
resultCode: number;
|
|
resultLabel?: string;
|
|
resultViewLabel?: string;
|
|
tmplatIdx?: number;
|
|
kkoTmplatCd?: string;
|
|
sendEml?: string;
|
|
sendTel?: string;
|
|
sendNm?: string;
|
|
sendDt: string;
|
|
destEml?: string;
|
|
destNm?: string;
|
|
destTel?: string;
|
|
regCmpn: string;
|
|
regUser: string;
|
|
regDt: string;
|
|
};
|