@@ -57,13 +57,13 @@ export class Reference {
57
57
/**
58
58
* @internal
59
59
*/
60
- location : Location ;
60
+ _location : Location ;
61
61
62
62
constructor ( private _service : StorageService , location : string | Location ) {
63
63
if ( location instanceof Location ) {
64
- this . location = location ;
64
+ this . _location = location ;
65
65
} else {
66
- this . location = Location . makeFromUrl ( location ) ;
66
+ this . _location = Location . makeFromUrl ( location ) ;
67
67
}
68
68
}
69
69
@@ -73,7 +73,7 @@ export class Reference {
73
73
* @override
74
74
*/
75
75
toString ( ) : string {
76
- return 'gs://' + this . location . bucket + '/' + this . location . path ;
76
+ return 'gs://' + this . _location . bucket + '/' + this . _location . path ;
77
77
}
78
78
79
79
protected newRef ( service : StorageService , location : Location ) : Reference {
@@ -85,37 +85,37 @@ export class Reference {
85
85
* object's bucket.
86
86
*/
87
87
get root ( ) : Reference {
88
- const location = new Location ( this . location . bucket , '' ) ;
88
+ const location = new Location ( this . _location . bucket , '' ) ;
89
89
return this . newRef ( this . _service , location ) ;
90
90
}
91
91
92
92
get bucket ( ) : string {
93
- return this . location . bucket ;
93
+ return this . _location . bucket ;
94
94
}
95
95
96
96
get fullPath ( ) : string {
97
- return this . location . path ;
97
+ return this . _location . path ;
98
98
}
99
99
100
100
get name ( ) : string {
101
- return lastComponent ( this . location . path ) ;
101
+ return lastComponent ( this . _location . path ) ;
102
102
}
103
103
104
104
get storage ( ) : StorageService {
105
105
return this . _service ;
106
106
}
107
107
108
108
get parent ( ) : Reference | null {
109
- const newPath = parent ( this . location . path ) ;
109
+ const newPath = parent ( this . _location . path ) ;
110
110
if ( newPath === null ) {
111
111
return null ;
112
112
}
113
- const location = new Location ( this . location . bucket , newPath ) ;
113
+ const location = new Location ( this . _location . bucket , newPath ) ;
114
114
return new Reference ( this . _service , location ) ;
115
115
}
116
116
117
117
_throwIfRoot ( name : string ) : void {
118
- if ( this . location . path === '' ) {
118
+ if ( this . _location . path === '' ) {
119
119
throw invalidRootOperation ( name ) ;
120
120
}
121
121
}
@@ -262,7 +262,7 @@ export async function list(
262
262
const op = options || { } ;
263
263
const requestInfo = requestsList (
264
264
ref . storage ,
265
- ref . location ,
265
+ ref . _location ,
266
266
/*delimiter= */ '/' ,
267
267
op . pageToken ,
268
268
op . maxResults
@@ -282,7 +282,7 @@ export async function getMetadata(ref: Reference): Promise<Metadata> {
282
282
const authToken = await ref . storage . getAuthToken ( ) ;
283
283
const requestInfo = requestsGetMetadata (
284
284
ref . storage ,
285
- ref . location ,
285
+ ref . _location ,
286
286
getMappings ( )
287
287
) ;
288
288
return ref . storage . makeRequest ( requestInfo , authToken ) . getPromise ( ) ;
@@ -307,7 +307,7 @@ export async function updateMetadata(
307
307
const authToken = await ref . storage . getAuthToken ( ) ;
308
308
const requestInfo = requestsUpdateMetadata (
309
309
ref . storage ,
310
- ref . location ,
310
+ ref . _location ,
311
311
metadata ,
312
312
getMappings ( )
313
313
) ;
@@ -325,7 +325,7 @@ export async function getDownloadURL(ref: Reference): Promise<string> {
325
325
const authToken = await ref . storage . getAuthToken ( ) ;
326
326
const requestInfo = requestsGetDownloadUrl (
327
327
ref . storage ,
328
- ref . location ,
328
+ ref . _location ,
329
329
getMappings ( )
330
330
) ;
331
331
return ref . storage
@@ -348,7 +348,7 @@ export async function getDownloadURL(ref: Reference): Promise<string> {
348
348
export async function deleteObject ( ref : Reference ) : Promise < void > {
349
349
ref . _throwIfRoot ( 'deleteObject' ) ;
350
350
const authToken = await ref . storage . getAuthToken ( ) ;
351
- const requestInfo = requestsDeleteObject ( ref . storage , ref . location ) ;
351
+ const requestInfo = requestsDeleteObject ( ref . storage , ref . _location ) ;
352
352
return ref . storage . makeRequest ( requestInfo , authToken ) . getPromise ( ) ;
353
353
}
354
354
@@ -363,7 +363,7 @@ export async function deleteObject(ref: Reference): Promise<void> {
363
363
* slashes.
364
364
*/
365
365
export function getChild ( ref : Reference , childPath : string ) : Reference {
366
- const newPath = child ( ref . location . path , childPath ) ;
367
- const location = new Location ( ref . location . bucket , newPath ) ;
366
+ const newPath = child ( ref . _location . path , childPath ) ;
367
+ const location = new Location ( ref . _location . bucket , newPath ) ;
368
368
return new Reference ( ref . storage , location ) ;
369
369
}
0 commit comments