Giter Site home page Giter Site logo

kamil-rudnicki / timecamp-node-tasks-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gravyraveydavey/timecamp-node-tasks-api

0.0 0.0 0.0 17 KB

A little node.js CLI client for doing some batch operations on your timecamp tasks via the API.

JavaScript 100.00%

timecamp-node-tasks-api's Introduction

Timecamp 'Tasks' node.js client

A quick and dirty node.js CLI client for doing some batch operations on your timecamp tasks via the API.

I made this for three main reasons:

  1. The dashboard doesn't let you import tasks via a CSV with tags.
  2. The dashboard doesn't let you select multiple tasks at once for archive / deletion.
  3. When you import tasks via CSV you end up with ton's of 3rd level nested tasks called '0' - bug?

So I essentially wanted to wipe my account clean and start again, scrapping the CSV garbage and importing my clients + projects, properly nested and with appropriate tags such as the project code.

Input flags

Flag Alt Description
-i --input [file] Path to .json file
-o --output [dir] create and save json of import API responses to this directory
-b --batch batch mode - bypasses input controls!
-k --key your API key
-t --task [task] specify api task [archive/import/export/delete]
-v --verbose enable console logging
-d --dryrun dry run

Functions

Name Description
Export tasks does get request, dumps tasks to output .json
Import tasks loops through a .json file and imports tasks either one by one or in a batch
Archive loops through a .json and archives tasks either one by one or in a batch
Delete loops through a .json and moves all archived tasks to a single parent temp task so it can be deleted from the projects interface

Setup

First create a .js file called 'key.js' and put it in the root of the folder - in there define your timecamp API key like this: var timecamp_api_key = "xxxxxxxxxxxxxxx"; Find your API key in your account settings

Then in the CLI run npm install

Usage

Export tasks

timecamp -t export -o path/to/folder/to/save It will then create current_projects.json

Archive tasks

timecamp -t archive -i path/to/json/file.json It will then loop through all the tasks in the json file and update them one by one, prompting you as it goes. You can archive the task by responding y, skip a task with n, inspect the task object with i, or quit the script with q.

You can also run the batch flag to process the entire json file recursively without any prompts. timecamp -t archive -i path/to/json/file.json -b Be careful, as this will archive all the tasks in the json!

Delete tasks

This will loop through all your archived projects in the supplied input json file and nest them under one temporary project. Then all you have to do is open your projects page in Timecamp and delete that one project, as it deletes all the subtasks with it. timecamp -t delete -i path/to/json/file.json

Import tasks

Loops through the input json file, prompting you one by one for each project found. You can import the task by responding y, skip a task with n, inspect the task object with i, or quit the script with q. If you specify an output directory then the response of the import request will be saved and written to an output json. This is useful if you want to access the task_id and other timecamp data from the newly created task. timecamp -t import -i path/to/json/file.json -o path/to/folder/to/save

You can also run the batch flag to process the entire json file recursively without any prompts. timecamp -t import -i path/to/json/file.json -o path/to/folder/to/save -b Be careful, as this will import all the tasks in the json!

Import format

Create a JSON file of all your projects / tasks / clients as an array of objects, following this format:

[{
	"client": "Client Name",
	"name": "Client Name",
	"tags": "",
	"full_name": "Client Name"
},{
	"client": "Client Name",
	"name": "INDIVIDUAL PROJECT NAME",
	"tags": "TAG 1, TAG 2, TAG 3",
	"full_name": "PROJECT CODE - PROJECT NAME"
}]

If the client parameter and the name parameter are the same the import script will recognise this as a client, store the task_id from the import response in memory and use it to nest further tasks referencing this client.

I created my json from a directory of clients + projects using a little crawler script here

timecamp-node-tasks-api's People

Contributors

gravyraveydavey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.