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

taskcollab-auto

v1.0.4

Published

A simple package to check if input is null, undefined, or an empty string

Downloads

332

Readme

TaskCollab Auto 📋✨

A simple Node.js utility for adding and managing tasks via REST APIs. Easily send single or bulk tasks to your API endpoint using axios, with built-in logging and error handling powered by chalk.

🚀 Features

  • Add Single Task: Seamlessly post a single task to your API.
  • 🚀 Bulk Task Adding: Send multiple tasks in bulk with a delay between each.
  • 🎨 Colorful Logging: Task progress and errors are beautifully displayed with chalk.
  • 🔑 Token-Based Authentication: Pass your token via headers for secure API access.

📦 Installation

Install the package using npm:

npm install task-collab

or with Yarn:

yarn add task-collab

🔧 Usage

1. Initialize the Class

"To start using TaskCollab, you need to initialize it with your API endpoint and token:

import TaskCollab from 'task-collab';

// API endpoint and authentication token
const endpoint = 'https://api.example.com/tasks';
const token = 'your_secret_token';

// Create an instance of TaskCollab
const taskCollab = new TaskCollab(endpoint, token);

2. Add a Single Task

You can use the addTask() method to add a single task to your API:

const task = {
    title: 'New Task',
    description: 'This is a new task.'
};

// Add a single task
taskCollab.addTask(task);

3. Bulk Add Tasks

The bulkAddTask() method lets you add multiple tasks at once, with a small delay between each request:

const tasks = [
    { title: 'Task 1', description: 'First task.' },
    { title: 'Task 2', description: 'Second task.' },
    { title: 'Task 3', description: 'Third task.' }
];

// Add tasks in bulk
taskCollab.bulkAddTask(tasks);

4. Test Your Setup

You can use the test() method to quickly check if your endpoint and token are correctly set:

taskCollab.test(tasks);

🧪 Example Output

When you run the methods, you’ll see beautifully colored logs thanks to chalk:

Started adding task...
DATA ADDED SUCCESSFULLY { title: 'New Task', description: 'This is a new task.' }
Successfully added task.

Program Started!
Started for task index ==> 0
DATA ADDED SUCCESSFULLY { title: 'Task 1', description: 'First task.' }
Successfully added task.

🛠️ Methods

1. addTask(data)

Posts a single task to the given API endpoint.

  • Parameters:
    • data: An object containing the task details (e.g., { title: 'Task', description: 'Details about task' }).
  • Example:
const task = { title: 'New Task', description: 'Details about the task' };
taskCollab.addTask(task);

2. bulkAddTask(data)

Posts multiple tasks in sequence with a delay between each.

  • Parameters:
    • data: An array of objects, where each object is a task (e.g., [ { title: 'Task 1' }, { title: 'Task 2' } ]).
  • Example:
const tasks = [
    { title: 'Task 1', description: 'First task.' },
    { title: 'Task 2', description: 'Second task.' }
];
taskCollab.bulkAddTask(tasks);

3. test(data)

Logs the passed data, the API endpoint, and the token to the console for testing purposes.

  • Parameters:
    • data: Any object or array you want to test with.
  • Example:
taskCollab.test(tasks);

🛡️ Authentication

This library uses token-based authentication. Simply pass your API token when creating an instance of TaskCollab:

const taskCollab = new TaskCollab('https://api.example.com/tasks', 'your_secret_token');

The token is automatically added to the Authorization header for all requests.

⚡ License

Licensed under the MIT License.


🌟 Happy Tasking!