Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "lib"

Index

Variables

Functions

Object literals

Variables

Const isUri

isUri: any = require('valid-url').isUri

Functions

doRequest

  • doRequest(accessToken: string, method: string, data: BitlyUrlQueryParams, config: BitlyConfig): Promise<BitlyResponse>
  • Method called to generate a url and call the request

    Parameters

    • accessToken: string
    • method: string
    • data: BitlyUrlQueryParams
    • config: BitlyConfig

    Returns Promise<BitlyResponse>

    The request result object

Private generateUrl

  • generateUrl(accessToken: string, method: string, data?: BitlyUrlQueryParams, config?: BitlyConfig): UrlWithStringQuery
  • Generates a valid URL for a GET request to the Bit.ly API

    example

    generateUrl({method: 'shorten', accessKey: 'myaccessKey', data: { longUrl: 'https://github.com/tanepiper/node-bitly' } });

    Parameters

    • accessToken: string

      Your bit.ly access token

    • method: string

      The method to call

    • Default value data: BitlyUrlQueryParams = {}

      a data object specifying bit.ly keys for your method

    • Default value config: BitlyConfig = {}

      A custom config object to overide values

    Returns UrlWithStringQuery

sortUrlsAndHash

  • sortUrlsAndHash(unsortedItems: string | string[], result?: BitlyUrlQueryParams): BitlyUrlQueryParams
  • Function to check through an array of items to check for short urls or hashes If only passed one item, put in array for url checking

    Parameters

    • unsortedItems: string | string[]

      The array of items to be checked

    • Default value result: BitlyUrlQueryParams = { shortUrl: [], hash: [] }

    Returns BitlyUrlQueryParams

Object literals

Private Const DEFAULT_OPTIONS

DEFAULT_OPTIONS: object

The internal library of node-bitly

module

node-bitly.lib

apiUrl

apiUrl: string = "api-ssl.bitly.com"

apiVersion

apiVersion: "v3" = "v3"

domain

domain: string = "bit.ly"

format

format: string = "json"

Generated using TypeDoc