diff --git a/packages/iid/lib/index.d.ts b/packages/iid/lib/index.d.ts index 727abcf0..d26d36aa 100644 --- a/packages/iid/lib/index.d.ts +++ b/packages/iid/lib/index.d.ts @@ -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; @@ -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; /** * 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 '*'. */ diff --git a/packages/iid/lib/index.js.flow b/packages/iid/lib/index.js.flow index 7ed55b93..39eb8f35 100644 --- a/packages/iid/lib/index.js.flow +++ b/packages/iid/lib/index.js.flow @@ -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; @@ -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; /** * 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 '*'. */