mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Add repository parameter to diffusion.findsymbols
method
Summary: Ref T7977. Add a repository parameter to the `diffusion.findsymbols` Conduit method to allow restricting search results to the specified repository. Test Plan: Queried the Conduit endpoint. Reviewers: avivey, epriestley, #blessed_reviewers Reviewed By: avivey, epriestley, #blessed_reviewers Subscribers: eadler, avivey, Korvin, epriestley Maniphest Tasks: T7977 Differential Revision: https://secure.phabricator.com/D12663
This commit is contained in:
parent
f83e12c943
commit
2cc898a63f
1 changed files with 18 additions and 12 deletions
|
@ -13,11 +13,12 @@ final class DiffusionFindSymbolsConduitAPIMethod
|
||||||
|
|
||||||
protected function defineParamTypes() {
|
protected function defineParamTypes() {
|
||||||
return array(
|
return array(
|
||||||
'name' => 'optional string',
|
'name' => 'optional string',
|
||||||
'namePrefix' => 'optional string',
|
'namePrefix' => 'optional string',
|
||||||
'context' => 'optional string',
|
'context' => 'optional string',
|
||||||
'language' => 'optional string',
|
'language' => 'optional string',
|
||||||
'type' => 'optional string',
|
'type' => 'optional string',
|
||||||
|
'repositoryPHID' => 'optional string',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ final class DiffusionFindSymbolsConduitAPIMethod
|
||||||
$context = $request->getValue('context');
|
$context = $request->getValue('context');
|
||||||
$language = $request->getValue('language');
|
$language = $request->getValue('language');
|
||||||
$type = $request->getValue('type');
|
$type = $request->getValue('type');
|
||||||
|
$repository = $request->getValue('repositoryPHID');
|
||||||
|
|
||||||
$query = id(new DiffusionSymbolQuery())
|
$query = id(new DiffusionSymbolQuery())
|
||||||
->setViewer($request->getUser());
|
->setViewer($request->getUser());
|
||||||
|
@ -49,6 +51,9 @@ final class DiffusionFindSymbolsConduitAPIMethod
|
||||||
if ($type !== null) {
|
if ($type !== null) {
|
||||||
$query->setType($type);
|
$query->setType($type);
|
||||||
}
|
}
|
||||||
|
if ($repository !== null) {
|
||||||
|
$query->withRepositoryPHIDs(array($repository));
|
||||||
|
}
|
||||||
|
|
||||||
$query->needPaths(true);
|
$query->needPaths(true);
|
||||||
$query->needRepositories(true);
|
$query->needRepositories(true);
|
||||||
|
@ -64,13 +69,14 @@ final class DiffusionFindSymbolsConduitAPIMethod
|
||||||
}
|
}
|
||||||
|
|
||||||
$response[] = array(
|
$response[] = array(
|
||||||
'name' => $result->getSymbolName(),
|
'name' => $result->getSymbolName(),
|
||||||
'context' => $result->getSymbolContext(),
|
'context' => $result->getSymbolContext(),
|
||||||
'type' => $result->getSymbolType(),
|
'type' => $result->getSymbolType(),
|
||||||
'language' => $result->getSymbolLanguage(),
|
'language' => $result->getSymbolLanguage(),
|
||||||
'path' => $result->getPath(),
|
'path' => $result->getPath(),
|
||||||
'line' => $result->getLineNumber(),
|
'line' => $result->getLineNumber(),
|
||||||
'uri' => $uri,
|
'uri' => $uri,
|
||||||
|
'repositoryPHID' => $result->getRepository()->getPHID(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue