@stack0/sdk 0.5.2 → 0.5.4
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/cdn/index.d.mts +244 -1
- package/dist/cdn/index.d.ts +244 -1
- package/dist/cdn/index.js +218 -0
- package/dist/cdn/index.js.map +1 -1
- package/dist/cdn/index.mjs +218 -0
- package/dist/cdn/index.mjs.map +1 -1
- package/dist/extraction/index.d.mts +25 -1
- package/dist/extraction/index.d.ts +25 -1
- package/dist/extraction/index.js +22 -0
- package/dist/extraction/index.js.map +1 -1
- package/dist/extraction/index.mjs +22 -0
- package/dist/extraction/index.mjs.map +1 -1
- package/dist/index.d.mts +697 -23
- package/dist/index.d.ts +697 -23
- package/dist/index.js +833 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +833 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cdn/index.d.mts
CHANGED
|
@@ -370,6 +370,125 @@ interface BundleDownloadUrlResponse {
|
|
|
370
370
|
downloadUrl: string;
|
|
371
371
|
expiresAt: Date;
|
|
372
372
|
}
|
|
373
|
+
type CdnEnvironment = "sandbox" | "production";
|
|
374
|
+
interface CdnUsageRequest {
|
|
375
|
+
projectSlug?: string;
|
|
376
|
+
environment?: CdnEnvironment;
|
|
377
|
+
periodStart?: Date | string;
|
|
378
|
+
periodEnd?: Date | string;
|
|
379
|
+
}
|
|
380
|
+
interface CdnUsageResponse {
|
|
381
|
+
periodStart: Date;
|
|
382
|
+
periodEnd: Date;
|
|
383
|
+
requests: number;
|
|
384
|
+
bandwidthBytes: number;
|
|
385
|
+
bandwidthFormatted: string;
|
|
386
|
+
transformations: number;
|
|
387
|
+
storageBytes: number;
|
|
388
|
+
storageFormatted: string;
|
|
389
|
+
estimatedCostCents: number;
|
|
390
|
+
estimatedCostFormatted: string;
|
|
391
|
+
}
|
|
392
|
+
interface CdnUsageHistoryRequest {
|
|
393
|
+
projectSlug?: string;
|
|
394
|
+
environment?: CdnEnvironment;
|
|
395
|
+
days?: number;
|
|
396
|
+
granularity?: "hour" | "day" | "week" | "month";
|
|
397
|
+
}
|
|
398
|
+
interface CdnUsageDataPoint {
|
|
399
|
+
timestamp: Date;
|
|
400
|
+
requests: number;
|
|
401
|
+
bandwidthBytes: number;
|
|
402
|
+
transformations: number;
|
|
403
|
+
}
|
|
404
|
+
interface CdnUsageHistoryResponse {
|
|
405
|
+
data: CdnUsageDataPoint[];
|
|
406
|
+
totals: {
|
|
407
|
+
requests: number;
|
|
408
|
+
bandwidthBytes: number;
|
|
409
|
+
transformations: number;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface CdnStorageBreakdownRequest {
|
|
413
|
+
projectSlug?: string;
|
|
414
|
+
environment?: CdnEnvironment;
|
|
415
|
+
groupBy?: "type" | "folder";
|
|
416
|
+
}
|
|
417
|
+
interface CdnStorageBreakdownItem {
|
|
418
|
+
key: string;
|
|
419
|
+
count: number;
|
|
420
|
+
sizeBytes: number;
|
|
421
|
+
sizeFormatted: string;
|
|
422
|
+
percentage: number;
|
|
423
|
+
}
|
|
424
|
+
interface CdnStorageBreakdownResponse {
|
|
425
|
+
items: CdnStorageBreakdownItem[];
|
|
426
|
+
total: {
|
|
427
|
+
count: number;
|
|
428
|
+
sizeBytes: number;
|
|
429
|
+
sizeFormatted: string;
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
interface GetFolderRequest {
|
|
433
|
+
id: string;
|
|
434
|
+
}
|
|
435
|
+
interface GetFolderByPathRequest {
|
|
436
|
+
path: string;
|
|
437
|
+
}
|
|
438
|
+
interface UpdateFolderRequest {
|
|
439
|
+
id: string;
|
|
440
|
+
name?: string;
|
|
441
|
+
}
|
|
442
|
+
interface ListFoldersRequest {
|
|
443
|
+
parentId?: string;
|
|
444
|
+
limit?: number;
|
|
445
|
+
offset?: number;
|
|
446
|
+
search?: string;
|
|
447
|
+
}
|
|
448
|
+
interface FolderListItem {
|
|
449
|
+
id: string;
|
|
450
|
+
name: string;
|
|
451
|
+
path: string;
|
|
452
|
+
parentId: string | null;
|
|
453
|
+
assetCount: number;
|
|
454
|
+
totalSize: number;
|
|
455
|
+
createdAt: Date;
|
|
456
|
+
}
|
|
457
|
+
interface ListFoldersResponse {
|
|
458
|
+
folders: FolderListItem[];
|
|
459
|
+
total: number;
|
|
460
|
+
hasMore: boolean;
|
|
461
|
+
}
|
|
462
|
+
interface MoveFolderRequest {
|
|
463
|
+
id: string;
|
|
464
|
+
newParentId: string | null;
|
|
465
|
+
}
|
|
466
|
+
interface MoveFolderResponse {
|
|
467
|
+
success: boolean;
|
|
468
|
+
}
|
|
469
|
+
interface VideoThumbnail {
|
|
470
|
+
id: string;
|
|
471
|
+
assetId: string;
|
|
472
|
+
timestamp: number;
|
|
473
|
+
url: string;
|
|
474
|
+
width: number | null;
|
|
475
|
+
height: number | null;
|
|
476
|
+
format: string;
|
|
477
|
+
}
|
|
478
|
+
interface ListThumbnailsRequest {
|
|
479
|
+
assetId: string;
|
|
480
|
+
}
|
|
481
|
+
interface ListThumbnailsResponse {
|
|
482
|
+
thumbnails: VideoThumbnail[];
|
|
483
|
+
}
|
|
484
|
+
interface MovePrivateFilesRequest {
|
|
485
|
+
fileIds: string[];
|
|
486
|
+
folder: string | null;
|
|
487
|
+
}
|
|
488
|
+
interface MovePrivateFilesResponse {
|
|
489
|
+
success: boolean;
|
|
490
|
+
movedCount: number;
|
|
491
|
+
}
|
|
373
492
|
|
|
374
493
|
/**
|
|
375
494
|
* Stack0 CDN Client
|
|
@@ -825,6 +944,130 @@ declare class CDN {
|
|
|
825
944
|
success: boolean;
|
|
826
945
|
}>;
|
|
827
946
|
private convertBundleDates;
|
|
947
|
+
/**
|
|
948
|
+
* Get current usage stats for the billing period
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```typescript
|
|
952
|
+
* const usage = await cdn.getUsage({
|
|
953
|
+
* projectSlug: 'my-project',
|
|
954
|
+
* });
|
|
955
|
+
* console.log(`Bandwidth: ${usage.bandwidthFormatted}`);
|
|
956
|
+
* console.log(`Estimated cost: ${usage.estimatedCostFormatted}`);
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
getUsage(request?: CdnUsageRequest): Promise<CdnUsageResponse>;
|
|
960
|
+
/**
|
|
961
|
+
* Get usage history (time series data for charts)
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```typescript
|
|
965
|
+
* const history = await cdn.getUsageHistory({
|
|
966
|
+
* projectSlug: 'my-project',
|
|
967
|
+
* days: 30,
|
|
968
|
+
* });
|
|
969
|
+
* console.log(`Total requests: ${history.totals.requests}`);
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
getUsageHistory(request?: CdnUsageHistoryRequest): Promise<CdnUsageHistoryResponse>;
|
|
973
|
+
/**
|
|
974
|
+
* Get storage breakdown by type or folder
|
|
975
|
+
*
|
|
976
|
+
* @example
|
|
977
|
+
* ```typescript
|
|
978
|
+
* const breakdown = await cdn.getStorageBreakdown({
|
|
979
|
+
* projectSlug: 'my-project',
|
|
980
|
+
* groupBy: 'type',
|
|
981
|
+
* });
|
|
982
|
+
* breakdown.items.forEach(item => {
|
|
983
|
+
* console.log(`${item.key}: ${item.sizeFormatted} (${item.percentage}%)`);
|
|
984
|
+
* });
|
|
985
|
+
* ```
|
|
986
|
+
*/
|
|
987
|
+
getStorageBreakdown(request?: CdnStorageBreakdownRequest): Promise<CdnStorageBreakdownResponse>;
|
|
988
|
+
private convertUsageDates;
|
|
989
|
+
private convertUsageDataPointDates;
|
|
990
|
+
/**
|
|
991
|
+
* Get a folder by ID
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```typescript
|
|
995
|
+
* const folder = await cdn.getFolder('folder-id');
|
|
996
|
+
* console.log(`Folder: ${folder.name}, Assets: ${folder.assetCount}`);
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
getFolder(id: string): Promise<Folder>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get a folder by its path
|
|
1002
|
+
*
|
|
1003
|
+
* @example
|
|
1004
|
+
* ```typescript
|
|
1005
|
+
* const folder = await cdn.getFolderByPath('/images/avatars');
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
getFolderByPath(path: string): Promise<Folder>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Update a folder's name
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```typescript
|
|
1014
|
+
* const folder = await cdn.updateFolder({
|
|
1015
|
+
* id: 'folder-id',
|
|
1016
|
+
* name: 'New Folder Name',
|
|
1017
|
+
* });
|
|
1018
|
+
* ```
|
|
1019
|
+
*/
|
|
1020
|
+
updateFolder(request: UpdateFolderRequest): Promise<Folder>;
|
|
1021
|
+
/**
|
|
1022
|
+
* List folders with optional filters
|
|
1023
|
+
*
|
|
1024
|
+
* @example
|
|
1025
|
+
* ```typescript
|
|
1026
|
+
* const { folders, total } = await cdn.listFolders({
|
|
1027
|
+
* parentId: null, // root level
|
|
1028
|
+
* limit: 50,
|
|
1029
|
+
* });
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
listFolders(request?: ListFoldersRequest): Promise<ListFoldersResponse>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Move a folder to a new parent
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```typescript
|
|
1038
|
+
* await cdn.moveFolder({
|
|
1039
|
+
* id: 'folder-id',
|
|
1040
|
+
* newParentId: 'new-parent-id', // or null for root
|
|
1041
|
+
* });
|
|
1042
|
+
* ```
|
|
1043
|
+
*/
|
|
1044
|
+
moveFolder(request: MoveFolderRequest): Promise<MoveFolderResponse>;
|
|
1045
|
+
private convertFolderListItemDates;
|
|
1046
|
+
/**
|
|
1047
|
+
* List all thumbnails for a video asset
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```typescript
|
|
1051
|
+
* const { thumbnails } = await cdn.listThumbnails('video-asset-id');
|
|
1052
|
+
* thumbnails.forEach(thumb => {
|
|
1053
|
+
* console.log(`${thumb.timestamp}s: ${thumb.url}`);
|
|
1054
|
+
* });
|
|
1055
|
+
* ```
|
|
1056
|
+
*/
|
|
1057
|
+
listThumbnails(assetId: string): Promise<ListThumbnailsResponse>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Move private files to a different folder
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```typescript
|
|
1063
|
+
* const result = await cdn.movePrivateFiles({
|
|
1064
|
+
* fileIds: ['file-1', 'file-2'],
|
|
1065
|
+
* folder: '/confidential/archive',
|
|
1066
|
+
* });
|
|
1067
|
+
* console.log(`Moved ${result.movedCount} files`);
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
movePrivateFiles(request: MovePrivateFilesRequest): Promise<MovePrivateFilesResponse>;
|
|
828
1071
|
}
|
|
829
1072
|
|
|
830
|
-
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type MoveAssetsRequest, type MoveAssetsResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|
|
1073
|
+
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|
package/dist/cdn/index.d.ts
CHANGED
|
@@ -370,6 +370,125 @@ interface BundleDownloadUrlResponse {
|
|
|
370
370
|
downloadUrl: string;
|
|
371
371
|
expiresAt: Date;
|
|
372
372
|
}
|
|
373
|
+
type CdnEnvironment = "sandbox" | "production";
|
|
374
|
+
interface CdnUsageRequest {
|
|
375
|
+
projectSlug?: string;
|
|
376
|
+
environment?: CdnEnvironment;
|
|
377
|
+
periodStart?: Date | string;
|
|
378
|
+
periodEnd?: Date | string;
|
|
379
|
+
}
|
|
380
|
+
interface CdnUsageResponse {
|
|
381
|
+
periodStart: Date;
|
|
382
|
+
periodEnd: Date;
|
|
383
|
+
requests: number;
|
|
384
|
+
bandwidthBytes: number;
|
|
385
|
+
bandwidthFormatted: string;
|
|
386
|
+
transformations: number;
|
|
387
|
+
storageBytes: number;
|
|
388
|
+
storageFormatted: string;
|
|
389
|
+
estimatedCostCents: number;
|
|
390
|
+
estimatedCostFormatted: string;
|
|
391
|
+
}
|
|
392
|
+
interface CdnUsageHistoryRequest {
|
|
393
|
+
projectSlug?: string;
|
|
394
|
+
environment?: CdnEnvironment;
|
|
395
|
+
days?: number;
|
|
396
|
+
granularity?: "hour" | "day" | "week" | "month";
|
|
397
|
+
}
|
|
398
|
+
interface CdnUsageDataPoint {
|
|
399
|
+
timestamp: Date;
|
|
400
|
+
requests: number;
|
|
401
|
+
bandwidthBytes: number;
|
|
402
|
+
transformations: number;
|
|
403
|
+
}
|
|
404
|
+
interface CdnUsageHistoryResponse {
|
|
405
|
+
data: CdnUsageDataPoint[];
|
|
406
|
+
totals: {
|
|
407
|
+
requests: number;
|
|
408
|
+
bandwidthBytes: number;
|
|
409
|
+
transformations: number;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface CdnStorageBreakdownRequest {
|
|
413
|
+
projectSlug?: string;
|
|
414
|
+
environment?: CdnEnvironment;
|
|
415
|
+
groupBy?: "type" | "folder";
|
|
416
|
+
}
|
|
417
|
+
interface CdnStorageBreakdownItem {
|
|
418
|
+
key: string;
|
|
419
|
+
count: number;
|
|
420
|
+
sizeBytes: number;
|
|
421
|
+
sizeFormatted: string;
|
|
422
|
+
percentage: number;
|
|
423
|
+
}
|
|
424
|
+
interface CdnStorageBreakdownResponse {
|
|
425
|
+
items: CdnStorageBreakdownItem[];
|
|
426
|
+
total: {
|
|
427
|
+
count: number;
|
|
428
|
+
sizeBytes: number;
|
|
429
|
+
sizeFormatted: string;
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
interface GetFolderRequest {
|
|
433
|
+
id: string;
|
|
434
|
+
}
|
|
435
|
+
interface GetFolderByPathRequest {
|
|
436
|
+
path: string;
|
|
437
|
+
}
|
|
438
|
+
interface UpdateFolderRequest {
|
|
439
|
+
id: string;
|
|
440
|
+
name?: string;
|
|
441
|
+
}
|
|
442
|
+
interface ListFoldersRequest {
|
|
443
|
+
parentId?: string;
|
|
444
|
+
limit?: number;
|
|
445
|
+
offset?: number;
|
|
446
|
+
search?: string;
|
|
447
|
+
}
|
|
448
|
+
interface FolderListItem {
|
|
449
|
+
id: string;
|
|
450
|
+
name: string;
|
|
451
|
+
path: string;
|
|
452
|
+
parentId: string | null;
|
|
453
|
+
assetCount: number;
|
|
454
|
+
totalSize: number;
|
|
455
|
+
createdAt: Date;
|
|
456
|
+
}
|
|
457
|
+
interface ListFoldersResponse {
|
|
458
|
+
folders: FolderListItem[];
|
|
459
|
+
total: number;
|
|
460
|
+
hasMore: boolean;
|
|
461
|
+
}
|
|
462
|
+
interface MoveFolderRequest {
|
|
463
|
+
id: string;
|
|
464
|
+
newParentId: string | null;
|
|
465
|
+
}
|
|
466
|
+
interface MoveFolderResponse {
|
|
467
|
+
success: boolean;
|
|
468
|
+
}
|
|
469
|
+
interface VideoThumbnail {
|
|
470
|
+
id: string;
|
|
471
|
+
assetId: string;
|
|
472
|
+
timestamp: number;
|
|
473
|
+
url: string;
|
|
474
|
+
width: number | null;
|
|
475
|
+
height: number | null;
|
|
476
|
+
format: string;
|
|
477
|
+
}
|
|
478
|
+
interface ListThumbnailsRequest {
|
|
479
|
+
assetId: string;
|
|
480
|
+
}
|
|
481
|
+
interface ListThumbnailsResponse {
|
|
482
|
+
thumbnails: VideoThumbnail[];
|
|
483
|
+
}
|
|
484
|
+
interface MovePrivateFilesRequest {
|
|
485
|
+
fileIds: string[];
|
|
486
|
+
folder: string | null;
|
|
487
|
+
}
|
|
488
|
+
interface MovePrivateFilesResponse {
|
|
489
|
+
success: boolean;
|
|
490
|
+
movedCount: number;
|
|
491
|
+
}
|
|
373
492
|
|
|
374
493
|
/**
|
|
375
494
|
* Stack0 CDN Client
|
|
@@ -825,6 +944,130 @@ declare class CDN {
|
|
|
825
944
|
success: boolean;
|
|
826
945
|
}>;
|
|
827
946
|
private convertBundleDates;
|
|
947
|
+
/**
|
|
948
|
+
* Get current usage stats for the billing period
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* ```typescript
|
|
952
|
+
* const usage = await cdn.getUsage({
|
|
953
|
+
* projectSlug: 'my-project',
|
|
954
|
+
* });
|
|
955
|
+
* console.log(`Bandwidth: ${usage.bandwidthFormatted}`);
|
|
956
|
+
* console.log(`Estimated cost: ${usage.estimatedCostFormatted}`);
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
getUsage(request?: CdnUsageRequest): Promise<CdnUsageResponse>;
|
|
960
|
+
/**
|
|
961
|
+
* Get usage history (time series data for charts)
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```typescript
|
|
965
|
+
* const history = await cdn.getUsageHistory({
|
|
966
|
+
* projectSlug: 'my-project',
|
|
967
|
+
* days: 30,
|
|
968
|
+
* });
|
|
969
|
+
* console.log(`Total requests: ${history.totals.requests}`);
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
getUsageHistory(request?: CdnUsageHistoryRequest): Promise<CdnUsageHistoryResponse>;
|
|
973
|
+
/**
|
|
974
|
+
* Get storage breakdown by type or folder
|
|
975
|
+
*
|
|
976
|
+
* @example
|
|
977
|
+
* ```typescript
|
|
978
|
+
* const breakdown = await cdn.getStorageBreakdown({
|
|
979
|
+
* projectSlug: 'my-project',
|
|
980
|
+
* groupBy: 'type',
|
|
981
|
+
* });
|
|
982
|
+
* breakdown.items.forEach(item => {
|
|
983
|
+
* console.log(`${item.key}: ${item.sizeFormatted} (${item.percentage}%)`);
|
|
984
|
+
* });
|
|
985
|
+
* ```
|
|
986
|
+
*/
|
|
987
|
+
getStorageBreakdown(request?: CdnStorageBreakdownRequest): Promise<CdnStorageBreakdownResponse>;
|
|
988
|
+
private convertUsageDates;
|
|
989
|
+
private convertUsageDataPointDates;
|
|
990
|
+
/**
|
|
991
|
+
* Get a folder by ID
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```typescript
|
|
995
|
+
* const folder = await cdn.getFolder('folder-id');
|
|
996
|
+
* console.log(`Folder: ${folder.name}, Assets: ${folder.assetCount}`);
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
getFolder(id: string): Promise<Folder>;
|
|
1000
|
+
/**
|
|
1001
|
+
* Get a folder by its path
|
|
1002
|
+
*
|
|
1003
|
+
* @example
|
|
1004
|
+
* ```typescript
|
|
1005
|
+
* const folder = await cdn.getFolderByPath('/images/avatars');
|
|
1006
|
+
* ```
|
|
1007
|
+
*/
|
|
1008
|
+
getFolderByPath(path: string): Promise<Folder>;
|
|
1009
|
+
/**
|
|
1010
|
+
* Update a folder's name
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```typescript
|
|
1014
|
+
* const folder = await cdn.updateFolder({
|
|
1015
|
+
* id: 'folder-id',
|
|
1016
|
+
* name: 'New Folder Name',
|
|
1017
|
+
* });
|
|
1018
|
+
* ```
|
|
1019
|
+
*/
|
|
1020
|
+
updateFolder(request: UpdateFolderRequest): Promise<Folder>;
|
|
1021
|
+
/**
|
|
1022
|
+
* List folders with optional filters
|
|
1023
|
+
*
|
|
1024
|
+
* @example
|
|
1025
|
+
* ```typescript
|
|
1026
|
+
* const { folders, total } = await cdn.listFolders({
|
|
1027
|
+
* parentId: null, // root level
|
|
1028
|
+
* limit: 50,
|
|
1029
|
+
* });
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
listFolders(request?: ListFoldersRequest): Promise<ListFoldersResponse>;
|
|
1033
|
+
/**
|
|
1034
|
+
* Move a folder to a new parent
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```typescript
|
|
1038
|
+
* await cdn.moveFolder({
|
|
1039
|
+
* id: 'folder-id',
|
|
1040
|
+
* newParentId: 'new-parent-id', // or null for root
|
|
1041
|
+
* });
|
|
1042
|
+
* ```
|
|
1043
|
+
*/
|
|
1044
|
+
moveFolder(request: MoveFolderRequest): Promise<MoveFolderResponse>;
|
|
1045
|
+
private convertFolderListItemDates;
|
|
1046
|
+
/**
|
|
1047
|
+
* List all thumbnails for a video asset
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* ```typescript
|
|
1051
|
+
* const { thumbnails } = await cdn.listThumbnails('video-asset-id');
|
|
1052
|
+
* thumbnails.forEach(thumb => {
|
|
1053
|
+
* console.log(`${thumb.timestamp}s: ${thumb.url}`);
|
|
1054
|
+
* });
|
|
1055
|
+
* ```
|
|
1056
|
+
*/
|
|
1057
|
+
listThumbnails(assetId: string): Promise<ListThumbnailsResponse>;
|
|
1058
|
+
/**
|
|
1059
|
+
* Move private files to a different folder
|
|
1060
|
+
*
|
|
1061
|
+
* @example
|
|
1062
|
+
* ```typescript
|
|
1063
|
+
* const result = await cdn.movePrivateFiles({
|
|
1064
|
+
* fileIds: ['file-1', 'file-2'],
|
|
1065
|
+
* folder: '/confidential/archive',
|
|
1066
|
+
* });
|
|
1067
|
+
* console.log(`Moved ${result.movedCount} files`);
|
|
1068
|
+
* ```
|
|
1069
|
+
*/
|
|
1070
|
+
movePrivateFiles(request: MovePrivateFilesRequest): Promise<MovePrivateFilesResponse>;
|
|
828
1071
|
}
|
|
829
1072
|
|
|
830
|
-
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderTreeNode, type GetAssetRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type MoveAssetsRequest, type MoveAssetsResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoVariant, type WatermarkOptions };
|
|
1073
|
+
export { type Asset, type AssetStatus, type AssetType, type BundleDownloadUrlRequest, type BundleDownloadUrlResponse, type BundleStatus, CDN, type CdnEnvironment, type CdnStorageBreakdownItem, type CdnStorageBreakdownRequest, type CdnStorageBreakdownResponse, type CdnUsageDataPoint, type CdnUsageHistoryRequest, type CdnUsageHistoryResponse, type CdnUsageRequest, type CdnUsageResponse, type ConfirmUploadRequest, type ConfirmUploadResponse, type CreateBundleRequest, type CreateBundleResponse, type CreateFolderRequest, type DeleteAssetRequest, type DeleteAssetsRequest, type DeleteAssetsResponse, type DownloadBundle, type ExtractAudioRequest, type ExtractAudioResponse, type Folder, type FolderListItem, type FolderTreeNode, type GetAssetRequest, type GetFolderByPathRequest, type GetFolderRequest, type GetFolderTreeRequest, type ListAssetsRequest, type ListAssetsResponse, type ListBundlesRequest, type ListBundlesResponse, type ListFoldersRequest, type ListFoldersResponse, type ListJobsRequest, type ListJobsResponse, type ListPrivateFilesRequest, type ListPrivateFilesResponse, type ListThumbnailsRequest, type ListThumbnailsResponse, type MoveAssetsRequest, type MoveAssetsResponse, type MoveFolderRequest, type MoveFolderResponse, type MovePrivateFilesRequest, type MovePrivateFilesResponse, type PrivateDownloadUrlRequest, type PrivateDownloadUrlResponse, type PrivateFile, type PrivateFileStatus, type PrivateUploadUrlRequest, type PrivateUploadUrlResponse, type RegenerateThumbnailRequest, type RegenerateThumbnailResponse, type StreamingUrls, type ThumbnailRequest, type ThumbnailResponse, type TranscodeJob, type TranscodeVideoRequest, type TranscodingStatus, type TransformOptions, type TrimOptions, type UpdateAssetRequest, type UpdateFolderRequest, type UpdatePrivateFileRequest, type UploadUrlRequest, type UploadUrlResponse, type VideoCodec, type VideoOutputFormat, type VideoQuality, type VideoThumbnail, type VideoVariant, type WatermarkOptions };
|