1 | import { Subscription } from '@unimodules/core';
|
2 | import { PermissionResponse, PermissionStatus } from 'unimodules-permissions-interface';
|
3 | export declare type MediaTypeValue = 'audio' | 'photo' | 'video' | 'unknown';
|
4 | export declare type SortByKey = 'default' | 'mediaType' | 'width' | 'height' | 'creationTime' | 'modificationTime' | 'duration';
|
5 | export declare type SortByValue = [SortByKey, boolean] | SortByKey;
|
6 | export declare type MediaTypeObject = {
|
7 | audio: 'audio';
|
8 | photo: 'photo';
|
9 | video: 'video';
|
10 | unknown: 'unknown';
|
11 | };
|
12 | export declare type SortByObject = {
|
13 | default: 'default';
|
14 | mediaType: 'mediaType';
|
15 | width: 'width';
|
16 | height: 'height';
|
17 | creationTime: 'creationTime';
|
18 | modificationTime: 'modificationTime';
|
19 | duration: 'duration';
|
20 | };
|
21 | export declare type Asset = {
|
22 | id: string;
|
23 | filename: string;
|
24 | uri: string;
|
25 | mediaType: MediaTypeValue;
|
26 | mediaSubtypes?: string[];
|
27 | width: number;
|
28 | height: number;
|
29 | creationTime: number;
|
30 | modificationTime: number;
|
31 | duration: number;
|
32 | albumId?: string;
|
33 | };
|
34 | export declare type AssetInfo = Asset & {
|
35 | localUri?: string;
|
36 | location?: Location;
|
37 | exif?: object;
|
38 | isFavorite?: boolean;
|
39 | };
|
40 | export declare type Location = {
|
41 | latitude: number;
|
42 | longitude: number;
|
43 | };
|
44 | export declare type Album = {
|
45 | id: string;
|
46 | title: string;
|
47 | assetCount: number;
|
48 | type?: string;
|
49 | startTime: number;
|
50 | endTime: number;
|
51 | approximateLocation?: Location;
|
52 | locationNames?: string[];
|
53 | };
|
54 | export declare type AlbumsOptions = {
|
55 | includeSmartAlbums?: boolean;
|
56 | };
|
57 | export declare type AssetsOptions = {
|
58 | first?: number;
|
59 | after?: AssetRef;
|
60 | album?: AlbumRef;
|
61 | sortBy?: SortByValue[] | SortByValue;
|
62 | mediaType?: MediaTypeValue[] | MediaTypeValue;
|
63 | createdAfter?: Date | number;
|
64 | createdBefore?: Date | number;
|
65 | };
|
66 | export declare type PagedInfo<T> = {
|
67 | assets: T[];
|
68 | endCursor: string;
|
69 | hasNextPage: boolean;
|
70 | totalCount: number;
|
71 | };
|
72 | export { PermissionStatus, PermissionResponse };
|
73 | export declare type AssetRef = Asset | string;
|
74 | export declare type AlbumRef = Album | string;
|
75 | export declare const MediaType: MediaTypeObject;
|
76 | export declare const SortBy: SortByObject;
|
77 | export declare function requestPermissionsAsync(): Promise<PermissionResponse>;
|
78 | export declare function getPermissionsAsync(): Promise<PermissionResponse>;
|
79 | export declare function createAssetAsync(localUri: string): Promise<Asset>;
|
80 | export declare function saveToLibraryAsync(localUri: string): Promise<void>;
|
81 | export declare function addAssetsToAlbumAsync(assets: AssetRef[] | AssetRef, album: AlbumRef, copy?: boolean): Promise<any>;
|
82 | export declare function removeAssetsFromAlbumAsync(assets: AssetRef[] | AssetRef, album: AlbumRef): Promise<any>;
|
83 | export declare function deleteAssetsAsync(assets: AssetRef[] | AssetRef): Promise<any>;
|
84 | export declare function getAssetInfoAsync(asset: AssetRef): Promise<AssetInfo>;
|
85 | export declare function getAlbumsAsync({ includeSmartAlbums }?: AlbumsOptions): Promise<Album[]>;
|
86 | export declare function getAlbumAsync(title: string): Promise<Album>;
|
87 | export declare function createAlbumAsync(albumName: string, asset?: AssetRef, copyAsset?: boolean): Promise<Album>;
|
88 | export declare function deleteAlbumsAsync(albums: AlbumRef[] | AlbumRef, assetRemove?: boolean): Promise<any>;
|
89 | export declare function getAssetsAsync(assetsOptions?: AssetsOptions): Promise<PagedInfo<Asset>>;
|
90 | export declare function addListener(listener: () => void): Subscription;
|
91 | export declare function removeSubscription(subscription: Subscription): void;
|
92 | export declare function removeAllListeners(): void;
|
93 | export declare function getMomentsAsync(): Promise<any>;
|