From 2cc898a63f00da4cea982cfaf2d11aa6ed06ebaa Mon Sep 17 00:00:00 2001 From: Joshua Spence Date: Tue, 5 May 2015 07:36:04 +1000 Subject: [PATCH] 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 --- .../DiffusionFindSymbolsConduitAPIMethod.php | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php index d6f072a557..646d546d10 100644 --- a/src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionFindSymbolsConduitAPIMethod.php @@ -13,11 +13,12 @@ final class DiffusionFindSymbolsConduitAPIMethod protected function defineParamTypes() { return array( - 'name' => 'optional string', - 'namePrefix' => 'optional string', - 'context' => 'optional string', - 'language' => 'optional string', - 'type' => 'optional string', + 'name' => 'optional string', + 'namePrefix' => 'optional string', + 'context' => 'optional string', + 'language' => 'optional string', + 'type' => 'optional string', + 'repositoryPHID' => 'optional string', ); } @@ -31,6 +32,7 @@ final class DiffusionFindSymbolsConduitAPIMethod $context = $request->getValue('context'); $language = $request->getValue('language'); $type = $request->getValue('type'); + $repository = $request->getValue('repositoryPHID'); $query = id(new DiffusionSymbolQuery()) ->setViewer($request->getUser()); @@ -49,6 +51,9 @@ final class DiffusionFindSymbolsConduitAPIMethod if ($type !== null) { $query->setType($type); } + if ($repository !== null) { + $query->withRepositoryPHIDs(array($repository)); + } $query->needPaths(true); $query->needRepositories(true); @@ -64,13 +69,14 @@ final class DiffusionFindSymbolsConduitAPIMethod } $response[] = array( - 'name' => $result->getSymbolName(), - 'context' => $result->getSymbolContext(), - 'type' => $result->getSymbolType(), - 'language' => $result->getSymbolLanguage(), - 'path' => $result->getPath(), - 'line' => $result->getLineNumber(), - 'uri' => $uri, + 'name' => $result->getSymbolName(), + 'context' => $result->getSymbolContext(), + 'type' => $result->getSymbolType(), + 'language' => $result->getSymbolLanguage(), + 'path' => $result->getPath(), + 'line' => $result->getLineNumber(), + 'uri' => $uri, + 'repositoryPHID' => $result->getRepository()->getPHID(), ); }