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:
parent
3335bcbfc9
commit
b74f93f229
4 changed files with 60 additions and 1 deletions
|
@ -3413,6 +3413,7 @@ phutil_register_library_map(array(
|
||||||
'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php',
|
'PhameBlogProfilePictureController' => 'applications/phame/controller/blog/PhameBlogProfilePictureController.php',
|
||||||
'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php',
|
'PhameBlogQuery' => 'applications/phame/query/PhameBlogQuery.php',
|
||||||
'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php',
|
'PhameBlogReplyHandler' => 'applications/phame/mail/PhameBlogReplyHandler.php',
|
||||||
|
'PhameBlogSearchConduitAPIMethod' => 'applications/phame/conduit/PhameBlogSearchConduitAPIMethod.php',
|
||||||
'PhameBlogSearchEngine' => 'applications/phame/query/PhameBlogSearchEngine.php',
|
'PhameBlogSearchEngine' => 'applications/phame/query/PhameBlogSearchEngine.php',
|
||||||
'PhameBlogSite' => 'applications/phame/site/PhameBlogSite.php',
|
'PhameBlogSite' => 'applications/phame/site/PhameBlogSite.php',
|
||||||
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
|
'PhameBlogTransaction' => 'applications/phame/storage/PhameBlogTransaction.php',
|
||||||
|
@ -7846,6 +7847,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectInterface',
|
'PhabricatorProjectInterface',
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
'PhabricatorApplicationTransactionInterface',
|
'PhabricatorApplicationTransactionInterface',
|
||||||
|
'PhabricatorConduitResultInterface',
|
||||||
),
|
),
|
||||||
'PhameBlogArchiveController' => 'PhameBlogController',
|
'PhameBlogArchiveController' => 'PhameBlogController',
|
||||||
'PhameBlogController' => 'PhameController',
|
'PhameBlogController' => 'PhameController',
|
||||||
|
@ -7861,6 +7863,7 @@ phutil_register_library_map(array(
|
||||||
'PhameBlogProfilePictureController' => 'PhameBlogController',
|
'PhameBlogProfilePictureController' => 'PhameBlogController',
|
||||||
'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhameBlogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
'PhameBlogReplyHandler' => 'PhabricatorApplicationTransactionReplyHandler',
|
||||||
|
'PhameBlogSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
||||||
'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhameBlogSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhameBlogSite' => 'PhameSite',
|
'PhameBlogSite' => 'PhameSite',
|
||||||
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',
|
'PhameBlogTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
|
|
|
@ -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.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -8,7 +8,8 @@ final class PhameBlog extends PhameDAO
|
||||||
PhabricatorFlaggableInterface,
|
PhabricatorFlaggableInterface,
|
||||||
PhabricatorProjectInterface,
|
PhabricatorProjectInterface,
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorApplicationTransactionInterface {
|
PhabricatorApplicationTransactionInterface,
|
||||||
|
PhabricatorConduitResultInterface {
|
||||||
|
|
||||||
const MARKUP_FIELD_DESCRIPTION = 'markup:description';
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ abstract class PhabricatorSearchEngineAPIMethod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$maps) {
|
||||||
|
$maps = (object)$maps;
|
||||||
|
}
|
||||||
|
|
||||||
return $maps;
|
return $maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue