@@ -24,9 +24,32 @@ export const SEO_TYPES: Record<string, string> = {
2424 "video/upload" : "videos"
2525} ;
2626
27+ /**
28+ * Supported delivery type options.
29+ */
30+ type DELIVERY_TYPE =
31+ 'key' |
32+ 'upload' |
33+ 'private_delivery' |
34+ 'public_delivery' |
35+ 'authenticated' |
36+ 'fetch' |
37+ 'sprite' |
38+ 'text' |
39+ 'multi' |
40+ 'facebook' |
41+ 'twitter' |
42+ 'twitter_name' |
43+ 'gravatar' |
44+ 'youtube' |
45+ 'hulu' |
46+ 'vimeo' |
47+ 'animoto' |
48+ 'worldstarhiphop' |
49+ 'dailymotion' ;
2750
2851/**
29- * @desc Cloudinary file without a transformation
52+ * @description Cloudinary file without a transformation
3053 * @summary SDK
3154 * @memberOf SDK
3255 */
@@ -54,35 +77,65 @@ class CloudinaryFile {
5477 this . urlConfig = new URLConfig ( urlConfig ) ;
5578 }
5679
80+ /**
81+ * @description Sets the public ID of the asset.
82+ * @param {string } publicID The public ID of the asset.
83+ * @return {this }
84+ */
5785 setPublicID ( publicID : string ) : this {
5886 // PublicID must be a string!
5987 this . publicID = publicID ? publicID . toString ( ) : '' ;
6088 return this ;
6189 }
6290
63- setStorageType ( newType : string ) : this {
91+ /**
92+ * @description Sets the delivery type of the asset.
93+ * @param {DELIVERY_TYPE | string } newType The type of the asset.
94+ * @return {this }
95+ */
96+ setDeliveryType ( newType : DELIVERY_TYPE | string ) : this {
6497 this . storageType = newType ;
6598 return this ;
6699 }
67100
101+ /**
102+ * @description Sets the URL SEO suffix of the asset.
103+ * @param {string } newSuffix The SEO suffix.
104+ * @return {this }
105+ */
68106 setSuffix ( newSuffix : string ) : this {
69107 this . suffix = newSuffix ;
70108 return this ;
71109 }
72110
111+ /**
112+ * @description Sets the signature of the asset.
113+ * @param {string } signature The signature.
114+ * @return {this }
115+ */
73116 setSignature ( signature : string ) : this {
74117 this . signature = signature ;
75118 return this ;
76119 }
77120
121+ /**
122+ * @description Sets the version of the asset.
123+ * @param {string } newVersion The version of the asset.
124+ * @return {this }
125+ */
78126 setVersion ( newVersion : number | string ) : this {
79127 if ( newVersion ) {
80128 this . version = newVersion ;
81129 }
82130 return this ;
83131 }
84132
85- setAssetType ( newType : string ) : this {
133+ /**
134+ * @description Sets the asset type.
135+ * @param {string } newType The type of the asset.
136+ * @return {this }
137+ */
138+ setAssetType ( newType : 'key' | 'image' | 'video' | 'raw' | 'auto' | 'all' | string ) : this {
86139 if ( newType ) {
87140 this . assetType = newType ;
88141 }
@@ -93,6 +146,10 @@ class CloudinaryFile {
93146 return this ;
94147 }
95148
149+ /**
150+ * @description Serializes to URL string
151+ * @param overwriteOptions
152+ */
96153 toURL ( overwriteOptions : { trackedAnalytics ?: Partial < ITrackedPropertiesThroughAnalytics > } = { } ) : string {
97154 return this . createCloudinaryURL ( null , overwriteOptions . trackedAnalytics ) ;
98155 }
0 commit comments