{"version":3,"sources":["jsdelivr-header.js","/npm/coolsms-node-sdk@2.1.0/src/env_config.json","/npm/coolsms-node-sdk@2.1.0/src/errors/DefaultError.ts","/npm/coolsms-node-sdk@2.1.0/src/lib/stringDateTrasnfer.ts","/npm/coolsms-node-sdk@2.1.0/src/requests/messageRequest.ts","/npm/coolsms-node-sdk@2.1.0/src/lib/authenticator.ts","/npm/coolsms-node-sdk@2.1.0/src/lib/defaultFetcher.ts","/npm/coolsms-node-sdk@2.1.0/src/lib/queryParameterGenerator.ts","/npm/coolsms-node-sdk@2.1.0/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,upBCNA,0BAAiB,KAAK,MAAM,8B,MCKf,kDAAyB,M,YACtB,GACR,MAAM,GACN,KAAK,KAAO,kBAChB,E,MAGS,kDAAoB,M,YACjB,GACR,MAAM,GACN,KAAK,KAAO,oBAChB,E,MAGS,kDAAqB,M,YAClB,EAAmB,GAC3B,MAAM,GACN,KAAK,KAAO,CAChB,E,kDChBuC,GACvC,GAAqB,iBAAV,EAAoB,CAE3B,MAAM,EAAkB,eACxB,IAFA,EAAQ,eAAA,SAAS,IAEP,aAAe,EACrB,MAAM,IAAI,0CAAiB,EAEnC,CACA,OAAO,CACX,CCLO,MAAM,0CAAiC,CAC1C,WAAY,0BAAA,QACZ,WAAU,GAAK,QAAQ,cAAc,QAAQ,W,MAGlC,4C,cAMP,KAAK,MAAQ,0CACb,KAAK,iBAAkB,CAC3B,E,MAGS,kDAAoC,4C,YAGjC,EAAkB,EAA2B,GACrD,QACA,KAAK,QAAU,EACgB,kBAApB,IACP,KAAK,gBAAkB,GAEvB,IACA,KAAK,MAAQ,EAErB,E,MAGS,kDAAsC,4C,YAGnC,EAA0B,EAA2B,GAC7D,QACA,KAAK,SAAW,EACe,kBAApB,IACP,KAAK,gBAAkB,GAEvB,IACA,KAAK,MAAQ,EAErB,E,MAGS,0C,YAGG,GACR,KAAK,SAAW,CACpB,E,MA+CS,0C,YA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ACG,CAAyB,GAC3B,MAAM,EAA+B,CACjC,OAAQ,SACR,IAAG,GAAK,KAAK,8BAA8B,cAE/C,OAAO,yCAAgD,KAAK,SAAU,EAC1E,CAKG,iBACG,CAAY,GACd,MAAM,EAA+B,CACjC,OAAQ,SACR,IAAG,GAAK,KAAK,8BAA8B,KAE/C,OAAO,yCAAgD,KAAK,SAAU,EAC1E,CAKG,iBACG,CAAY,GACd,MAAM,EAAyC,EAAO,IAAI,0CAAmB,GAAQ,CAAC,EAEhF,EAA+B,CACjC,OAAQ,MACR,IAHa,yCAAuB,GAAI,KAAK,2BAA4B,IAK7E,OAAO,yCAA+C,KAAK,SAAU,EACzE,CAMG,mBACG,CAAc,GAChB,MAAM,EAA2C,EAAO,IAAI,0CAAqB,GAAQ,CAAC,EAEpF,EAA+B,CACjC,OAAQ,MACR,IAHa,yCAAuB,GAAI,KAAK,iCAAkC,IAKnF,OAAO,yCAAiD,KAAK,SAAU,EAC3E,CAKG,gBACG,GACF,MAAM,EAA+B,CACjC,OAAQ,MACR,IAAG,GAAK,KAAK,2BAEjB,OAAO,yCAA8C,KAAK,SAAU,EACxE,CASG,gBACG,CAAW,EAAkB,EAAoB,EAAe,GAClE,MAAM,QAAoB,uBAAA,qBAAA,CAAc,GAClC,EAA+B,CACjC,OAAQ,OACR,IAAG,GAAK,KAAK,4BAEX,EAA+B,CACjC,KAAM,EACN,KAAM,E,KACN,E,KACA,GAEJ,OAAO,yCAAsD,KAAK,SAAU,EAAe,EAC/F","file":"/npm/coolsms-node-sdk@2.1.0/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/coolsms-node-sdk@2.1.0/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","{\n  \"version\": \"nodejs/2.0.0\"\n}\n","export type ErrorResponse = {\n    errorCode: string,\n    errorMessage: string\n}\n\nexport class InvalidDateError extends Error {\n    constructor(message: string) {\n        super(message);\n        this.name = 'InvalidDateError';\n    }\n}\n\nexport class ApiKeyError extends Error {\n    constructor(message: string) {\n        super(message);\n        this.name = 'InvalidApiKeyError';\n    }\n}\n\nexport class DefaultError extends Error {\n    constructor(errorCode: string, errorMessage: string) {\n        super(errorMessage);\n        this.name = errorCode;\n    }\n}\n","import {parseISO} from 'date-fns';\nimport {InvalidDateError} from '../errors/DefaultError';\n\n/**\n * 일반 문자열 날짜가 있을 경우 Date 타입으로 변환해주는 함수\n * @param value 일반 문자열 날짜 또는 Date 타입의 날짜\n */\nexport default function stringDateTransfer(value: string | Date): Date {\n    if (typeof value === 'string') {\n        value = parseISO(value);\n        const invalidDateText = 'Invalid Date';\n        if (value.toString() === invalidDateText) {\n            throw new InvalidDateError(invalidDateText);\n        }\n    }\n    return value;\n}\n","import Message, {MessageType} from '../models/message';\nimport * as Config from '../env_config.json';\nimport {GroupId} from '../types/commonTypes';\nimport {formatISO} from 'date-fns';\nimport stringDateTransfer from '../lib/stringDateTrasnfer';\n\nexport type DefaultAgentType = {\n    sdkVersion: string\n    osPlatform: string\n};\n\nexport const defaultAgent: DefaultAgentType = {\n    sdkVersion: Config.version,\n    osPlatform: `${process.platform} | ${process.version}`,\n};\n\nabstract class DefaultMessageRequest {\n    allowDuplicates: boolean;\n    appId: string | undefined;\n    protected agent: DefaultAgentType;\n\n    protected constructor() {\n        this.agent = defaultAgent;\n        this.allowDuplicates = false;\n    }\n}\n\nexport class SingleMessageSendingRequest extends DefaultMessageRequest {\n    message: Message;\n\n    constructor(message: Message, allowDuplicates?: boolean, appId?: string) {\n        super();\n        this.message = message;\n        if (typeof allowDuplicates === 'boolean') {\n            this.allowDuplicates = allowDuplicates;\n        }\n        if (appId) {\n            this.appId = appId;\n        }\n    }\n}\n\nexport class MultipleMessageSendingRequest extends DefaultMessageRequest {\n    messages: Array<Message>;\n\n    constructor(messages: Array<Message>, allowDuplicates?: boolean, appId?: string) {\n        super();\n        this.messages = messages;\n        if (typeof allowDuplicates === 'boolean') {\n            this.allowDuplicates = allowDuplicates;\n        }\n        if (appId) {\n            this.appId = appId;\n        }\n    }\n}\n\nexport class GroupMessageAddRequest {\n    messages: Array<Message>;\n\n    constructor(messages: Array<Message>) {\n        this.messages = messages;\n    }\n}\n\nexport type ScheduledDateSendingRequest = {\n    scheduledDate: string\n}\n\nexport type RemoveMessageIdsToGroupRequest = {\n    messageIds: Array<string>\n}\n\nexport type GetGroupMessagesRequest = {\n    startKey?: string,\n    limit?: number\n}\n\nexport type GetGroupsRequest = {\n    startKey?: string,\n    limit?: number,\n    startDate?: string,\n    endDate?: string\n}\n\nexport type RequestConfig = {\n    method: string,\n    url: string\n}\n\ntype DateType = 'CREATED' | 'UPDATED'\n\nexport type GetMessagesRequestType = {\n    startKey?: string\n    limit?: number\n    messageId?: string\n    messageIds?: Array<string>\n    groupId?: GroupId\n    to?: string\n    from?: string\n    type?: MessageType\n    statusCode?: string\n    duration?: {\n        dateType?: DateType\n        startDate: string\n        endDate: string\n    }\n}\n\nexport class GetMessagesRequest {\n    readonly startKey?: string;\n    readonly limit?: number;\n    readonly dateType?: DateType = 'CREATED';\n    readonly messageId?: string;\n    readonly messageIds?: Array<string>;\n    readonly groupId?: GroupId;\n    readonly to?: string;\n    readonly from?: string;\n    readonly type?: MessageType;\n    readonly statusCode?: string;\n    readonly startDate?: string;\n    readonly endDate?: string;\n\n    constructor(getMessageRequestType: GetMessagesRequestType) {\n        this.startKey = getMessageRequestType.startKey;\n        this.limit = getMessageRequestType.limit;\n        if (getMessageRequestType.duration?.dateType) this.dateType = getMessageRequestType.duration.dateType;\n        if (getMessageRequestType.duration) this.startDate = formatISO(stringDateTransfer(getMessageRequestType.duration.startDate));\n        if (getMessageRequestType.duration) this.endDate = formatISO(stringDateTransfer(getMessageRequestType.duration.endDate));\n        this.messageId = getMessageRequestType.messageId;\n        this.messageIds = getMessageRequestType.messageIds;\n        this.groupId = getMessageRequestType.groupId;\n        this.to = getMessageRequestType.to;\n        this.from = getMessageRequestType.from;\n        this.type = getMessageRequestType.type;\n        this.statusCode = getMessageRequestType.statusCode;\n    }\n}\n\nexport type GetStatisticsRequestType = {\n    duration?: {\n        startDate: string | Date\n        endDate: string | Date\n    }\n    masterAccountId: string\n}\n\nexport class GetStatisticsRequest {\n    readonly startDate: string;\n    readonly endDate: string;\n    readonly masterAccountId: string;\n\n    constructor(getStatisticsRequest: GetStatisticsRequestType) {\n        if (getStatisticsRequest.duration) this.startDate = formatISO(stringDateTransfer(getStatisticsRequest.duration.startDate));\n        if (getStatisticsRequest.duration) this.endDate = formatISO(stringDateTransfer(getStatisticsRequest.duration.endDate));\n        this.masterAccountId = getStatisticsRequest.masterAccountId;\n    }\n}\n\nexport type FileType = 'KAKAO' | 'MMS' | 'DOCUMENT' | 'RCS'\n\nexport type FileUploadRequest = {\n    file: string\n    type: FileType\n    name?: string\n    link?: string\n}\n\nexport type CreateGroupRequest = DefaultAgentType & {\n    allowDuplicates: boolean\n    appId?: string\n}\n","import {customAlphabet} from 'nanoid';\nimport {formatISO} from 'date-fns';\nimport {HmacSHA256} from 'crypto-js';\nimport {ApiKeyError} from '../errors/DefaultError';\n\nenum AuthenticateType {\n    API_KEY\n}\n\nexport type AuthenticationParameter = {\n    apiKey?: string\n    apiSecret?: string\n}\n\n\n/**\n * Get Authenticate Information for CoolSMS Requests\n * @param authenticationParameter\n * @param authType\n * @return string \"Authorization value\n */\nexport default function getAuthInfo(authenticationParameter: AuthenticationParameter, authType: AuthenticateType = AuthenticateType.API_KEY): string {\n    const {apiKey, apiSecret} = authenticationParameter;\n    switch (authType) {\n        case AuthenticateType.API_KEY:\n        default:\n            const salt = customAlphabet('1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 32)();\n            const date = formatISO(new Date());\n            const hmacData = date + salt;\n            if ((!apiKey || !apiSecret) || (apiKey === '' || apiSecret === '')) {\n                throw new ApiKeyError('Invalid API Key Error');\n            }\n            const signature = HmacSHA256(hmacData, apiSecret).toString();\n            return `HMAC-SHA256 apiKey=${apiKey}, date=${date}, salt=${salt}, signature=${signature}`;\n    }\n}\n","import getAuthInfo, {AuthenticationParameter} from './authenticator';\nimport fetch from 'cross-fetch';\nimport {DefaultError, ErrorResponse} from '../errors/DefaultError';\n\ntype DefaultRequest = {\n    url: string,\n    method: string\n}\n\n/**\n * 공용 API 클라이언트 함수\n * @throws DefaultError 발송 실패 등 API 상의 다양한 오류를 표시합니다.\n * @param authParameter API 인증을 위한 파라미터\n * @param request API URI, HTTP method 정의\n * @param data API에 요청할 request body 데이터\n */\nexport default async function defaultFetcher<T, R>(authParameter: AuthenticationParameter, request: DefaultRequest, data?: T): Promise<R> {\n    const authorizationHeaderData = getAuthInfo(authParameter);\n    return await fetch(request.url, {\n        headers: {\n            'Authorization': authorizationHeaderData,\n            'Content-Type': 'application/json',\n        },\n        body: JSON.stringify(data),\n        method: request.method\n    }).then<R>(async (res) => {\n        if (res.status >= 400 && res.status < 500) {\n            const errorResponse: ErrorResponse = await res.json();\n            throw new DefaultError(errorResponse.errorCode, errorResponse.errorMessage);\n        } else if (res.status >= 500) {\n            const responseText = await res.text();\n            throw new DefaultError('UnknownException', responseText);\n        }\n        try {\n            return res.json();\n        } catch (exception) {\n            throw new Error(await res.text());\n        }\n    });\n}\n","import {URL, URLSearchParams} from 'url';\n\nexport default function queryParameterGenerator<T extends object>(url: string, data?: T): string {\n    const apiUrl = new URL(url);\n    if (data) {\n        const urlSearchParams = new URLSearchParams();\n        Object.keys(data).forEach(key => {\n            const reflectedValue = Reflect.get(data, key);\n            if (reflectedValue) {\n                urlSearchParams.append(key, reflectedValue);\n            }\n        });\n        apiUrl.search = urlSearchParams.toString();\n    }\n    return apiUrl.toString();\n}\n","import Message from './models/message';\nimport {\n    CreateGroupRequest,\n    defaultAgent,\n    FileType,\n    FileUploadRequest,\n    GetGroupMessagesRequest,\n    GetGroupsRequest,\n    GetMessagesRequest,\n    GetMessagesRequestType,\n    GetStatisticsRequest,\n    GetStatisticsRequestType,\n    GroupMessageAddRequest,\n    MultipleMessageSendingRequest,\n    RemoveMessageIdsToGroupRequest,\n    RequestConfig,\n    ScheduledDateSendingRequest,\n    SingleMessageSendingRequest\n} from './requests/messageRequest';\nimport defaultFetcher from './lib/defaultFetcher';\nimport {\n    AddMessageResponse,\n    FileUploadResponse,\n    GetBalanceResponse,\n    GetGroupsResponse,\n    GetMessagesResponse,\n    GetStatisticsResponse,\n    GroupMessageResponse,\n    RemoveGroupMessagesResponse,\n    SingleMessageSentResponse\n} from './responses/messageResponses';\nimport {GroupId} from './types/commonTypes';\nimport queryParameterGenerator from './lib/queryParameterGenerator';\nimport {formatISO} from 'date-fns';\nimport ImageToBase64 from 'image-to-base64';\nimport stringDateTransfer from './lib/stringDateTrasnfer';\n\ntype AuthInfo = {\n    apiKey: string,\n    apiSecret: string\n}\n\nexport default class CoolsmsMessageService {\n    private readonly baseUrl = 'https://api.coolsms.co.kr';\n    private readonly apiKey: string;\n    private readonly apiSecret: string;\n    private readonly authInfo: AuthInfo;\n\n    constructor(apiKey: string, apiSecret: string) {\n        this.apiKey = apiKey;\n        this.apiSecret = apiSecret;\n        this.authInfo = {\n            apiKey,\n            apiSecret\n        };\n    }\n\n    /**\n     * 단일 메시지 발송 기능\n     * @param message 메시지(문자, 알림톡 등)\n     * @param appId appstore용 app id\n     */\n    async sendOne(message: Message, appId?: string): Promise<SingleMessageSentResponse> {\n        const parameter = new SingleMessageSendingRequest(message, false, appId);\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/messages/v4/send`\n        };\n        return defaultFetcher<SingleMessageSendingRequest, SingleMessageSentResponse>(this.authInfo, requestConfig, parameter);\n    }\n\n    /**\n     * 단일 메시지 예약 발송 기능\n     * @param message 메시지(문자, 알림톡 등)\n     * @param scheduledDate\n     */\n    async sendOneFuture(message: Message, scheduledDate: string | Date): Promise<GroupMessageResponse> {\n        const groupId = await this.createGroup();\n        await this.addMessagesToGroup(groupId, [message]);\n        scheduledDate = stringDateTransfer(scheduledDate);\n        return this.reserveGroup(groupId, scheduledDate);\n    }\n\n    /**\n     * 여러 메시지 즉시 발송 기능\n     * 한번 요청으로 최대 10,000건의 메시지를 추가할 수 있습니다.\n     * @param messages 여러 메시지(문자, 알림톡 등)\n     * @param allowDuplicates 중복 수신번호 허용\n     * @param appId appstore용 app id\n     */\n    async sendMany(messages: Array<Message>, allowDuplicates = false, appId?: string): Promise<GroupMessageResponse> {\n        const parameter = new MultipleMessageSendingRequest(messages, allowDuplicates, appId);\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/messages/v4/send-many`\n        };\n        return defaultFetcher<MultipleMessageSendingRequest, GroupMessageResponse>(this.authInfo, requestConfig, parameter);\n    }\n\n    /**\n     * 여러 메시지 예약 발송 기능\n     * 한번 요청으로 최대 10,000건의 메시지를 추가할 수 있습니다.\n     * @param messages 여러 메시지(문자, 알림톡 등)\n     * @param scheduledDate 예약 발송 일자\n     * @param allowDuplicates 중복 수신번호 허용\n     * @param appId appstore용 app id\n     */\n    async sendManyFuture(messages: Array<Message>, scheduledDate: string | Date, allowDuplicates = false, appId?: string): Promise<GroupMessageResponse> {\n        const groupId = await this.createGroup(allowDuplicates, appId);\n        await this.addMessagesToGroup(groupId, messages);\n        scheduledDate = stringDateTransfer(scheduledDate);\n        return this.reserveGroup(groupId, scheduledDate);\n    }\n\n    /**\n     * 그룹 생성\n     */\n    async createGroup(allowDuplicates?: boolean, appId?: string): Promise<GroupId> {\n        allowDuplicates = allowDuplicates ?? false;\n        const {sdkVersion, osPlatform} = defaultAgent;\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/messages/v4/groups`\n        };\n        return defaultFetcher<CreateGroupRequest, GroupMessageResponse>(this.authInfo, requestConfig, {\n            sdkVersion,\n            osPlatform,\n            allowDuplicates,\n            appId\n        }).then(res => res.groupId);\n    }\n\n    /**\n     * 그룹 메시지 추가\n     * 한번 요청으로 최대 10,000건의 메시지를 추가할 수 있습니다.\n     * @param groupId 생성 된 Group ID\n     * @param messages 여러 메시지(문자, 알림톡 등)\n     */\n    async addMessagesToGroup(groupId: GroupId, messages: Required<Array<Message>>): Promise<AddMessageResponse> {\n        const requestConfig: RequestConfig = {\n            method: 'PUT',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}/messages`\n        };\n        return defaultFetcher<GroupMessageAddRequest, AddMessageResponse>(this.authInfo, requestConfig, new GroupMessageAddRequest(messages));\n    }\n\n    /**\n     * 그룹 메시지 전송 요청\n     * @param groupId 생성 된 Group ID\n     */\n    async sendGroup(groupId: GroupId): Promise<GroupMessageResponse> {\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}/send`\n        };\n        return defaultFetcher<undefined, GroupMessageResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 그룹 예약 발송 설정\n     * @param groupId 생성 된 Group ID\n     * @param scheduledDate 예약발송 할 날짜\n     */\n    async reserveGroup(groupId: GroupId, scheduledDate: Date) {\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}/schedule`\n        };\n        const formattedScheduledDate = formatISO(scheduledDate);\n        return defaultFetcher<ScheduledDateSendingRequest, GroupMessageResponse>(this.authInfo, requestConfig, {\n            scheduledDate: formattedScheduledDate\n        });\n    }\n\n    /**\n     * 그룹 통계 정보 조회\n     * @param data 그룹 정보 상세 조회용 request 데이터, date 관련 파라미터는 iso8601 포맷으로 보내야 함\n     */\n    async getGroups(data?: GetGroupsRequest) {\n        const endpoint = queryParameterGenerator(`${this.baseUrl}/messages/v4/groups`, data);\n        const requestConfig: RequestConfig = {\n            method: 'GET',\n            url: endpoint\n        };\n        return defaultFetcher<undefined, GetGroupsResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 그룹 내 메시지 목록 조회\n     * @param groupId 생성 된 Group ID\n     * @param data startkey, limit 등 쿼리 조건 파라미터\n     */\n    async getGroupMessages(groupId: GroupId, data?: GetGroupMessagesRequest): Promise<GetMessagesResponse> {\n        const endpoint = queryParameterGenerator(`${this.baseUrl}/messages/v4/groups/${groupId}/messages`, data);\n        const requestConfig: RequestConfig = {\n            method: 'GET',\n            url: endpoint\n        };\n        return defaultFetcher<undefined, GetMessagesResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 그룹 내 특정 메시지 삭제\n     * @param groupId 생성 된 Group Id\n     * @param messageIds 생성 된 메시지 ID 목록\n     */\n    async removeGroupMessages(groupId: GroupId, messageIds: Required<Array<string>>): Promise<RemoveGroupMessagesResponse> {\n        const requestConfig: RequestConfig = {\n            method: 'DELETE',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}/messages`\n        };\n        return defaultFetcher<RemoveMessageIdsToGroupRequest, RemoveGroupMessagesResponse>(this.authInfo, requestConfig, {messageIds});\n    }\n\n    /**\n     * 그룹 내 예약 발송 취소(메시지 실패 전체 처리 됨)\n     * @param groupId 생성 된 Group ID\n     */\n    async removeReservationToGroup(groupId: GroupId): Promise<GroupMessageResponse> {\n        const requestConfig: RequestConfig = {\n            method: 'DELETE',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}/schedule`\n        };\n        return defaultFetcher<undefined, GroupMessageResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 그룹 삭제\n     * @param groupId\n     */\n    async removeGroup(groupId: GroupId) {\n        const requestConfig: RequestConfig = {\n            method: 'DELETE',\n            url: `${this.baseUrl}/messages/v4/groups/${groupId}`\n        };\n        return defaultFetcher<undefined, GroupMessageResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 메시지 목록 조회\n     * @param data 목록 조회 상세조건 파라미터\n     */\n    async getMessages(data?: Readonly<GetMessagesRequestType>): Promise<GetMessagesResponse> {\n        const parameter: GetMessagesRequest | object = data ? new GetMessagesRequest(data) : {};\n        const endpoint = queryParameterGenerator(`${this.baseUrl}/messages/v4/list`, parameter);\n        const requestConfig: RequestConfig = {\n            method: 'GET',\n            url: endpoint\n        };\n        return defaultFetcher<undefined, GetMessagesResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 통계 조회\n     * @param data 통계 상세 조건 파라미터\n     * @returns GetStatisticsResponse 통계 결과\n     */\n    async getStatistics(data?: Readonly<GetStatisticsRequestType>): Promise<GetStatisticsResponse> {\n        const parameter: GetStatisticsRequest | object = data ? new GetStatisticsRequest(data) : {};\n        const endpoint = queryParameterGenerator(`${this.baseUrl}/messages/v4/statistics`, parameter);\n        const requestConfig: RequestConfig = {\n            method: 'GET',\n            url: endpoint\n        };\n        return defaultFetcher<undefined, GetStatisticsResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 잔액조회\n     * @returns GetBalanceResponse\n     */\n    async getBalance(): Promise<GetBalanceResponse> {\n        const requestConfig: RequestConfig = {\n            method: 'GET',\n            url: `${this.baseUrl}/cash/v1/balance`\n        };\n        return defaultFetcher<undefined, GetBalanceResponse>(this.authInfo, requestConfig);\n    }\n\n    /**\n     * 파일(이미지) 업로드\n     * 카카오 친구톡 이미지는 500kb, MMS는 200kb, 발신번호 서류 인증용 파일은 2mb의 제한이 있음\n     * @param filePath 해당 파일의 경로 또는 접근 가능한 이미지 URL\n     * @param fileType 저장할 파일의 유형, 예) 카카오 친구톡 용 이미지 -> KAKAO, MMS용 사진 -> MMS, 발신번호 서류 인증에 쓰이는 문서 등 -> DOCUMENT, RCS 이미지 -> RCS\n     * @param name 파일 이름\n     * @param link 파일 링크, 친구톡의 경우 필수 값\n     */\n    async uploadFile(filePath: string, fileType: FileType, name?: string, link?: string): Promise<FileUploadResponse> {\n        const encodedFile = await ImageToBase64(filePath);\n        const requestConfig: RequestConfig = {\n            method: 'POST',\n            url: `${this.baseUrl}/storage/v1/files`\n        };\n        const parameter: FileUploadRequest = {\n            file: encodedFile,\n            type: fileType,\n            name,\n            link\n        };\n        return defaultFetcher<FileUploadRequest, FileUploadResponse>(this.authInfo, requestConfig, parameter);\n    }\n}\n"]}