Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14062110
D8794.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D8794.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -190,6 +190,7 @@
'ConduitAPI_flag_edit_Method' => 'applications/flag/conduit/ConduitAPI_flag_edit_Method.php',
'ConduitAPI_flag_query_Method' => 'applications/flag/conduit/ConduitAPI_flag_query_Method.php',
'ConduitAPI_harbormaster_Method' => 'applications/harbormaster/conduit/ConduitAPI_harbormaster_Method.php',
+ 'ConduitAPI_harbormaster_querybuildables_Method' => 'applications/harbormaster/conduit/ConduitAPI_harbormaster_querybuildables_Method.php',
'ConduitAPI_harbormaster_sendmessage_Method' => 'applications/harbormaster/conduit/ConduitAPI_harbormaster_sendmessage_Method.php',
'ConduitAPI_macro_Method' => 'applications/macro/conduit/ConduitAPI_macro_Method.php',
'ConduitAPI_macro_creatememe_Method' => 'applications/macro/conduit/ConduitAPI_macro_creatememe_Method.php',
@@ -2779,6 +2780,7 @@
'ConduitAPI_flag_edit_Method' => 'ConduitAPI_flag_Method',
'ConduitAPI_flag_query_Method' => 'ConduitAPI_flag_Method',
'ConduitAPI_harbormaster_Method' => 'ConduitAPIMethod',
+ 'ConduitAPI_harbormaster_querybuildables_Method' => 'ConduitAPI_harbormaster_Method',
'ConduitAPI_harbormaster_sendmessage_Method' => 'ConduitAPI_harbormaster_Method',
'ConduitAPI_macro_Method' => 'ConduitAPIMethod',
'ConduitAPI_macro_creatememe_Method' => 'ConduitAPI_macro_Method',
diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php
--- a/src/applications/conduit/method/ConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitAPIMethod.php
@@ -216,7 +216,7 @@
$results['cursor'] = array(
'limit' => $pager->getPageSize(),
'after' => $pager->getNextPageID(),
- 'before' =>$pager->getPrevPageID(),
+ 'before' => $pager->getPrevPageID(),
);
return $results;
diff --git a/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_querybuildables_Method.php b/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_querybuildables_Method.php
new file mode 100644
--- /dev/null
+++ b/src/applications/harbormaster/conduit/ConduitAPI_harbormaster_querybuildables_Method.php
@@ -0,0 +1,86 @@
+<?php
+
+final class ConduitAPI_harbormaster_querybuildables_Method
+ extends ConduitAPI_harbormaster_Method {
+
+ public function getMethodDescription() {
+ return pht('Query Harbormaster buildables.');
+ }
+
+ public function defineParamTypes() {
+ return array(
+ 'ids' => 'optional list<id>',
+ 'phids' => 'optional list<phid>',
+ 'buildablePHIDs' => 'optional list<phid>',
+ 'containerPHIDs' => 'optional list<phid>',
+ 'manualBuildables' => 'optional bool',
+ ) + self::getPagerParamTypes();
+ }
+
+ public function defineReturnType() {
+ return 'wild';
+ }
+
+ public function defineErrorTypes() {
+ return array();
+ }
+
+ protected function execute(ConduitAPIRequest $request) {
+ $viewer = $request->getUser();
+
+ $query = id(new HarbormasterBuildableQuery())
+ ->setViewer($viewer);
+
+ $ids = $request->getValue('ids');
+ if ($ids !== null) {
+ $query->withIDs($ids);
+ }
+
+ $phids = $request->getValue('phids');
+ if ($phids !== null) {
+ $query->withPHIDs($phids);
+ }
+
+ $buildable_phids = $request->getValue('buildablePHIDs');
+ if ($buildable_phids !== null) {
+ $query->withBuildablePHIDs($buildable_phids);
+ }
+
+ $container_phids = $request->getValue('containerPHIDs');
+ if ($container_phids !== null) {
+ $query->withContainerPHIDs($container_phids);
+ }
+
+ $manual = $request->getValue('manualBuildables');
+ if ($manual !== null) {
+ $query->withManualBuildables($manual);
+ }
+
+ $pager = $this->newPager($request);
+
+ $buildables = $query->executeWithCursorPager($pager);
+
+ $data = array();
+ foreach ($buildables as $buildable) {
+ $monogram = $buildable->getMonogram();
+
+ $data[] = array(
+ 'id' => $buildable->getID(),
+ 'phid' => $buildable->getPHID(),
+ 'monogram' => $monogram,
+ 'uri' => PhabricatorEnv::getProductionURI('/'.$monogram),
+ 'buildablePHID' => $buildable->getBuildablePHID(),
+ 'containerPHID' => $buildable->getContainerPHID(),
+ 'isManualBuildable' => (bool)$buildable->getIsManualBuildable(),
+ );
+ }
+
+ $results = array(
+ 'data' => $data,
+ );
+
+ $results = $this->addPagerResults($results, $pager);
+ return $results;
+ }
+
+}
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableQuery.php b/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableQuery.php
@@ -175,28 +175,28 @@
private function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
$conn_r,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
$conn_r,
'phid IN (%Ls)',
$this->phids);
}
- if ($this->buildablePHIDs) {
+ if ($this->buildablePHIDs !== null) {
$where[] = qsprintf(
$conn_r,
'buildablePHID IN (%Ls)',
$this->buildablePHIDs);
}
- if ($this->containerPHIDs) {
+ if ($this->containerPHIDs !== null) {
$where[] = qsprintf(
$conn_r,
'containerPHID in (%Ls)',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 10:34 AM (2 h, 57 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6727854
Default Alt Text
D8794.diff (5 KB)
Attached To
Mode
D8794: Add a rough `harbormaster.querybuildables` Conduit API method
Attached
Detach File
Event Timeline
Log In to Comment