Search code examples
phpgoogle-api-php-clientgoogle-tasks-api

How does Task->setLink work?


On the Google Tasks API website > Reference > Tasks > (https://developers.google.com/google-apps/tasks/v1/reference/tasks) scroll down to 'Resource Representations'.

It looks like I can add a link to my tasks (like Gmail does when you set an email as a task). ApiTaskService.php also includes a class for that: TaskLinks. But when I try it, the added url just won't show up in the Task. Am I doing something wrong? What 'type' should I set the TaskLink to?

Code:

$linkid = array_push($links,new TaskLinks())-1;
$links[$linkid]->setType("website");
$links[$linkid]->setLink($issue_url);
$links[$linkid]->setDescription("{$issue['id']}");

$task = new Task();
$task->setTitle($title);
$task->setNotes($notes);
$task->setDue($due);
$task->setLinks($links);

It doesn't return any errors, but it doesn't change the task either...


Solution

  • This page says that links collection is read-only, so apparently there's no way to set links for now. However some libraries do provide slugs to implement this feature in the future.