firebase-dynamic-links
Advanced tools
Comparing version 0.1.3 to 1.0.0
import { DynamicLinkInfo } from './types/dynamic-link-info'; | ||
import { ShortLinkResponse } from './types/short-link-response'; | ||
import { ShortLinkRequestBody } from './types/short-link-request-body'; | ||
export declare class FirebaseDynamicLinks { | ||
@@ -8,8 +9,19 @@ private readonly webApiKey; | ||
* @param(webApiKey) API key to authenticate your requests to the API. | ||
* Obtain the project **Web Api Key** from [general settings]{@link https://console.firebase.google.com/project/_/settings/general/?authuser=0} in firebase console | ||
* Take note of your project `Web Api Key` from [setting page](https://console.firebase.google.com/project/_/settings/general/) of the Firebase console. | ||
*/ | ||
constructor(webApiKey: string); | ||
private sendRequest; | ||
/** | ||
* You can use this function to generate short Dynamic Links. | ||
* @param body read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener#request_body) | ||
* @return read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener#response_body) | ||
*/ | ||
createLink(body: ShortLinkRequestBody): Promise<ShortLinkResponse>; | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
*/ | ||
createShortLink(dynamicLinkInfo: DynamicLinkInfo, suffix?: 'SHORT' | 'UNGUESSABLE'): Promise<ShortLinkResponse>; | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
*/ | ||
createShortLinkFromLongLink(longDynamicLink: string, suffix?: 'SHORT' | 'UNGUESSABLE'): Promise<ShortLinkResponse>; | ||
} |
@@ -18,3 +18,3 @@ "use strict"; | ||
* @param(webApiKey) API key to authenticate your requests to the API. | ||
* Obtain the project **Web Api Key** from [general settings]{@link https://console.firebase.google.com/project/_/settings/general/?authuser=0} in firebase console | ||
* Take note of your project `Web Api Key` from [setting page](https://console.firebase.google.com/project/_/settings/general/) of the Firebase console. | ||
*/ | ||
@@ -27,3 +27,8 @@ constructor(webApiKey) { | ||
} | ||
sendRequest(body) { | ||
/** | ||
* You can use this function to generate short Dynamic Links. | ||
* @param body read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener#request_body) | ||
* @return read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener#response_body) | ||
*/ | ||
createLink(body) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -57,2 +62,5 @@ const data = JSON.stringify(body); | ||
} | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
*/ | ||
createShortLink(dynamicLinkInfo, suffix) { | ||
@@ -64,5 +72,8 @@ return __awaiter(this, void 0, void 0, function* () { | ||
}; | ||
return this.sendRequest(requestBody); | ||
return this.createLink(requestBody); | ||
}); | ||
} | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
*/ | ||
createShortLinkFromLongLink(longDynamicLink, suffix) { | ||
@@ -74,3 +85,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
}; | ||
return this.sendRequest(requestBody); | ||
return this.createLink(requestBody); | ||
}); | ||
@@ -77,0 +88,0 @@ } |
@@ -10,3 +10,4 @@ import { AndroidInfo } from './types/android-info'; | ||
import { SocialMetaTagInfo } from './types/social-meta-tag-info'; | ||
import { ShortLinkRequestBody } from './types/short-link-request-body'; | ||
export { FirebaseDynamicLinks } from './firebase-dynamic-links'; | ||
export { AndroidInfo, IosInfo, AnalyticsInfo, DynamicLinkInfo, GooglePlayAnalytics, ItunesConnectAnalytics, NavigationInfo, ShortLinkResponse, SocialMetaTagInfo, }; | ||
export { AndroidInfo, IosInfo, AnalyticsInfo, DynamicLinkInfo, GooglePlayAnalytics, ItunesConnectAnalytics, NavigationInfo, ShortLinkResponse, ShortLinkRequestBody, SocialMetaTagInfo, }; |
{ | ||
"name": "firebase-dynamic-links", | ||
"version": "0.1.3", | ||
"version": "1.0.0", | ||
"description": "unofficial package to create firebase dynamic links", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
# Firebase Dynamic Links | ||
#### read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener?authuser=0) | ||
[![npm](https://badge.fury.io/js/firebase-dynamic-links.svg)](https://badge.fury.io/js/firebase-dynamic-links) | ||
## Overview | ||
This package provides a wrapper for [Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links/rest) REST API. | ||
It aims to define types for this API. | ||
**you can read the full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener)**. | ||
## Installation | ||
The Firebase Dynamic Links is available on npm as `firebase-dynamic-links`: | ||
```bash | ||
$ npm install --save firebase-dynamic-links | ||
``` | ||
## Usage | ||
### Setup | ||
Take note of your project `Web Api Key` from [setting page](https://console.firebase.google.com/project/_/settings/general/) of the Firebase console. | ||
Import the package and then create an instance of the `FirebaseDynamicLinks` as follow: | ||
```typescript | ||
import { FirebaseDynamicLinks } from 'firebase-dynamic-links'; | ||
const firebaseDynamicLinks = new FirebaseDynamicLinks(/* Web Api Key */); | ||
``` | ||
### Examples | ||
#### [Create a short link from a long link](https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_a_long_link) | ||
```typescript | ||
const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({ | ||
longDynamicLink: 'https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios', | ||
}); | ||
``` | ||
#### [Create a short link from parameters](https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters) | ||
```typescript | ||
const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({ | ||
dynamicLinkInfo: { | ||
domainUriPrefix: 'https://example.page.link', | ||
link: 'https://www.example.com/', | ||
androidInfo: { | ||
androidPackageName: 'com.example.android', | ||
}, | ||
iosInfo: { | ||
iosBundleId: 'com.example.ios', | ||
}, | ||
}, | ||
}); | ||
``` | ||
#### [Set the length of a short Dynamic Link](https://firebase.google.com/docs/dynamic-links/rest#set_the_length_of_a_short) | ||
```typescript | ||
const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({ | ||
longDynamicLink: 'https://example.page.link/?link=http://www.example.com/&apn=com.example.android&ibi=com.example.ios', | ||
suffix: { | ||
option: 'UNGUESSABLE', | ||
}, | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13564
31
228
1
72