Tasks API implementation into the PHP Client for Makerlog
In my spare time I build a PHP client for Makerlog. Makerlog is the dead-simple task log that helps you stay productive and ship faster. There you can meet other makers and share your progress.
At the moment there is no PHP client, so I decided to change this a few weeks ago. Today I integrated the basic Task API into the client.
Repository
- https://github.com/pcsg/pcsg-makerlog-php-client
- Licence: GPL-3.0+
New Features
- What feature(s) did you add?
Almost the complete Task API
- How did you implement it/them?
The implementation is done with the following commits
- feat: new sync method; feat: started new Task Object; feat: /issues/4
- feat: create tasks
- feat: delete a task
- feat: getter and task data integrated
In addition, I have written a basic documentation so that you can use it.
Since documentation is more important to most people than the implementation of the client. Let me give you an overview how to use the client.
- Basically there is a central
Tasks
object which can be used to get Tasks and which can be used to create Tasks. - Additionally there is the single
Task
.
How to get the main Tasks Object
The main Tasks object is directly available via the makerlog client
'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET',
'access_token' => 'ACCESS_TOKEN_FROM_THE_USER'
]);
$Tasks = $Makerlog->getTasks();
Create a Task
To create a new task, you must use the tasks object.
For the sake of simplicity I assume that the makerlog object is already instantiated and in my examples I won't do that again.
getTasks()->createTask('COUR CONTENT', $options);
The options of a task are optional but can have the following values:
false, // bool
"in_progress" => false // bool
];
Get tasks
Returns a list of all tasks in Makerlog.
getTasks()->getList();
Get a task
A single task can be received via its id
getTasks()->get(892); // get task via ID
With a normal task which has been received via get(), no operations can be executed. If you want to change the task, you should get a task object. This can be done via getTaskAsObject().
getTasks()->getTaskAsObject(892); // get task via ID
// delete the task
$Task->delete();
// praise the task
$Task->praise(100);
A task object has several getter methods, so it is quite easy to access the data of the task.
getTasks()->getTaskAsObject(892); // get task via ID
// main data
$Task->getId();
$Task->getContent();
// dates
$Task->getCreationDate();
$Task->getDoneDate();
$Task->getLastUpdateDate();
$Task->getCommentCount();
// is methods
$Task->isDone(); // returns true if the task is done
$Task->isInProgress(); // returns true if the task is in progress
GitHub Account
- https://github.com/dehenne
Makerlog and the client itself is still at the beginning. Many functions are still missing. But if you want to use the client, you can have a look at the examples.
With the changes and features of today it is now possible to create, delete tasks, praise other tasks and read tasks. :-) Have fun in Makerlog and thanks for reading, Hen