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

@epicdm/gigwage

v0.1.4

Published

Gigwage TS Client and Express Middleware for the Gigwage API

Downloads

16

Readme

Beta - Currently in Development

Adding convenience methods for certain endpoints, eg: listSubscriptions. Not all methods implemented yet. Please check back soon.

Installation

yarn add @epicdm/gigwage
npm install @epicdm/gigwage

See Gigwage Developer Documentation

  • https://developers.gigwage.com/docs
  • https://developers.gigwage.com/reference

API Client usage, see examples

import GigwageService, { Contractor, Subscription } from '../src/gigwage';

const gigwageService = new GigwageService({
  config: {
    apiKey: 'YOUR_API_KEY',
    apiSecret: 'YOUR_API_SECRET',
    apiEnvironment: 'sandbox',
  },
});

/* Exposes signed axios request methods:
  gigwageService.get
  gigwageService.post
  gigwageService.put
  gigwageService.patch
  gigwageService.del
*/

gigwageService.get<{ contractors: Contractor[] }>("api/v1/contractors")
  .then((response) => {
    const contractors = response.data.contractors;
  });

gigwageService.post<{ contractor: Contractor }>("api/v1/contractors", {
  contractor: {
    first_name: 'John',
    last_name: 'Doe',
    email: '[email protected]',
  }
}).then((response) => {
  if (response.data.error) {
    /* Axios handled error, includes validation error response:
    {
      "error": "Validation Failed",
      "errors": [
        "Email missing",
      ]
    }
    */
  }
  const contractor = response.data.contractor;
});

// Reactivate Subscription
gigwageService.put<{ subscription: Subscription }>(`api/v1/subscriptions/13`)
  .then((response) => {
    const subscription = response.data.subscription;
  });

// Delete Subscription
gigwageService.del<{ subscription: Subscription }>(`api/v1/subscriptions/13`)
  .then((response) => {
    const subscription = response.data.subscription;
  });  

Express Middleware Usage, see examples

route.post(
  `/gigwage/payment`,
  gigwageService.bodyParser(), // need raw and JSON body
  gigwageService.validateWebhook(), // validate webhook signature
  async (request, response) => {
    try {
      // do something with the request, its been validated
      response.status(200).send(`I did it!`);
    } catch (err: any) {
      console.log(err);
      response.status(500).send(`Webhook Error`);
      return;
    }
  },
);

Development Getting started

Installation

Clone this repository:

git clone https://github.com/epicdigitalmedia/epic-gigwage

Open the directory and run the script line:

cd epic-gigwage
yarn # or npm i

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

codecov

📝 License

Copyright © 2022 Epic Digital Interactive Media LLC. This project is MIT licensed.