1616
1717import { FirebaseProjectManagementError } from '../utils/error' ;
1818import * as validator from '../utils/validator' ;
19- import { ProjectManagementRequestHandler , assertServerResponse } from './project-management-api-request' ;
19+ import { ProjectManagementRequestHandler , assertServerResponse } from './project-management-api-request-internal ' ;
2020import { AndroidAppMetadata , AppPlatform } from './app-metadata' ;
2121
2222export class AndroidApp {
@@ -33,6 +33,11 @@ export class AndroidApp {
3333 this . resourceName = `projects/-/androidApps/${ appId } ` ;
3434 }
3535
36+ /**
37+ * Retrieves metadata about this Android app.
38+ *
39+ * @return A promise that resolves to the retrieved metadata about this Android app.
40+ */
3641 public getMetadata ( ) : Promise < AndroidAppMetadata > {
3742 return this . requestHandler . getResource ( this . resourceName )
3843 . then ( ( responseData : any ) => {
@@ -61,10 +66,23 @@ export class AndroidApp {
6166 } ) ;
6267 }
6368
69+ /**
70+ * Sets the optional user-assigned display name of the app.
71+ *
72+ * @param newDisplayName The new display name to set.
73+ *
74+ * @return A promise that resolves when the display name has been set.
75+ */
6476 public setDisplayName ( newDisplayName : string ) : Promise < void > {
6577 return this . requestHandler . setDisplayName ( this . resourceName , newDisplayName ) ;
6678 }
6779
80+ /**
81+ * Gets the list of SHA certificates associated with this Android app in Firebase.
82+ *
83+ * @return The list of SHA-1 and SHA-256 certificates associated with this Android app in
84+ * Firebase.
85+ */
6886 public getShaCertificates ( ) : Promise < ShaCertificate [ ] > {
6987 return this . requestHandler . getAndroidShaCertificates ( this . resourceName )
7088 . then ( ( responseData : any ) => {
@@ -98,10 +116,26 @@ export class AndroidApp {
98116 } ) ;
99117 }
100118
119+ /**
120+ * Adds the given SHA certificate to this Android app.
121+ *
122+ * @param certificateToAdd The SHA certificate to add.
123+ *
124+ * @return A promise that resolves when the given certificate
125+ * has been added to the Android app.
126+ */
101127 public addShaCertificate ( certificateToAdd : ShaCertificate ) : Promise < void > {
102128 return this . requestHandler . addAndroidShaCertificate ( this . resourceName , certificateToAdd ) ;
103129 }
104130
131+ /**
132+ * Deletes the specified SHA certificate from this Android app.
133+ *
134+ * @param certificateToDelete The SHA certificate to delete.
135+ *
136+ * @return A promise that resolves when the specified
137+ * certificate has been removed from the Android app.
138+ */
105139 public deleteShaCertificate ( certificateToDelete : ShaCertificate ) : Promise < void > {
106140 if ( ! certificateToDelete . resourceName ) {
107141 throw new FirebaseProjectManagementError (
@@ -113,8 +147,12 @@ export class AndroidApp {
113147 }
114148
115149 /**
116- * @return {Promise<string> } A promise that resolves to a UTF-8 JSON string, typically intended to
117- * be written to a JSON file.
150+ * Gets the configuration artifact associated with this app.
151+ *
152+ * @return A promise that resolves to the Android app's
153+ * Firebase config file, in UTF-8 string format. This string is typically
154+ * intended to be written to a JSON file that gets shipped with your Android
155+ * app.
118156 */
119157 public getConfig ( ) : Promise < string > {
120158 return this . requestHandler . getConfig ( this . resourceName )
@@ -135,16 +173,38 @@ export class AndroidApp {
135173 }
136174}
137175
176+ /**
177+ * A SHA-1 or SHA-256 certificate.
178+ *
179+ * Do not call this constructor directly. Instead, use
180+ * [`projectManagement.shaCertificate()`](admin.projectManagement.ProjectManagement#shaCertificate).
181+ */
138182export class ShaCertificate {
183+ /**
184+ * The SHA certificate type.
185+ *
186+ * @example
187+ * ```javascript
188+ * var certType = shaCertificate.certType;
189+ * ```
190+ */
139191 public readonly certType : ( 'sha1' | 'sha256' ) ;
140192
141193 /**
142194 * Creates a ShaCertificate using the given hash. The ShaCertificate's type (eg. 'sha256') is
143195 * automatically determined from the hash itself.
144196 *
145197 * @param shaHash The sha256 or sha1 hash for this certificate.
198+ * @example
199+ * ```javascript
200+ * var shaHash = shaCertificate.shaHash;
201+ * ```
146202 * @param resourceName The Firebase resource name for this certificate. This does not need to be
147203 * set when creating a new certificate.
204+ * @example
205+ * ```javascript
206+ * var resourceName = shaCertificate.resourceName;
207+ * ```
148208 */
149209 constructor ( public readonly shaHash : string , public readonly resourceName ?: string ) {
150210 if ( / ^ [ a - f A - F 0 - 9 ] { 40 } $ / . test ( shaHash ) ) {
0 commit comments