mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
[conduit] create phid.query method
Summary: Provide a phid.query method that returns the same information as phid.info, but allows querying for multiple phids at once. Test Plan: Called the method from the web conduit console. Reviewers: btrahan, epriestley, jungejason Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1617
This commit is contained in:
parent
da1d57b60a
commit
0b9d0c9d08
3 changed files with 77 additions and 0 deletions
|
@ -147,6 +147,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_path_getowners_Method' => 'applications/conduit/method/path/getowners',
|
||||
'ConduitAPI_phid_Method' => 'applications/conduit/method/phid/base',
|
||||
'ConduitAPI_phid_info_Method' => 'applications/conduit/method/phid/info',
|
||||
'ConduitAPI_phid_query_Method' => 'applications/conduit/method/phid/query',
|
||||
'ConduitAPI_phriction_Method' => 'applications/conduit/method/phriction/base',
|
||||
'ConduitAPI_phriction_edit_Method' => 'applications/conduit/method/phriction/edit',
|
||||
'ConduitAPI_phriction_history_Method' => 'applications/conduit/method/phriction/history',
|
||||
|
@ -962,6 +963,7 @@ phutil_register_library_map(array(
|
|||
'ConduitAPI_path_getowners_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_phid_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_phid_info_Method' => 'ConduitAPI_phid_Method',
|
||||
'ConduitAPI_phid_query_Method' => 'ConduitAPI_phid_Method',
|
||||
'ConduitAPI_phriction_Method' => 'ConduitAPIMethod',
|
||||
'ConduitAPI_phriction_edit_Method' => 'ConduitAPI_phriction_Method',
|
||||
'ConduitAPI_phriction_history_Method' => 'ConduitAPI_phriction_Method',
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2012 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
final class ConduitAPI_phid_query_Method
|
||||
extends ConduitAPI_phid_Method {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Retrieve information about arbitrary PHIDs.";
|
||||
}
|
||||
|
||||
public function defineParamTypes() {
|
||||
return array(
|
||||
'phids' => 'required list<phid>',
|
||||
);
|
||||
}
|
||||
|
||||
public function defineReturnType() {
|
||||
return 'nonempty dict<string, wild>';
|
||||
}
|
||||
|
||||
public function defineErrorTypes() {
|
||||
return array();
|
||||
}
|
||||
|
||||
protected function execute(ConduitAPIRequest $request) {
|
||||
|
||||
$phids = $request->getValue('phids');
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
||||
$result = array();
|
||||
foreach ($handles as $phid => $handle) {
|
||||
if ($handle->isComplete()) {
|
||||
$result[$phid] = $this->buildHandleInformationDictionary($handle);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
15
src/applications/conduit/method/phid/query/__init__.php
Normal file
15
src/applications/conduit/method/phid/query/__init__.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/conduit/method/phid/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ConduitAPI_phid_query_Method.php');
|
Loading…
Reference in a new issue