No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

service.d.ts 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. * @license
  3. * Copyright 2017 Google LLC
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import { Location } from './implementation/location';
  18. import { Request } from './implementation/request';
  19. import { RequestInfo } from './implementation/requestinfo';
  20. import { Reference } from './reference';
  21. import { Provider } from '@firebase/component';
  22. import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
  23. import { AppCheckInternalComponentName } from '@firebase/app-check-interop-types';
  24. import { FirebaseApp } from '@firebase/app';
  25. import { FirebaseStorage } from './public-types';
  26. import { EmulatorMockTokenOptions } from '@firebase/util';
  27. import { Connection, ConnectionType } from './implementation/connection';
  28. export declare function isUrl(path?: string): boolean;
  29. /**
  30. * Returns a storage Reference for the given url.
  31. * @param storage - `Storage` instance.
  32. * @param url - URL. If empty, returns root reference.
  33. * @public
  34. */
  35. export declare function ref(storage: FirebaseStorageImpl, url?: string): Reference;
  36. /**
  37. * Returns a storage Reference for the given path in the
  38. * default bucket.
  39. * @param storageOrRef - `Storage` service or storage `Reference`.
  40. * @param pathOrUrlStorage - path. If empty, returns root reference (if Storage
  41. * instance provided) or returns same reference (if Reference provided).
  42. * @public
  43. */
  44. export declare function ref(storageOrRef: FirebaseStorageImpl | Reference, path?: string): Reference;
  45. export declare function connectStorageEmulator(storage: FirebaseStorageImpl, host: string, port: number, options?: {
  46. mockUserToken?: EmulatorMockTokenOptions | string;
  47. }): void;
  48. /**
  49. * A service that provides Firebase Storage Reference instances.
  50. * @param opt_url - gs:// url to a custom Storage Bucket
  51. *
  52. * @internal
  53. */
  54. export declare class FirebaseStorageImpl implements FirebaseStorage {
  55. /**
  56. * FirebaseApp associated with this StorageService instance.
  57. */
  58. readonly app: FirebaseApp;
  59. readonly _authProvider: Provider<FirebaseAuthInternalName>;
  60. /**
  61. * @internal
  62. */
  63. readonly _appCheckProvider: Provider<AppCheckInternalComponentName>;
  64. /**
  65. * @internal
  66. */
  67. readonly _url?: string | undefined;
  68. readonly _firebaseVersion?: string | undefined;
  69. _bucket: Location | null;
  70. /**
  71. * This string can be in the formats:
  72. * - host
  73. * - host:port
  74. */
  75. private _host;
  76. _protocol: string;
  77. protected readonly _appId: string | null;
  78. private readonly _requests;
  79. private _deleted;
  80. private _maxOperationRetryTime;
  81. private _maxUploadRetryTime;
  82. _overrideAuthToken?: string;
  83. constructor(
  84. /**
  85. * FirebaseApp associated with this StorageService instance.
  86. */
  87. app: FirebaseApp, _authProvider: Provider<FirebaseAuthInternalName>,
  88. /**
  89. * @internal
  90. */
  91. _appCheckProvider: Provider<AppCheckInternalComponentName>,
  92. /**
  93. * @internal
  94. */
  95. _url?: string | undefined, _firebaseVersion?: string | undefined);
  96. /**
  97. * The host string for this service, in the form of `host` or
  98. * `host:port`.
  99. */
  100. get host(): string;
  101. set host(host: string);
  102. /**
  103. * The maximum time to retry uploads in milliseconds.
  104. */
  105. get maxUploadRetryTime(): number;
  106. set maxUploadRetryTime(time: number);
  107. /**
  108. * The maximum time to retry operations other than uploads or downloads in
  109. * milliseconds.
  110. */
  111. get maxOperationRetryTime(): number;
  112. set maxOperationRetryTime(time: number);
  113. _getAuthToken(): Promise<string | null>;
  114. _getAppCheckToken(): Promise<string | null>;
  115. /**
  116. * Stop running requests and prevent more from being created.
  117. */
  118. _delete(): Promise<void>;
  119. /**
  120. * Returns a new firebaseStorage.Reference object referencing this StorageService
  121. * at the given Location.
  122. */
  123. _makeStorageReference(loc: Location): Reference;
  124. /**
  125. * @param requestInfo - HTTP RequestInfo object
  126. * @param authToken - Firebase auth token
  127. */
  128. _makeRequest<I extends ConnectionType, O>(requestInfo: RequestInfo<I, O>, requestFactory: () => Connection<I>, authToken: string | null, appCheckToken: string | null, retry?: boolean): Request<O>;
  129. makeRequestWithTokens<I extends ConnectionType, O>(requestInfo: RequestInfo<I, O>, requestFactory: () => Connection<I>): Promise<O>;
  130. }