6
6
* you may not use this file except in compliance with the License.
7
7
* You may obtain a copy of the License at
8
8
*
9
- * http://www.apache.org/licenses/LICENSE-2.0
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
10
*
11
11
* Unless required by applicable law or agreed to in writing, software
12
12
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -42,7 +42,7 @@ import { ListOptions } from '../src/list';
42
42
import { UploadTaskCompat } from './task' ;
43
43
import { ListResultCompat } from './list' ;
44
44
import { StorageServiceCompat } from './service' ;
45
- import * as errorsExports from '../src/implementation/error' ;
45
+ import { invalidRootOperation } from '../src/implementation/error' ;
46
46
47
47
export class ReferenceCompat implements types . Reference {
48
48
constructor ( private readonly delegate : Reference ) { }
@@ -62,8 +62,8 @@ export class ReferenceCompat implements types.Reference {
62
62
63
63
/**
64
64
* @return A reference to the object obtained by
65
- * appending childPath, removing any duplicate, beginning, or trailing
66
- * slashes.
65
+ * appending childPath, removing any duplicate, beginning, or trailing
66
+ * slashes.
67
67
*/
68
68
child ( childPath : string ) : types . Reference {
69
69
validate ( 'child' , [ stringSpec ( ) ] , arguments ) ;
@@ -77,10 +77,9 @@ export class ReferenceCompat implements types.Reference {
77
77
78
78
/**
79
79
* @return A reference to the parent of the
80
- * current object, or null if the current object is the root.
80
+ * current object, or null if the current object is the root.
81
81
*/
82
82
get parent ( ) : types . Reference | null {
83
- validate ( 'parent' , [ ] , arguments ) ;
84
83
const reference = getParent ( this . delegate ) ;
85
84
if ( reference == null ) {
86
85
return null ;
@@ -92,25 +91,26 @@ export class ReferenceCompat implements types.Reference {
92
91
* Uploads a blob to this object's location.
93
92
* @param data The blob to upload.
94
93
* @return An UploadTask that lets you control and
95
- * observe the upload.
94
+ * observe the upload.
96
95
*/
97
96
put (
98
97
data : Blob | Uint8Array | ArrayBuffer ,
99
98
metadata ?: Metadata
100
99
) : types . UploadTask {
101
100
validate ( 'put' , [ uploadDataSpec ( ) , metadataSpec ( true ) ] , arguments ) ;
102
- this . throwIfRoot_ ( 'put' ) ;
101
+ this . _throwIfRoot ( 'put' ) ;
103
102
return new UploadTaskCompat (
104
103
uploadBytes ( this . delegate , data , metadata ) ,
105
104
this
106
105
) ;
107
106
}
107
+
108
108
/**
109
109
* Uploads a string to this object's location.
110
110
* @param value The string to upload.
111
111
* @param format The format of the string to upload.
112
112
* @return An UploadTask that lets you control and
113
- * observe the upload.
113
+ * observe the upload.
114
114
*/
115
115
putString (
116
116
value : string ,
@@ -122,7 +122,7 @@ export class ReferenceCompat implements types.Reference {
122
122
[ stringSpec ( ) , stringSpec ( formatValidator , true ) , metadataSpec ( true ) ] ,
123
123
arguments
124
124
) ;
125
- this . throwIfRoot_ ( 'putString' ) ;
125
+ this . _throwIfRoot ( 'putString' ) ;
126
126
return new UploadTaskCompat (
127
127
uploadString ( this . delegate , value , format , metadata ) ,
128
128
this
@@ -142,9 +142,9 @@ export class ReferenceCompat implements types.Reference {
142
142
* too many results.
143
143
*
144
144
* @return A Promise that resolves with all the items and prefixes under
145
- * the current storage reference. `prefixes` contains references to
146
- * sub-directories and `items` contains references to objects in this
147
- * folder. `nextPageToken` is never returned.
145
+ * the current storage reference. `prefixes` contains references to
146
+ * sub-directories and `items` contains references to objects in this
147
+ * folder. `nextPageToken` is never returned.
148
148
*/
149
149
listAll ( ) : Promise < types . ListResult > {
150
150
validate ( 'listAll' , [ ] , arguments ) ;
@@ -169,9 +169,9 @@ export class ReferenceCompat implements types.Reference {
169
169
*
170
170
* @param options See ListOptions for details.
171
171
* @return A Promise that resolves with the items and prefixes.
172
- * `prefixes` contains references to sub-folders and `items`
173
- * contains references to objects in this folder. `nextPageToken`
174
- * can be used to get the rest of the results.
172
+ * `prefixes` contains references to sub-folders and `items`
173
+ * contains references to objects in this folder. `nextPageToken`
174
+ * can be used to get the rest of the results.
175
175
*/
176
176
list ( options ?: ListOptions | null ) : Promise < types . ListResult > {
177
177
validate ( 'list' , [ listOptionSpec ( true ) ] , arguments ) ;
@@ -181,9 +181,9 @@ export class ReferenceCompat implements types.Reference {
181
181
}
182
182
183
183
/**
184
- * A promise that resolves with the metadata for this object. If this
185
- * object doesn't exist or metadata cannot be retreived, the promise is
186
- * rejected.
184
+ * A promise that resolves with the metadata for this object. If this
185
+ * object doesn't exist or metadata cannot be retreived, the promise is
186
+ * rejected.
187
187
*/
188
188
getMetadata ( ) : Promise < Metadata > {
189
189
validate ( 'getMetadata' , [ ] , arguments ) ;
@@ -193,11 +193,11 @@ export class ReferenceCompat implements types.Reference {
193
193
/**
194
194
* Updates the metadata for this object.
195
195
* @param metadata The new metadata for the object.
196
- * Only values that have been explicitly set will be changed. Explicitly
197
- * setting a value to null will remove the metadata.
196
+ * Only values that have been explicitly set will be changed. Explicitly
197
+ * setting a value to null will remove the metadata.
198
198
* @return A promise that resolves
199
- * with the new metadata for this object.
200
- * @see firebaseStorage.Reference.prototype.getMetadata
199
+ * with the new metadata for this object.
200
+ * @see firebaseStorage.Reference.prototype.getMetadata
201
201
*/
202
202
updateMetadata ( metadata : Metadata ) : Promise < Metadata > {
203
203
validate ( 'updateMetadata' , [ metadataSpec ( ) ] , arguments ) ;
@@ -206,7 +206,7 @@ export class ReferenceCompat implements types.Reference {
206
206
207
207
/**
208
208
* @return A promise that resolves with the download
209
- * URL for this object.
209
+ * URL for this object.
210
210
*/
211
211
getDownloadURL ( ) : Promise < string > {
212
212
validate ( 'getDownloadURL' , [ ] , arguments ) ;
@@ -219,13 +219,13 @@ export class ReferenceCompat implements types.Reference {
219
219
*/
220
220
delete ( ) : Promise < void > {
221
221
validate ( 'delete' , [ ] , arguments ) ;
222
- this . throwIfRoot_ ( 'delete' ) ;
222
+ this . _throwIfRoot ( 'delete' ) ;
223
223
return deleteObject ( this . delegate ) ;
224
224
}
225
225
226
- private throwIfRoot_ ( name : string ) : void {
226
+ private _throwIfRoot ( name : string ) : void {
227
227
if ( this . delegate . location . path === '' ) {
228
- throw errorsExports . invalidRootOperation ( name ) ;
228
+ throw invalidRootOperation ( name ) ;
229
229
}
230
230
}
231
231
}
0 commit comments