@@ -23,7 +23,7 @@ class CloudinaryFile {
23
23
protected authToken : IAuthTokenConfig ; // populated from the cloud config
24
24
protected urlConfig : IURLConfig ;
25
25
26
- public version : number ;
26
+ public version : number | string ;
27
27
public publicID : string ;
28
28
public extension : string ;
29
29
public suffix : string ;
@@ -43,6 +43,30 @@ class CloudinaryFile {
43
43
return this ;
44
44
}
45
45
46
+ setStorageType ( newType : string ) : this {
47
+ this . storageType = newType ;
48
+ return this ;
49
+ }
50
+
51
+ setSuffix ( newSuffix : string ) : this {
52
+ this . suffix = newSuffix ;
53
+ return this ;
54
+ }
55
+
56
+ setVersion ( newVersion : number | string ) : this {
57
+ if ( newVersion ) {
58
+ this . version = newVersion ;
59
+ }
60
+ return this ;
61
+ }
62
+
63
+ setAssetType ( newType : string ) : this {
64
+ if ( newType ) {
65
+ this . assetType = newType ;
66
+ }
67
+ return this ;
68
+ }
69
+
46
70
sign ( ) : this {
47
71
return this ;
48
72
}
@@ -57,7 +81,7 @@ class CloudinaryFile {
57
81
* @description Creates a fully qualified CloudinaryURL
58
82
* @return {string } CloudinaryURL
59
83
*/
60
- createCloudinaryURL ( transformation ?: Transformation ) : string {
84
+ createCloudinaryURL ( transformation ?: Transformation | string ) : string {
61
85
if ( typeof this . cloudName === 'undefined' ) {
62
86
throw 'You must supply a cloudName in either toURL() or when initializing the asset' ;
63
87
}
@@ -78,9 +102,13 @@ class CloudinaryFile {
78
102
. filter ( ( a ) => a )
79
103
. join ( '/' ) ;
80
104
81
- return encodeURI ( url )
82
- . replace ( / \? / g, '%3F' )
83
- . replace ( / = / g, '%3D' ) ;
105
+ if ( typeof transformation === 'string' ) {
106
+ return url ;
107
+ } else {
108
+ return encodeURI ( url )
109
+ . replace ( / \? / g, '%3F' )
110
+ . replace ( / = / g, '%3D' ) ;
111
+ }
84
112
}
85
113
}
86
114
0 commit comments