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

genuka

v1.0.7

Published

Javascript(TS) Package to use Genuka API for a StoreFront website

Downloads

10

Readme

Genuka JS SDK

The Genuka JavaScript SDK allows developers to easily integrate the features of the Genuka platform into their web applications. This SDK provides methods to manage companies, shops, products, pages, blogs, articles, collections, customers, addresses, orders, carts, and payment methods.

Installation

npm install genuka

or

yarn add genuka

Usage

To start using the SDK, you must first import it into your project and initialize it with your company information.

import genuka from "genuka";

// Initialize the instance with your company's domain
genuka.initialize({ domain: "your.domain.com" });

Company

Initialization

Initialize your company information before using the SDK.

await genuka.initialize({ domain: "domain_or_subdomain.genuka.com" });

Retrieving Company Details

To retrieve your company details:

const company = await genuka.company.retrieve();

Shops

Listing Shops

List all available shops:

const shops = await genuka.shops.list();

Shop Details

To retrieve the details of a specific shop by its ID:

const shop = await genuka.shops.retrieve({ id: "01hhfzx7ftzrqjxhx8fbb6ddfs" });

Products

Counting Products

To count all available products:

const productsCount = await genuka.products.count();

Listing Products

List all products:

const products = await genuka.products.list();

Product Details

To retrieve the details of a specific product by its ID:

const product = await genuka.products.retrieve({
  id: "01hkav9sz3qsj4tfdn3yd7214p",
});

Customers

Logging in a Customer

To log in a customer:

const { token, customer } = await genuka.customers.login({
  email: "[email protected]",
  password: "password",
});
Genuka.setToken(token);

Retrieving Customer Details

To retrieve the details of the current customer:

const customerDetails = await genuka.customers.retrieve();

Sure, here are detailed sections of the documentation for the orders and carts parts of your Genuka package.


Orders

List All Orders for a Customer

To list all orders for a customer, you must first log in the customer and then use the list method:

// Log in the customer
const { token } = await genuka.customers.login({
  email: "[email protected]",
  password: "password",
});
genuka.setToken(token);

// List all orders for the customer
const orders = await genuka.orders.list();

Create an Order

To create a new order, use the create method. You must provide details about the customer, shipping, billing, and products included in the order:

const order = await genuka.orders.create({
  customer: {
    first_name: "John",
    last_name: "Doe",
    phone: "123456789",
    email: "[email protected]",
  },
  shipping: {
    mode: "delivery",
    amount: 0,
    address: {
      first_name: "John",
      last_name: "Doe",
      phone: "123456789",
      line1: "line1",
      line2: "line2",
      city: "city",
      state: "state",
      postal_code: "postal_code",
      country: "country",
    },
  },
  billing: {
    method: "cash",
    address: {
      first_name: "John",
      last_name: "Doe",
      phone: "123456789",
      line1: "line1",
      line2: "line2",
      city: "city",
      state: "state",
      postal_code: "postal_code",
      country: "country",
    },
  },
  products: [
    {
      title: "My product here",
      price: 2000,
      quantity: 1,
    },
  ],
});

(Note: Add more details and available configurations as needed for your API.)

Carts

Add to Cart

To add a product to the cart, use the add method by providing the necessary details:

genuka.cart.add({
  product_id: "product_id",
  variant_id: "variant_id",
  quantity: 1,
  price: 2000,
});

Retrieve Cart

To retrieve the current contents of the cart:

const cart = genuka.cart.retrieve();

Update Cart Item

To update the quantity of a specific item in the cart:

genuka.cart.update("variant_id", {
  quantity: 2,
});
const updatedCart = genuka.cart.retrieve();

Remove from Cart

To remove an item from the cart:

genuka.cart.remove("variant_id");
const cartAfterRemoval = genuka.cart.retrieve();

Clear Cart

To empty the cart:

genuka.cart.clear();
const emptyCart = genuka.cart.retrieve();

(Note: This is a basic example for the most important sections. You should continue this pattern for all other methods and classes you have defined, such as pages, blogs, articles, collections, addresses, and paymentMethods.)

Contribution

If you wish to contribute to this SDK, please contact us via Whatsapp (+237 6 95 76 25 95) or send an email to [email protected]. We welcome contributions in the form of pull requests, bug reports, and suggestions for new features.