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

spond

v0.0.10

Published

Unofficial library to access data from the Spond API.

Downloads

10

Readme

Spond API package for JavaScript

This is a unofficial JavaScript package built to consume data from the Spond API. The package is ment to be used in a Node.js environment and should not be used in a browser.

This codebase is a work in progress and is not yet ready for production use.

Installation

npm install spond

How to use

Function: createUserAccessToken

Description: This function creates a user access token by sending a POST request to the spond API login endpoint using the provided username and password.

Usage Example:

const { createUserAccessToken } = require('spond');

try {
  const accessToken = await createUserAccessToken(
    '[email protected]',
    'password123'
  );
  console.log('Access token:', accessToken);
} catch (error) {
  console.error('Authentication failed:', error.message);
}

Function: getGroups

Description: This function fetches groups from the API using the provided access token and returns an array of group objects.

Usage Example:

const { getGroups } = require('spond');

try {
  const groups = await getGroups(accessToken);
  console.log('Groups:', groups);
} catch (error) {
  console.error('Failed to get groups:', error.message);
}

Function: getEvents

Description: This function fetches events from the API using the provided access token and returns an array of event objects.

Usage Example:

const { getEvents } = require('spond');

try {
  const events = await getEvents(accessToken, {groupId: '123456789'});
  console.log('Events:', events);
} catch (error) {
  console.error('Failed to get events:', error.message);
}

Local development

To run the code locally you need to have Node.js installed. Then you can run the following commands in the root of the project:

git clone https://github.com/martcl/spond.git
cd spond
nvm use
npm install

cp .env.example .env # and fill in the values
npm run test

Tests

The goal is to have comprehensive tests for all endpoints. The tests are written using Jest.

Dayly tests

I don't have control over how the Spond API changes and I want to be notified if something breaks. Therefore I have set up a GitHub Action that runs the tests every day. If the tests fail I will get a notification.

Running the tests locally

To run the tests locally you need to have Node.js installed. Then you can run the following commands in the root of the project:

npm run test

Project goal

The goal of this project is to make it easier to consume data from the Spond API. The Spond API is not documented and is not ment to be used by third parties. But there are many use cases where it would be nice to have access to the data. Like integrating the Spond events and posts into a website so people outside of Spond can see the information.

Contributing

If you want to contribute to this project you are more than welcome to do so.