/** * @public * @category 앨범 * @name AlbumItemType * @description 앨범에서 가져올 미디어 유형이에요. */ export type AlbumItemType = "PHOTO" | "VIDEO"; /** * @public * @category 앨범 * @name FetchAlbumItemsOptions * @description 앨범에서 사진·동영상을 선택할 때 사용하는 옵션이에요. * @property {Array<"PHOTO" | "VIDEO">} [types] - 가져올 미디어 유형 목록이에요. 지정하지 않으면 사진만 가져와요. * @property {number} [maxCount] - 가져올 항목의 최대 개수예요. 기본값은 10이에요. * @property {number} [maxWidth] - 이미지의 최대 폭이에요. 단위는 픽셀이에요. 기본값은 1024이에요. * @property {boolean} [base64] - 이미지의 `dataUri`를 Base64 문자열로 반환할지 여부예요. 기본값은 `false`이에요. */ export interface FetchAlbumItemsOptions { types?: AlbumItemType[]; maxCount?: number; maxWidth?: number; base64?: boolean; } /** * @public * @category 앨범 * @name AlbumItemResponse * @description 앨범에서 선택한 미디어 항목이에요. * @property {string} id - 항목의 고유 ID예요. * @property {string} dataUri - 미디어 데이터 URI예요. `type`이 `PHOTO`면서 `base64` 옵션이 `true`이면 Base64 문자열로 반환돼요. * @property {"PHOTO" | "VIDEO"} type - 미디어 유형이에요. */ export interface AlbumItemResponse { id: string; dataUri: string; type: AlbumItemType; } /** * @public * @category 앨범 * @name fetchAlbumItems * @description 사용자 앨범에서 사진·동영상을 선택해 가져와요. 사용자가 선택을 취소하면 빈 배열 `[]`을 반환해요. * * @param {FetchAlbumItemsOptions} [options] - 조회 옵션을 담은 객체예요. * @returns {Promise} 선택한 미디어 목록을 반환해요. 취소 시 빈 배열을 반환해요. * * @throws 다음 에러 코드가 발생할 수 있어요. * - {code: `NOT_ALLOWED`}: 앨범 접근이 허용되지 않았을 때 * - {code: `INVALID_REQUEST`}: 요청 파라미터가 올바르지 않을 때 * - {code: `INVALID_DATA`}: 미디어 데이터가 유효하지 않을 때 * - {code: `UNSUPPORTED_APP_VERSION`}: 토스앱 버전이 5.261.0보다 낮을 때 * * @example * ```tsx * import { fetchAlbumItems, FetchAlbumItemsError } from '@apps-in-toss/web-framework'; * * async function pickMedia() { * try { * const items = await fetchAlbumItems({ * types: ['PHOTO', 'VIDEO'], * maxCount: 5, * base64: true, * }); * * if (items.length === 0) { * console.log('선택이 취소되었어요.'); * return; * } * * items.forEach((item) => { * console.log(item.type, item.id); * }); * } catch (error) { * console.error('앨범 조회 오류:', error.code); * } * } * ``` */ export declare function fetchAlbumItems(options?: FetchAlbumItemsOptions): Promise; export {};