[skip ci] add iid TS examples

This commit is contained in:
ehesp
2019-04-29 16:06:56 +01:00
parent 60b46ce368
commit b0dfc861f3
2 changed files with 48 additions and 0 deletions

View File

@@ -39,6 +39,12 @@ export namespace Iid {
*
* Once an Instance ID is generated, Firebase periodically sends information about the application
* and the device it's running on to the Firebase backend. To stop this, see `delete()`.
*
* #### Example
*
* ```js
* const id = iid().get();
* ```
*/
get(): Promise<string>;
@@ -47,12 +53,24 @@ export namespace Iid {
* backend that was started when the Instance ID was generated.
*
* A new Instance ID is asynchronously generated unless auto initialisation is turned off.
*
* #### Example
*
* ```js
* await iid().delete();
* ```
*/
delete(): Promise<void>;
/**
* Returns a token that authorizes an Entity to perform an action on behalf of the application.
*
* #### Example
*
* ```js
* const token = await iid().getToken(firebase.app().options.storageBucket, '*');
* ```
*
* @param authorizedEntity Entity authorized by the token. Defaults to the apps `messagingSenderId` option.
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
*/
@@ -61,6 +79,12 @@ export namespace Iid {
/**
* Revokes access to a scope for an entity previously authorized by `getToken()`.
*
* #### Example
*
* ```js
* await iid().deleteToken(firebase.app().options.storageBucket, '*');
* ```
*
* @param authorizedEntity Entity authorized by the token. Defaults to the apps' `messagingSenderId` option.
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
*/

View File

@@ -26,6 +26,12 @@ export interface Module extends ReactNativeFirebaseModule {
*
* Once an Instance ID is generated, Firebase periodically sends information about the application
* and the device it's running on to the Firebase backend. To stop this, see `delete()`.
*
* #### Example
*
* ```js
* const id = iid().get();
* ```
*/
get(): Promise<string>;
@@ -34,12 +40,24 @@ export interface Module extends ReactNativeFirebaseModule {
* backend that was started when the Instance ID was generated.
*
* A new Instance ID is asynchronously generated unless auto initialisation is turned off.
*
* #### Example
*
* ```js
* await iid().delete();
* ```
*/
delete(): Promise<void>;
/**
* Returns a token that authorizes an Entity to perform an action on behalf of the application.
*
* #### Example
*
* ```js
* const token = await iid().getToken(firebase.app().options.storageBucket, '*');
* ```
*
* @param authorizedEntity Entity authorized by the token. Defaults to the apps `messagingSenderId` option.
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
*/
@@ -48,6 +66,12 @@ export interface Module extends ReactNativeFirebaseModule {
/**
* Revokes access to a scope for an entity previously authorized by `getToken()`.
*
* #### Example
*
* ```js
* await iid().deleteToken(firebase.app().options.storageBucket, '*');
* ```
*
* @param authorizedEntity Entity authorized by the token. Defaults to the apps' `messagingSenderId` option.
* @param scope Action authorized for authorizedEntity. Defaults to '*'.
*/