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

bexioapi

v1.0.0

Published

BexioAPI for client side implementation only.

Downloads

1

Readme

BexioAPI

For client side implementation

Features

TODO

How to use

Install

First install the BexioAPI from npm:

npm install BexioAPI

Then import the BexioAPI into the project:

import BexioAPI from 'BexioAPI';

Initialize the client

Create a config object and initialize the BexioAPI:

const config = {
  clientID: //your client_id,
  clientSecret: //your client_secret,
  redirectURI: 'http://localhost:3000/', //your redirect URI
  scopes: 'article_show monitoring_show project_show', //required scopes, see: https://docs.bexio.com/resources/ (click on the required resource and then "scopes")
  // or see https://docs.bexio.com/oauth/scopes/index.html for a exhaustive list of the available scopes
};

  //initialize the Bexio object
  const Bexio = new BexioAPI(config); // please use this name convention as best practice

Export the new Bexio object to use it in other components/files:

//source component/file
export const Bexio = new BexioAPI(config)

//other component/file
import { Bexio } from '<PATH TO SOURCE FILE>';

Login

In a react-project, use the componentDidMount() lifecycle to catch the login-token

componentDidMount() {
    Bexio.callback();
  }

To redirect the user to the Bexio login page, use the login() method from the API

//the button is just an example
<button className="button" type="button" onClick={() => Bexio.login()}>Login to Bexio</button>

Please keep in mind: the callback() has to be invoked before the login() method. Otherwise the token won't be received trough the procedure and the login() method throws an error.

Get Data (in development)

First ensure you've got the right scopes for the requested data. Otherwise the API throws an error. Currently the following data can be requested from Bexio:

users
timesheets
projects
articles
tasks
contacts
business activities

See the following link for an exhaustive list: Bexio documentation: Resources

Use the following method to get your data:

Bexio.getData('<YOUR_RESOURCE>');

//Example
async handleGetData() {
    const userNames = await Bexio.getData('users');
}

Please note the async/await keywords: getData is an asynchronous method.

Errors

The method throws errors for the following reasons:

  • YOUR_RESOURCE is not a valid Bexio resource

Post Data (in development)

First ensure you've got the right scopes for the requested data. Otherwise the API throws an error. Currently the following data can be sent to Bexio:

timesheets
projects
tasks
contacts
business activities

Use the following method to send data:

Bexio.postData('<YOUR RESOURCE', YOUR_DATA);

Please note: YOUR_DATA shall be an object. The method will convert the object to a JSON object. Also note: Bexio can only handle one object at a time. You can't send a couple of informations packed as array or object to Bexio.

Errors

The method throws errors for the following reasons:

  • YOUR_DATA is not an object
  • YOUR_DATA contains not the required parameters (see the Bexio documentation, under the given resource --> "Form parameters" for the required parameters)