firebase-dynamic-links
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -1,4 +0,3 @@ | ||
import { DynamicLinkInfo } from './types/dynamic-link-info'; | ||
import { ShortLinkResponse } from './types/short-link-response'; | ||
import { ShortLinkRequestBody } from './types/short-link-request-body'; | ||
import { DynamicLinkInfo, ShortLinkRequestBody, ShortLinkResponse } from './types/short-links-api'; | ||
import { LinkStatsResponse } from './types/link-stats-api'; | ||
export declare class FirebaseDynamicLinks { | ||
@@ -19,2 +18,10 @@ private readonly webApiKey; | ||
/** | ||
* Use the this function to get event statistics for a single Dynamic Link. | ||
* @param shortDynamicLink The URL-encoded short Dynamic Link for which you want to get event data. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#http_request) | ||
* @param duration The number of days for which to get event data. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#http_request) | ||
* @param accessToken An unexpired access token. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#api_authorization) | ||
* @return read full documentation [here](https://firebase.gogle.com/docs/reference/dynamic-links/analytics#response_body) | ||
*/ | ||
getLinkStats(shortDynamicLink: string, duration: number, accessToken: string): Promise<LinkStatsResponse>; | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
@@ -21,0 +28,0 @@ */ |
@@ -67,2 +67,42 @@ "use strict"; | ||
/** | ||
* Use the this function to get event statistics for a single Dynamic Link. | ||
* @param shortDynamicLink The URL-encoded short Dynamic Link for which you want to get event data. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#http_request) | ||
* @param duration The number of days for which to get event data. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#http_request) | ||
* @param accessToken An unexpired access token. read full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/analytics#api_authorization) | ||
* @return read full documentation [here](https://firebase.gogle.com/docs/reference/dynamic-links/analytics#response_body) | ||
*/ | ||
getLinkStats(shortDynamicLink, duration, accessToken) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const options = { | ||
hostname: 'firebasedynamiclinks.googleapis.com', | ||
path: `/v1/${encodeURIComponent(shortDynamicLink)}/linkStats?durationDays=${duration}`, | ||
method: 'GET', | ||
headers: { | ||
Authorization: `Bearer ${accessToken}`, | ||
}, | ||
}; | ||
return new Promise((resolve, reject) => { | ||
const req = https_1.request(options, (res) => { | ||
const buffers = []; | ||
res | ||
.on('data', (chunk) => { | ||
buffers.push(chunk); | ||
}) | ||
.on('end', () => { | ||
const d = Buffer.concat(buffers).toString(); | ||
const resBody = JSON.parse(d); | ||
if (res.statusCode === 200) { | ||
resolve(resBody); | ||
} | ||
else { | ||
reject(resBody); | ||
} | ||
}); | ||
}); | ||
req.on('error', reject); | ||
req.end(); | ||
}); | ||
}); | ||
} | ||
/** | ||
* @deprecated Use {@link createLink} instead | ||
@@ -69,0 +109,0 @@ */ |
@@ -1,12 +0,3 @@ | ||
import { AndroidInfo } from './types/android-info'; | ||
import { IosInfo } from './types/ios-info'; | ||
import { AnalyticsInfo } from './types/analytics-info'; | ||
import { DynamicLinkInfo } from './types/dynamic-link-info'; | ||
import { GooglePlayAnalytics } from './types/google-play-analytics'; | ||
import { ItunesConnectAnalytics } from './types/itunes-connect-analytics'; | ||
import { NavigationInfo } from './types/navigation-info'; | ||
import { ShortLinkResponse } from './types/short-link-response'; | ||
import { SocialMetaTagInfo } from './types/social-meta-tag-info'; | ||
import { ShortLinkRequestBody } from './types/short-link-request-body'; | ||
export { AndroidInfo, IosInfo, AnalyticsInfo, DynamicLinkInfo, GooglePlayAnalytics, ItunesConnectAnalytics, NavigationInfo, ShortLinkResponse, ShortLinkRequestBody, SocialMetaTagInfo, } from './types/short-links-api'; | ||
export { LinkEventStat, LinkStatsResponse, StatEvent, StatPlatform } from './types/link-stats-api'; | ||
export { FirebaseDynamicLinks } from './firebase-dynamic-links'; | ||
export { AndroidInfo, IosInfo, AnalyticsInfo, DynamicLinkInfo, GooglePlayAnalytics, ItunesConnectAnalytics, NavigationInfo, ShortLinkResponse, ShortLinkRequestBody, SocialMetaTagInfo, }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FirebaseDynamicLinks = void 0; | ||
exports.FirebaseDynamicLinks = exports.StatPlatform = exports.StatEvent = void 0; | ||
var link_stats_api_1 = require("./types/link-stats-api"); | ||
Object.defineProperty(exports, "StatEvent", { enumerable: true, get: function () { return link_stats_api_1.StatEvent; } }); | ||
Object.defineProperty(exports, "StatPlatform", { enumerable: true, get: function () { return link_stats_api_1.StatPlatform; } }); | ||
var firebase_dynamic_links_1 = require("./firebase-dynamic-links"); | ||
Object.defineProperty(exports, "FirebaseDynamicLinks", { enumerable: true, get: function () { return firebase_dynamic_links_1.FirebaseDynamicLinks; } }); |
{ | ||
"name": "firebase-dynamic-links", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "unofficial package to create firebase dynamic links", | ||
@@ -19,3 +19,3 @@ "main": "lib/index.js", | ||
"prepare": "npm run build", | ||
"prepublishOnly": "npm test && npm run lint", | ||
"prepublishOnly": "npm run lint", | ||
"preversion": "npm run lint", | ||
@@ -27,2 +27,4 @@ "version": "npm run format && git add -A src", | ||
"dynamic-links", | ||
"short-links", | ||
"analytics", | ||
"firebase" | ||
@@ -34,7 +36,9 @@ ], | ||
"devDependencies": { | ||
"prettier": "^2.1.1", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.0.2", | ||
"prettier": "^2.2.1", | ||
"tslint": "^6.1.3", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^4.0.2" | ||
"typescript": "^4.2.4" | ||
} | ||
} |
@@ -7,7 +7,7 @@ # Firebase Dynamic Links | ||
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. | ||
This package provides a wrapper for [Firebase Dynamic Links](https://firebase.google.com/docs/dynamic-links/rest) and [View Dynamic Links Analytics Data](https://firebase.google.com/docs/dynamic-links/analytics) REST APIs. | ||
It aims to define types for this APIs. | ||
**you can read the full documentation [here](https://firebase.google.com/docs/reference/dynamic-links/link-shortener)**. | ||
**In order to use this package, you can read [Short Link API](https://firebase.google.com/docs/reference/dynamic-links/link-shortener) and [Analytics API](https://firebase.google.com/docs/reference/dynamic-links/analytics) full API documentations**. | ||
## Installation | ||
@@ -36,6 +36,6 @@ | ||
#### [Create a short link from a long link](https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_a_long_link) | ||
#### Create Dynamic Links | ||
##### [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 | ||
@@ -47,3 +47,3 @@ const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({ | ||
#### [Create a short link from parameters](https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters) | ||
##### [Create a short link from parameters](https://firebase.google.com/docs/dynamic-links/rest#create_a_short_link_from_parameters) | ||
@@ -65,3 +65,3 @@ ```typescript | ||
#### [Set the length of a short Dynamic Link](https://firebase.google.com/docs/dynamic-links/rest#set_the_length_of_a_short) | ||
##### [Set the length of a short Dynamic Link](https://firebase.google.com/docs/dynamic-links/rest#set_the_length_of_a_short) | ||
@@ -76,1 +76,8 @@ ```typescript | ||
``` | ||
#### View Dynamic Links Analytics Data | ||
##### [Get statistics for a single Dynamic Link](https://firebase.google.com/docs/reference/dynamic-links/analytics#get_statistics_for_a_single) | ||
```typescript | ||
const { linkEventStats } = await firebaseDynamicLinks.getLinkStats('https://example.page.link/wXYz', 7, accessToken); | ||
``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
16994
276
79
6
11
2