newSearchEngine(); $class = $engine->getApplicationClassName(); return PhabricatorApplication::getByClass($class); } public function getMethodStatus() { return self::METHOD_STATUS_UNSTABLE; } public function getMethodStatusDescription() { return pht('ApplicationSearch methods are highly unstable.'); } final protected function defineParamTypes() { return array( 'queryKey' => 'optional string', 'constraints' => 'optional map', 'order' => 'optional order', ) + $this->getPagerParamTypes(); } final protected function defineReturnType() { return 'map'; } final protected function execute(ConduitAPIRequest $request) { $engine = $this->newSearchEngine() ->setViewer($request->getUser()); return $engine->buildConduitResponse($request); } final public function getMethodDescription() { // TODO: We don't currently have a real viewer in this method. $viewer = PhabricatorUser::getOmnipotentUser(); $engine = $this->newSearchEngine() ->setViewer($viewer); $query = $engine->newQuery(); $out = array(); $out[] = pht(<<loadAllNamedQueries(); $table = array(); $table[] = "| {$head_querykey} | {$head_name} | {$head_builtin} |"; $table[] = '|------------------|--------------|-----------------|'; foreach ($named_queries as $named_query) { $key = $named_query->getQueryKey(); $name = $named_query->getQueryName(); $builtin = $named_query->getIsBuiltin() ? pht('Builtin') : pht('Custom'); $table[] = "| `{$key}` | {$name} | {$builtin} |"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<getSearchFieldsForConduit(); $table = array(); $table[] = "| {$head_key} | {$head_label} | {$head_type} | {$head_desc} |"; $table[] = '|-------------|---------------|--------------|--------------|'; $table[] = "| `ids` | **IDs** | `list` | {$desc_ids} |"; $table[] = "| `phids` | **PHIDs** | `list` | {$desc_phids} |"; foreach ($fields as $field) { $key = $field->getKeyForConduit(); $label = $field->getLabel(); // TODO: Support generating and surfacing this information. $type = pht('TODO'); $description = pht('TODO'); $table[] = "| `{$key}` | **{$label}** | `{$type}` | {$description}"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<getBuiltinOrders(); $table = array(); $table[] = "| {$head_builtin} | {$head_description} | {$head_columns} |"; $table[] = '|-----------------|---------------------|-----------------|'; foreach ($orders as $key => $order) { $name = $order['name']; $columns = implode(', ', $order['vector']); $table[] = "| `{$key}` | {$name} | {$columns} |"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<getOrderableColumns(); $table = array(); $table[] = "| {$head_column} | {$head_unique} |"; $table[] = '|----------------|----------------|'; foreach ($columns as $key => $column) { $unique = idx($column, 'unique') ? pht('Yes') : pht('No'); $table[] = "| `{$key}` | {$unique} |"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<getAllConduitFieldSpecifications(); $table = array(); $table[] = "| {$head_key} | {$head_type} | {$head_description} |"; $table[] = '|-------------|--------------|---------------------|'; foreach ($specs as $key => $spec) { $type = idx($spec, 'type'); $description = idx($spec, 'description'); $table[] = "| `{$key}` | `{$type}` | {$description} |"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<