npm.io
1.2.0 • Published 3 years ago

firebase-dynamic-links

Licence
MIT
Version
1.2.0
Deps
0
Size
17 kB
Vulns
0
Weekly
0
Stars
15

npm

Overview

This package provides a wrapper for Firebase Dynamic Links and View Dynamic Links Analytics Data REST APIs. It aims to define types for this APIs.

In order to use this package, you can read Short Link API and Analytics API full API documentations.

Installation

The Firebase Dynamic Links is available on npm as firebase-dynamic-links:

$ npm install --save firebase-dynamic-links

Usage

Setup

Take note of your project Web Api Key from setting page of the Firebase console. Import the package and then create an instance of the FirebaseDynamicLinks as follow:

import { FirebaseDynamicLinks } from 'firebase-dynamic-links';

const firebaseDynamicLinks = new FirebaseDynamicLinks(/* Web Api Key */);
Examples
const { shortLink, previewLink } = await firebaseDynamicLinks.createLink({
  longDynamicLink: 'https://example.page.link/?link=https://www.example.com/&apn=com.example.android&ibi=com.example.ios',
});
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',
    },
  },
});
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',
  },
});
const { linkEventStats } = await firebaseDynamicLinks.getLinkStats('https://example.page.link/wXYz', 7, accessToken);

Keywords