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

querodelivery

v1.0.1

Published

Uma lib para te ajudar com a API do Quero Delivery

Downloads

1

Readme

Quero Delivery API Client

Este projeto é uma biblioteca TypeScript para interagir com a API do Quero Delivery, permitindo operações com categorias, produtos e pedidos.

Você pode consultar a documentação da API do Quero Delivery em https://api.quero.io/documentation.

Instalação

Para instalar a biblioteca, use o npm, yarn ou outro gerenciador de pacotes de sua preferência.:

npm install querodelivery

Uso

Inicialização

Para utilizar a biblioteca, você precisa inicializar a classe Quero com seu token de autorização, placeId, e opcionalmente a URL da API.

import { Quero } from 'querodelivery';

const authorization = 'YOUR_AUTHORIZATION_TOKEN';
const placeId = 'YOUR_PLACE_ID';

const quero = new Quero(authorization, placeId);

O token de autorização e o placeId precisam ser solicitados ao suporte do Quero Delivery.

Categorias

Listar Categorias

const categories = await quero.category().list({ limit: 10, offset: 0 });
console.log(categories);

Obter Categoria por ID

const category = await quero.category().get('CATEGORY_ID');
console.log(category);

Criar Categoria

const newCategory = await quero.category().create({
    nome: 'Nova Categoria',
    isAtivo: true,
    parentId: 'PARENT_ID_OPTIONAL'
});
console.log(newCategory);

Atualizar Categoria

const updated = await quero.category().update('CATEGORY_ID', {
    nome: 'Categoria Atualizada',
    isAtivo: false
});
console.log(updated);

Deletar Categoria

const deleted = await quero.category().delete('CATEGORY_ID');
console.log(deleted);

Produtos

Obter Produto

const product = await quero.product().get({ produtoId: 'PRODUCT_ID' });
console.log(product);

Criar Produto

const newProduct = await quero.product().create({
    nome: 'Novo Produto',
    categoriaId: 'CATEGORY_ID',
    preco: 10.0,
    precoAntigo: 12.0,
    isPesavel: false,
    isPromocao: true,
    isSazonal: false
});
console.log(newProduct);

Atualizar Produto

const updated = await quero.product().update({
    produtoId: 'PRODUCT_ID',
    nome: 'Produto Atualizado',
    preco: 9.0
});
console.log(updated);

Deletar Produto

const deleted = await quero.product().delete({ produtoId: 'PRODUCT_ID' });
console.log(deleted);

Pedidos

Obter Todos os Pedidos

const orders = await quero.order().getAll('CREATED');
console.log(orders);

Obter Pedido por ID

const order = await quero.order().get('ORDER_ID');
console.log(order);

Aceitar Pedido

const accepted = await quero.order().accept('ORDER_ID');
console.log(accepted);

Confirmar Entrega

const deliveryCompleted = await quero.order().deliveryCompleted('ORDER_ID');
console.log(deliveryCompleted);

Despachar Pedido

const dispatched = await quero.order().dispatch('ORDER_ID');
console.log(dispatched);

Confirmar Pedido para Retirada

const readyForPickup = await quero.order().readyForPickup('ORDER_ID');
console.log(readyForPickup);

Solicitar Cancelamento

const cancellationRequested = await quero.order().requestCancellation({
    orderId: 'ORDER_ID',
    reason: 'Motivo do Cancelamento',
    code: 'SYSTEMIC_ISSUES',
    mode: 'MANUAL'
});
console.log(cancellationRequested);

Todos os retornos foram tratados com zod para garantir a integridade dos dados, então você pode confiar que os dados estão no formato correto. Mas lembre-se de consultar a documentação da API para entender melhor o que cada método faz e quais são os parâmetros necessários. E em caso de erros não previstos, você pode considerar contribuir com a biblioteca para melhorar a experiência de uso.

Contribuição

Contribuições são bem-vindas! Sinta-se à vontade para abrir uma issue ou enviar um pull request.

Licença

Este projeto está licenciado sob a MIT License. Veja o arquivo LICENSE para mais detalhes.