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() { $viewer = $this->getViewer(); $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->getConduitKey(); $label = $field->getLabel(); $type_object = $field->getConduitParameterType(); if ($type_object) { $type = '`'.$type_object->getTypeName().'`'; $description = $field->getDescription(); } else { $type = ''; $description = '//'.pht('Not Supported').'//'; } $table[] = "| `{$key}` | **{$label}** | {$type} | {$description}"; } $table = implode("\n", $table); $out[] = $table; $out[] = pht(<<getBuiltinOrders(); $table = array(); $table[] = "| {$head_builtin} | {$head_label} | {$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(<<