diff --git a/cli/clickup-task.php b/cli/clickup-task.php index 9d50ca7..773d94b 100755 --- a/cli/clickup-task.php +++ b/cli/clickup-task.php @@ -1,56 +1,58 @@ #!/usr/bin/php ClickUp bot # Copyright (C) 2023 Valerio Bozzolan, contributors # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . /** * Get ClickUp Task info * * If you specify also a Phabricator Task ID, it connects both. */ // autoload libraries require __DIR__ . '/../autoload.php'; $clickup_task_id = $argv[1] ?? null; $phab_task_id = $argv[2] ?? null; if( !$clickup_task_id ) { echo "RTFM\n"; exit; } $clickup_task_details = ClickUpAPI::queryTaskData( $clickup_task_id ); print_r( $clickup_task_details ); echo "\n"; if( $phab_task_id && $clickup_task_details ) { $phab_task_details = PhabricatorAPI::getTask( $phab_task_id ); if( $phab_task_details ) { - $phab_task_id = $phab_task_details['id']; + $phab_task_id = $phab_task_details['id']; + $phab_task_phid = $phab_task_details['phid']; if( $phab_task_details['type'] === 'TASK' ) { ClickUpPhabricatorCache::instance() ->lock() - ->registerClickupPhabricatorTaskID( $clickup_task_id, $phab_task_id ) + ->registerClickupPhabricatorTaskID( $clickup_task_id, $phab_task_id ) + ->registerClickupPhabricatorTaskPHID( $clickup_task_id, $phab_task_phid ) ->commit(); } } print_r( $phab_task_details ); echo "\n"; }