npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tm-service-api

v2.0.4

Published

Common tm microservice api methods

Downloads

78

Readme

TM Micro Service API Prototype class

This class provide fetch wrapper, token and Service URL setter mainly. Just to avoid code duplication.

Requirements

Possibly you will need babel-polyfill to use it.

Documentation

ErrorBadRequest

Extends Error

Custom error message for Bad Request server response

Parameters

  • message (string | null) error details (optional, default null)

constructor

Constructor generates errorinstance

Parameters

  • message (string | null) error details (optional, default null)

Returns ErrorBadRequest current instance

ErrorNotFound

Extends Error

Custom error message for Not Found server response

Parameters

  • message (string | null) error details (optional, default null)

constructor

Constructor generates error instance

Parameters

  • message (string | null) error details (optional, default null)

Returns ErrorNotFound current instance

ErrorServerResponse

Extends Error

Custom error message for abstract server response

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

constructor

Constructor generates error instance

Parameters

  • statusCode number http status code
  • statusText string http status code text
  • message (string | null) error details (optional, default null)

Returns ErrorServerResponse current instance

TMMicroServiceAPI

TM Micro Service Proto API

Parameters

  • url string service url
  • token (string | null) user access tocken if available (optional, default null)

url

Service URL

Properties

token

User access token

Properties

  • token (string | null)? user access tocken if available

constructor

Constructor saves service url

Parameters

  • url string service url
  • token (string | null) user access tocken if available (optional, default null)
  • version string service version (optional, default 'v1')

Returns TMMicroServiceAPI current instance

messages

Object with class service messages

setToken

Set access token

Parameters

setVersion

Set service version

Parameters

  • version string service version

checkUrl

Validagte URL

Parameters

  • url string service URL

  • Throws Error if URL do not match format Error will be thrown

Returns string url - service URL

checkVersion

Validate service version

Parameters

  • version string service version

  • Throws Error if URL do not match format Error will be thrown

Returns string version - service version

request

Fetch remote resource

Parameters

  • url string resource url
  • userOptions Object user defined options

Returns Promise Promise with server Response

tmpVersion

Service version

Properties

  • version string? service version