Socket
Book a DemoInstallSign in
Socket

gestock

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gestock

Gestock API is a client library to interact with the product management API on Firebase https://proyecto-2entrega-lnd.web.app ## Installation You can install the library from npm with: ``` npm install gestock ```

latest
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

Gestock API

Gestock API is a client library to interact with the product management API on Firebase https://proyecto-2entrega-lnd.web.app

Installation

You can install the library from npm with:

npm install gestock

Usage

Import the GestockAPI class into your project:

import GestockAPI from "gestock";

const api = new GestockAPI();

Get products

To retrieve the list of products associated with a user, call getProducts(uid), providing the user's Firebase uid:

async function fetchProducts() {
  try {
    const products = await api.getProducts("YOUR API KEY");
    console.log("Products:", products);
  } catch (error) {
    console.error("Error fetching products:", error);
  }
}

fetchProducts();

Create a Product

async function addProduct() {
  try {
    const newProduct = await api.createProduct("YOUR API KEY", "New Product", 100);
    console.log("Product created:", newProduct);
  } catch (error) {
    console.error("Error creating product:", error);
  }
}

addProduct();

API

getProducts(uid): Returns the list of products associated with the given uid.

createProduct(uid, name, price): Creates a new product with the specified name and price, associated with the given uid.

FAQs

Package last updated on 28 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts