{"action":"created","comment":{"url":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments/39738312","id":39738312,"diff_hunk":"@@ -23,10 +23,24 @@ sub list {\n     my $self = shift;\n \n     my %args;\n-    for my $arg (qw/state build iso distri version flavor maxage scope group limit/) {\n+    for my $arg (qw/build iso distri version flavor maxage scope group limit/) {\n         next unless defined $self->param($arg);\n         $args{$arg} = $self->param($arg);\n     }\n+    # For these, we accept a single value, a single instance of the arg\n+    # with a comma-separated list of values, or multiple instances of the\n+    # arg. In all cases we're going to convert to an array ref of values:\n+    # we could let query_jobs do the string splitting for us, but this is\n+    # clearer.\n+    for my $arg (qw/state ids/) {\n+        next unless defined $self->param($arg);\n+        if (index($self->param($arg), ',') != -1) {\n+            $args{$arg} = [split(',', $self->param($arg))];","path":"lib/OpenQA/WebAPI/Controller/API/V1/Job.pm","position":17,"original_position":17,"commit_id":"0385dee10397dda0fd43b7daff39e5ae8b3e6ff4","original_commit_id":"0385dee10397dda0fd43b7daff39e5ae8b3e6ff4","user":{"login":"aaannz","id":1260795,"avatar_url":"https://avatars.githubusercontent.com/u/1260795?v=3","gravatar_id":"","url":"https://api.github.com/users/aaannz","html_url":"https://github.com/aaannz","followers_url":"https://api.github.com/users/aaannz/followers","following_url":"https://api.github.com/users/aaannz/following{/other_user}","gists_url":"https://api.github.com/users/aaannz/gists{/gist_id}","starred_url":"https://api.github.com/users/aaannz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aaannz/subscriptions","organizations_url":"https://api.github.com/users/aaannz/orgs","repos_url":"https://api.github.com/users/aaannz/repos","events_url":"https://api.github.com/users/aaannz/events{/privacy}","received_events_url":"https://api.github.com/users/aaannz/received_events","type":"User","site_admin":false},"body":"Why are you doing `split` also here? I would like to keep it in one place in case we change our minds in the future.","created_at":"2015-09-17T12:16:15Z","updated_at":"2015-09-17T12:16:15Z","html_url":"https://github.com/os-autoinst/openQA/pull/434#discussion_r39738312","pull_request_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/434","_links":{"self":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments/39738312"},"html":{"href":"https://github.com/os-autoinst/openQA/pull/434#discussion_r39738312"},"pull_request":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/434"}}},"pull_request":{"url":"https://api.github.com/repos/os-autoinst/openQA/pulls/434","id":45239897,"html_url":"https://github.com/os-autoinst/openQA/pull/434","diff_url":"https://github.com/os-autoinst/openQA/pull/434.diff","patch_url":"https://github.com/os-autoinst/openQA/pull/434.patch","issue_url":"https://api.github.com/repos/os-autoinst/openQA/issues/434","number":434,"state":"open","locked":false,"title":"Query job ids","user":{"login":"AdamWill","id":916551,"avatar_url":"https://avatars.githubusercontent.com/u/916551?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamWill","html_url":"https://github.com/AdamWill","followers_url":"https://api.github.com/users/AdamWill/followers","following_url":"https://api.github.com/users/AdamWill/following{/other_user}","gists_url":"https://api.github.com/users/AdamWill/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamWill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamWill/subscriptions","organizations_url":"https://api.github.com/users/AdamWill/orgs","repos_url":"https://api.github.com/users/AdamWill/repos","events_url":"https://api.github.com/users/AdamWill/events{/privacy}","received_events_url":"https://api.github.com/users/AdamWill/received_events","type":"User","site_admin":false},"body":"The main thing I wanted to do here was allow for specifying job IDs when searching. Sometimes we just want to query some specific set of jobs; this lets us do it with one query instead of running a single query for each job.\r\n\r\nWhile I was working on it I noticed there's kind of an inconsistency in how `query_jobs()` handles args which can be lists of values (`ids` and `state`, for now). For `state` it expects a comma-separated list, but for `ids` it expects (I think) an array reference. I thought it would be a good idea to clean that up a bit: the safest thing to do seemed to be to handle both of the styles for both cases (and make it so others can be added if wanted). With this, comma-separated lists get turned into array refs right at the start, everything further down can assume it's getting an array ref. (Single-value strings will become single-member arrays).\r\n\r\nNOTE: I'm not totally sure if this `ref($args{$arg}) eq 'ARRAY'` test is the best, let me know if anyone knows of any pitfalls.\r\n\r\nWhile I was working on this it made me curious about what the conventions for URL querying lists of values actually are, and it seems like one of the standard ways to do it is to allow the same query name to be passed multiple times - `?ids=1&ids=2&ids=3...`. So I thought it might be a good idea to support that; the second commit adds it. Without the second commit, you have to use the comma-separated style when doing queries via the web API.","created_at":"2015-09-17T00:23:45Z","updated_at":"2015-09-17T12:16:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"36c1af012f04b9efbdcf7348c5cf93d52afcd0fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/434/commits","review_comments_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/434/comments","review_comment_url":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/os-autoinst/openQA/issues/434/comments","statuses_url":"https://api.github.com/repos/os-autoinst/openQA/statuses/0385dee10397dda0fd43b7daff39e5ae8b3e6ff4","head":{"label":"AdamWill:query-job-ids","ref":"query-job-ids","sha":"0385dee10397dda0fd43b7daff39e5ae8b3e6ff4","user":{"login":"AdamWill","id":916551,"avatar_url":"https://avatars.githubusercontent.com/u/916551?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamWill","html_url":"https://github.com/AdamWill","followers_url":"https://api.github.com/users/AdamWill/followers","following_url":"https://api.github.com/users/AdamWill/following{/other_user}","gists_url":"https://api.github.com/users/AdamWill/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamWill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamWill/subscriptions","organizations_url":"https://api.github.com/users/AdamWill/orgs","repos_url":"https://api.github.com/users/AdamWill/repos","events_url":"https://api.github.com/users/AdamWill/events{/privacy}","received_events_url":"https://api.github.com/users/AdamWill/received_events","type":"User","site_admin":false},"repo":{"id":31450875,"name":"openQA","full_name":"AdamWill/openQA","owner":{"login":"AdamWill","id":916551,"avatar_url":"https://avatars.githubusercontent.com/u/916551?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamWill","html_url":"https://github.com/AdamWill","followers_url":"https://api.github.com/users/AdamWill/followers","following_url":"https://api.github.com/users/AdamWill/following{/other_user}","gists_url":"https://api.github.com/users/AdamWill/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamWill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamWill/subscriptions","organizations_url":"https://api.github.com/users/AdamWill/orgs","repos_url":"https://api.github.com/users/AdamWill/repos","events_url":"https://api.github.com/users/AdamWill/events{/privacy}","received_events_url":"https://api.github.com/users/AdamWill/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AdamWill/openQA","description":"openQA web-frontend, scheduler and tools","fork":true,"url":"https://api.github.com/repos/AdamWill/openQA","forks_url":"https://api.github.com/repos/AdamWill/openQA/forks","keys_url":"https://api.github.com/repos/AdamWill/openQA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AdamWill/openQA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AdamWill/openQA/teams","hooks_url":"https://api.github.com/repos/AdamWill/openQA/hooks","issue_events_url":"https://api.github.com/repos/AdamWill/openQA/issues/events{/number}","events_url":"https://api.github.com/repos/AdamWill/openQA/events","assignees_url":"https://api.github.com/repos/AdamWill/openQA/assignees{/user}","branches_url":"https://api.github.com/repos/AdamWill/openQA/branches{/branch}","tags_url":"https://api.github.com/repos/AdamWill/openQA/tags","blobs_url":"https://api.github.com/repos/AdamWill/openQA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AdamWill/openQA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AdamWill/openQA/git/refs{/sha}","trees_url":"https://api.github.com/repos/AdamWill/openQA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AdamWill/openQA/statuses/{sha}","languages_url":"https://api.github.com/repos/AdamWill/openQA/languages","stargazers_url":"https://api.github.com/repos/AdamWill/openQA/stargazers","contributors_url":"https://api.github.com/repos/AdamWill/openQA/contributors","subscribers_url":"https://api.github.com/repos/AdamWill/openQA/subscribers","subscription_url":"https://api.github.com/repos/AdamWill/openQA/subscription","commits_url":"https://api.github.com/repos/AdamWill/openQA/commits{/sha}","git_commits_url":"https://api.github.com/repos/AdamWill/openQA/git/commits{/sha}","comments_url":"https://api.github.com/repos/AdamWill/openQA/comments{/number}","issue_comment_url":"https://api.github.com/repos/AdamWill/openQA/issues/comments{/number}","contents_url":"https://api.github.com/repos/AdamWill/openQA/contents/{+path}","compare_url":"https://api.github.com/repos/AdamWill/openQA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AdamWill/openQA/merges","archive_url":"https://api.github.com/repos/AdamWill/openQA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AdamWill/openQA/downloads","issues_url":"https://api.github.com/repos/AdamWill/openQA/issues{/number}","pulls_url":"https://api.github.com/repos/AdamWill/openQA/pulls{/number}","milestones_url":"https://api.github.com/repos/AdamWill/openQA/milestones{/number}","notifications_url":"https://api.github.com/repos/AdamWill/openQA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AdamWill/openQA/labels{/name}","releases_url":"https://api.github.com/repos/AdamWill/openQA/releases{/id}","created_at":"2015-02-28T04:25:25Z","updated_at":"2015-05-05T23:19:10Z","pushed_at":"2015-09-17T00:32:23Z","git_url":"git://github.com/AdamWill/openQA.git","ssh_url":"git@github.com:AdamWill/openQA.git","clone_url":"https://github.com/AdamWill/openQA.git","svn_url":"https://github.com/AdamWill/openQA","homepage":"http://openqa.opensuse.org/","size":13698,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"os-autoinst:master","ref":"master","sha":"54a0737aaa99e370572afd4ad2df5f22c4b71ad8","user":{"login":"os-autoinst","id":6918706,"avatar_url":"https://avatars.githubusercontent.com/u/6918706?v=3","gravatar_id":"","url":"https://api.github.com/users/os-autoinst","html_url":"https://github.com/os-autoinst","followers_url":"https://api.github.com/users/os-autoinst/followers","following_url":"https://api.github.com/users/os-autoinst/following{/other_user}","gists_url":"https://api.github.com/users/os-autoinst/gists{/gist_id}","starred_url":"https://api.github.com/users/os-autoinst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/os-autoinst/subscriptions","organizations_url":"https://api.github.com/users/os-autoinst/orgs","repos_url":"https://api.github.com/users/os-autoinst/repos","events_url":"https://api.github.com/users/os-autoinst/events{/privacy}","received_events_url":"https://api.github.com/users/os-autoinst/received_events","type":"Organization","site_admin":false},"repo":{"id":20883829,"name":"openQA","full_name":"os-autoinst/openQA","owner":{"login":"os-autoinst","id":6918706,"avatar_url":"https://avatars.githubusercontent.com/u/6918706?v=3","gravatar_id":"","url":"https://api.github.com/users/os-autoinst","html_url":"https://github.com/os-autoinst","followers_url":"https://api.github.com/users/os-autoinst/followers","following_url":"https://api.github.com/users/os-autoinst/following{/other_user}","gists_url":"https://api.github.com/users/os-autoinst/gists{/gist_id}","starred_url":"https://api.github.com/users/os-autoinst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/os-autoinst/subscriptions","organizations_url":"https://api.github.com/users/os-autoinst/orgs","repos_url":"https://api.github.com/users/os-autoinst/repos","events_url":"https://api.github.com/users/os-autoinst/events{/privacy}","received_events_url":"https://api.github.com/users/os-autoinst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/os-autoinst/openQA","description":"openQA web-frontend, scheduler and tools","fork":false,"url":"https://api.github.com/repos/os-autoinst/openQA","forks_url":"https://api.github.com/repos/os-autoinst/openQA/forks","keys_url":"https://api.github.com/repos/os-autoinst/openQA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/os-autoinst/openQA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/os-autoinst/openQA/teams","hooks_url":"https://api.github.com/repos/os-autoinst/openQA/hooks","issue_events_url":"https://api.github.com/repos/os-autoinst/openQA/issues/events{/number}","events_url":"https://api.github.com/repos/os-autoinst/openQA/events","assignees_url":"https://api.github.com/repos/os-autoinst/openQA/assignees{/user}","branches_url":"https://api.github.com/repos/os-autoinst/openQA/branches{/branch}","tags_url":"https://api.github.com/repos/os-autoinst/openQA/tags","blobs_url":"https://api.github.com/repos/os-autoinst/openQA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/os-autoinst/openQA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/os-autoinst/openQA/git/refs{/sha}","trees_url":"https://api.github.com/repos/os-autoinst/openQA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/os-autoinst/openQA/statuses/{sha}","languages_url":"https://api.github.com/repos/os-autoinst/openQA/languages","stargazers_url":"https://api.github.com/repos/os-autoinst/openQA/stargazers","contributors_url":"https://api.github.com/repos/os-autoinst/openQA/contributors","subscribers_url":"https://api.github.com/repos/os-autoinst/openQA/subscribers","subscription_url":"https://api.github.com/repos/os-autoinst/openQA/subscription","commits_url":"https://api.github.com/repos/os-autoinst/openQA/commits{/sha}","git_commits_url":"https://api.github.com/repos/os-autoinst/openQA/git/commits{/sha}","comments_url":"https://api.github.com/repos/os-autoinst/openQA/comments{/number}","issue_comment_url":"https://api.github.com/repos/os-autoinst/openQA/issues/comments{/number}","contents_url":"https://api.github.com/repos/os-autoinst/openQA/contents/{+path}","compare_url":"https://api.github.com/repos/os-autoinst/openQA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/os-autoinst/openQA/merges","archive_url":"https://api.github.com/repos/os-autoinst/openQA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/os-autoinst/openQA/downloads","issues_url":"https://api.github.com/repos/os-autoinst/openQA/issues{/number}","pulls_url":"https://api.github.com/repos/os-autoinst/openQA/pulls{/number}","milestones_url":"https://api.github.com/repos/os-autoinst/openQA/milestones{/number}","notifications_url":"https://api.github.com/repos/os-autoinst/openQA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/os-autoinst/openQA/labels{/name}","releases_url":"https://api.github.com/repos/os-autoinst/openQA/releases{/id}","created_at":"2014-06-16T12:23:22Z","updated_at":"2015-07-31T14:50:43Z","pushed_at":"2015-09-17T12:13:29Z","git_url":"git://github.com/os-autoinst/openQA.git","ssh_url":"git@github.com:os-autoinst/openQA.git","clone_url":"https://github.com/os-autoinst/openQA.git","svn_url":"https://github.com/os-autoinst/openQA","homepage":"http://openqa.opensuse.org/","size":17425,"stargazers_count":19,"watchers_count":19,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":26,"mirror_url":null,"open_issues_count":9,"forks":26,"open_issues":9,"watchers":19,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/434"},"html":{"href":"https://github.com/os-autoinst/openQA/pull/434"},"issue":{"href":"https://api.github.com/repos/os-autoinst/openQA/issues/434"},"comments":{"href":"https://api.github.com/repos/os-autoinst/openQA/issues/434/comments"},"review_comments":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/434/comments"},"review_comment":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/os-autoinst/openQA/pulls/434/commits"},"statuses":{"href":"https://api.github.com/repos/os-autoinst/openQA/statuses/0385dee10397dda0fd43b7daff39e5ae8b3e6ff4"}}}}