1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-19 05:12:41 +01:00

Add phame.blog.search Conduit API endpoint

Summary: Ref T9897. Adds basic blog query support.

Test Plan: Ran some queries.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9897

Differential Revision: https://secure.phabricator.com/D14900
This commit is contained in:
epriestley 2015-12-28 03:58:43 -08:00
parent 3335bcbfc9
commit b74f93f229
4 changed files with 60 additions and 1 deletions

View file

@ -3413,6 +3413,7 @@ phutil_register_library_map(array(
'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php',
'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php',
'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php',
'PhameBlogSearchConduitAPIMethod' => 'applications/phame/conduit/PhameBlogSearchConduitAPIMethod.php',
'PhameBlogSearchEngine' => 'applications/phame/query/PhameBlogSearchEngine.php',
'PhameBlogSite' => 'applications/phame/site/PhameBlogSite.php',
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
@ -7846,6 +7847,7 @@ phutil_register_library_map(array(
'PhabricatorProjectInterface',
'PhabricatorDestructibleInterface',
'PhabricatorApplicationTransactionInterface',
'PhabricatorConduitResultInterface',
),
'PhameBlogArchiveController' => 'PhameBlogController',
'PhameBlogController' => 'PhameController',
@ -7861,6 +7863,7 @@ phutil_register_library_map(array(
'PhameBlogProfilePictureController' => 'PhameBlogController',
'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
'PhameBlogSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhameBlogSite' => 'PhameSite',
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',

View file

@ -0,0 +1,18 @@
<?php
final class PhameBlogSearchConduitAPIMethod
extends PhabricatorSearchEngineAPIMethod {
public function getAPIMethodName() {
return 'phame.blog.search';
}
public function newSearchEngine() {
return new PhameBlogSearchEngine();
}
public function getMethodSummary() {
return pht('Read information about blogs.');
}
}

View file

@ -8,7 +8,8 @@ final class PhameBlog extends PhameDAO
PhabricatorFlaggableInterface,
PhabricatorProjectInterface,
PhabricatorDestructibleInterface,
PhabricatorApplicationTransactionInterface {
PhabricatorApplicationTransactionInterface,
PhabricatorConduitResultInterface {
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
@ -344,4 +345,37 @@ final class PhameBlog extends PhameDAO
}
/* -( PhabricatorConduitResultInterface )---------------------------------- */
public function getFieldSpecificationsForConduit() {
return array(
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('name')
->setType('string')
->setDescription(pht('The name of the blog.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('description')
->setType('string')
->setDescription(pht('Blog description.')),
id(new PhabricatorConduitSearchFieldSpecification())
->setKey('status')
->setType('string')
->setDescription(pht('Archived or active status.')),
);
}
public function getFieldValuesForConduit() {
return array(
'name' => $this->getName(),
'description' => $this->getDescription(),
'status' => $this->getStatus(),
);
}
public function getConduitSearchAttachments() {
return array();
}
}

View file

@ -15,6 +15,10 @@ abstract class PhabricatorSearchEngineAPIMethod
}
}
if (!$maps) {
$maps = (object)$maps;
}
return $maps;
}