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 🙏

© 2025 – Pkg Stats / Ryan Hefner

konnect-app-plugin

v1.0.78

Published

konnect-app-plugin

Downloads

7

Readme

konnect-app-plugin

App Konnect API documentation for third party apps.

Installation

npm i konnect-app-plugin

or

yarn add konnect-app-plugin

Usage

Importing the Module

const { init } = require('konnect-app-plugin');

Initialize the API Configuration

Call the init function to set the base URL for the API:

async init(){
    const url = 'sample url'
    try{
      const result = await init(url);
      console.log('Success')
    }catch (error){
      console.error('Login failed:', error);
      this.errorToast(JSON.stringify(error));
    }
  } 

Available Functions

getToken(endpoint, body)

Fetches an access token and updates the Authorization header.

  • Parameters:
    • endpoint (string): The endpoint for the token request.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

updateCallBack(endpoint, body)

Sends a PUT request to update data.

  • Parameters:
    • endpoint (string): The API endpoint.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

getCallback(endpoint)

Sends a GET request to fetch data.

  • Parameters:
    • endpoint (string): The API endpoint.
  • Returns: A Promise resolving to the API response.

registerCallback(endpoint, body)

Sends a POST request to register data.

  • Parameters:
    • endpoint (string): The API endpoint.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

getBalance(endpoint)

Fetches the balance using a GET request.

  • Parameters:
    • endpoint (string): The API endpoint.
  • Returns: A Promise resolving to the API response.

uploadDocument(endpoint, body)

Uploads a document using a POST request.

  • Parameters:
    • endpoint (string): The API endpoint.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

createCWA(endpoint, body)

Creates a CWA (Custom Web Application) using a POST request.

  • Parameters:
    • endpoint (string): The API endpoint.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

updateCWA(endpoint, body)

Updates a CWA using a PUT request.

  • Parameters:
    • endpoint (string): The API endpoint.
    • body (object): The request payload.
  • Returns: A Promise resolving to the API response.

getDocumentType(endpoint)

Fetches document types using a GET request.

  • Parameters:
    • endpoint (string): The API endpoint.
  • Returns: A Promise resolving to the API response.

Example Usage

declare var require: any;
const {
  getToken,
  registerCallback,
  init
} = require('konnect-app-plugin');


 async init(){
    const url = 'sample url'
    try{
      const result = await init(url);
      console.log('Success')
    }catch (error){
      console.error('Login failed:', error);
      this.errorToast(JSON.stringify(error));
    }
  } 

 async getToken() {
    const endpoint = 'sample endpoint'
    const body = {
      USERNAME: 'sample username',
      PASSWORD: 'sample password',
    };
    try {
      const result = await getToken(endpoint,body);     
      console.log('result',result);
    } catch (error) {
      console.error('Login failed:', error);
    }
  }



async registerCallback() {
    const endpoint='sample endpoint'
    const body = {
      body: 'sample body',
    };
    try {
      const result = await registerCallback(endpoint,body);
      console.log('registerCallback', result);

    } catch (error) {
      console.error('registerCallback failed:', error);
    }
  }

Error Handling

All functions handle errors by logging them to the console and rejecting the Promise with an error message. The error message includes the response data if available, or the error message otherwise.

License

This project is licensed under the MIT License. See the ISC file for details.