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

huiz-wrapper

v1.1.1

Published

API wrapper for Huiz

Downloads

4

Readme

Node.js API wrapper for Huiz.

This package is still a work in progress.

Installation

npm install huiz-wrapper

or

yarn add huiz-wrapper

then

import { Huiz } from 'huiz-wrapper';

Usage

// Creates Huiz object using a personal access token, set verbose=true if you want to see all requests
const huiz = new Huiz(token, verbose);
// Gets todays eat event instance using the house ID
const event = await huiz.event().getTodaysEatEventInstance(houseId);

Functions

For all of these functions you need a personal access token. For instructions, see Auth.

Documents

// Gets all documents from house given house ID
Huiz.document().getDocumentsFromHouse(houseId);
// Gets document from given document ID (assuming you have access)
Huiz.document().getDocumentFromId(documentId);

Events

All of these function names are self-explanatory

Huiz.event().getEventsFromHouse(houseId);
Huiz.event().getEventFromId(eventId);
Huiz.event().getEventParticipantsFromId(eventId);
Huiz.event().getEventInstanceFromEventId(eventId);
Huiz.event().getOnlyEventInstanceFromEventInstanceId(eventInstanceId);
Huiz.event().getEventAvailabilityFromEventInstanceId(eventInstanceId);
Huiz.event().getEventResponsibilityFromEventInstanceId(eventInstanceId);
Huiz.event().getEventInstanceFromEventInstanceId(eventInstanceId);
Huiz.event().getEventInstanceOnDateWithEventId(eventId, date);
Huiz.event().getEventInstanceOnDateWithSlug(houseId, date, slug);
Huiz.event().getTodaysEatEventInstance(houseId);
Huiz.event().getTodaysChoreEventInstance(houseId);
Huiz.event().setEventAvailabilityWithEventInstanceId(eventInstanceId, availability);

Expenses

Huiz.expense().getExpensesFromHouse(houseId);
Huiz.expense().getExpenseFromExpenseId(expenseId);
// Returns all of the house's expenses with descending date (newest first)
Huiz.expense().getExpensesFromHouseDescendingDate(houseId);
// Returns the i-th expense sorted by date descending
Huiz.expense().getIthExpenseFromHouse(houseId, i);

Houses

// Returns house given house ID (assuming you have access)
Huiz.house().getHouse(houseId);
// Returns all the user's houses
Huiz.house().getHouses();

Products

Huiz.product().getProductsFromHouse(houseId);
Huiz.product().getProductFromId(productId);
Huiz.product().getProductVariantsFromId(productId);

Recipes

Huiz.recipe().getRecipesFromHouse(houseId);
Huiz.recipe().getRecipeFromId(recipeId);
Huiz.recipe().getIngredientsFromRecipe(recipeId);
Huiz.recipe().getStepsFromRecipe(recipeId);
Huiz.recipe().getCommentsFromRecipe(recipeId);

Tags

Huiz.recipe().getTagsFromHouse(houseId);
Huiz.recipe().getTagFromId(tagId);

Units

Huiz.unit().getUnitsFromHouse(houseId);
Huiz.unit().getUnitFromId(unitId);

Users

Huiz.user().getUser(userId);
Huiz.user().getHouseUsers(houseId);

Advanced usage

Every request can also be provided with additional headers and queries. If you want to add your own headers and queries to any request, do the following:

import { Headers, Query } from '../huiz';

const myHeaders: Headers = {
    "Connection": "keep-alive",
}

const myQueries: Query = {
    "order[date]": "asc"
}

Auth

You can create a Huiz object with a personal access token. Provided you have a personal access token, you can store it in a .env file, in the .env.example provided there is space for your own personal access token as well as a default house ID, you can use it as follows:

require('dotenv').config({ path: '.env.local' });
const token = process.env.ACCESS_TOKEN;

const huiz = new Huiz(token);

Keep in mind that you do need the dotenv package to load .env files.

Once authenticated, you'll be able to use all functions in the wrapper. Without authentication, you won't be able to use this wrapper.