@mishguru/geniuslink
> GeniusLink API wrapper for Node.js
Last updated 4 months ago by stayradiated .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mishguru/geniuslink 
SYNC missed versions from official npm registry.

geniuslink

GeniusLink API wrapper for Node.js

Installation

npm install @mishguru/geniuslink

Usage

import { initGeniusLink, getTotalLinkClicks } from '@mishguru/geniuslink'

initGeniusLink({
  key: process.env.GENIUSLINK_API_KEY,
  secret: process.env.GENIUSLINK_API_SECRET,
})

getTotalLinkClicks('vCHktm')
  .then(console.log)

Documentation

All of the following functions can be imported from @mishguru/geniuslink.

initGeniusLink

This must be called to declare the API key/secret and initiate the library.

import { initGeniusLink } from '@mishguru/geniuslink'

initGeniusLink({
  key: process.env.GENIUSLINK_API_KEY,
  secret: process.env.GENIUSLINK_API_SECRET,
})

addGroup

Create a new group

import { addGroup } from '@mishguru/geniuslink'

const groupName = 'best-links-ever'

addGroup(groupName)
  .then((groupId) => {
    // groupId === 33118
    ...
  })

addLinkToGroup

Create a new tracked link with a specific group

import { addLinkToGroup } from '@mishguru/geniuslink'

const url = 'https://mish.guru'
const groupId = 12345

addLinkToGroup(url, groupId)
  .then((result) => {
    // result: { id: 'vCHktm', code: 'h4o0n' }
  })

getTotalLinkClicks

Get the total number of clicks on a specific link

import { getTotalLinkClicks } from '@mishguru/geniuslink'

const id = 'vCHktm'

getTotalLinkClicks(id)
  .then((count) => {
    // count === 472
    ...
  })

getGroupDetailsByName

Get details of a group based on the group name

import { getGroupDetailsByName } from '@mishguru/geniuslink'

const name = 'default'

getGroupDetailsByName(name)
  .then((group) => {
    // group.id === '1234'
    ...
  })

getGroupDetailsById

Get details of a group based on the group id

import { getGroupDetailsByName } from '@mishguru/geniuslink'

const id = '1234'

getGroupDetailsBId(id)
  .then((group) => {
    // group.name === 'default'
    ...
  })

Current Tags

  • 4.0.0                                ...           latest (4 months ago)

12 Versions

  • 4.0.0                                ...           4 months ago
  • 3.2.0                                ...           4 months ago
  • 3.1.0                                ...           4 months ago
  • 3.0.1                                ...           4 months ago
  • 2.1.2                                ...           9 months ago
  • 2.1.1                                ...           10 months ago
  • 2.1.0                                ...           a year ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 41
Dependencies (7)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |