redmineをシェルで操作の履歴

PHPで自分担当を取得

<?php
$key= 'hogehoge';
$limit = 30;
$assigned = 83;
$e = file_get_contents('https://example.com/issues.json?status_id=open&key='.$key.'&limit='.$limit.'&assigned_to_id='.$assigned);
$xs = json_decode($e)->issues;
$c = 1;
foreach($xs as $x){
  if($x->author->id == $x->assigned_to->id){
    $user = $x->author->name;
  }else{
    $user = $x->author->name.' -> '.$x->assigned_to->name;
  }
  echo zero($c).'.('.$user.') '.$x->subject."      \n";
  $c++;
}

function zero($n){
  if($n < 10){
    return '0'.$n;
  }else{
    return $n;
  }
}


~/.bashrcに

alias re='clear; php ~/redmine.php

とかってしておくといい感じ