Differential D20211 Diff 48257 src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/conduit/TransactionSearchConduitAPIMethod.php
| <?php | <?php | ||||
| final class TransactionSearchConduitAPIMethod | final class TransactionSearchConduitAPIMethod | ||||
| extends ConduitAPIMethod { | extends ConduitAPIMethod { | ||||
| public function getAPIMethodName() { | public function getAPIMethodName() { | ||||
| return 'transaction.search'; | return 'transaction.search'; | ||||
| } | } | ||||
| public function getMethodDescription() { | public function getMethodDescription() { | ||||
| return pht('Read transactions for an object.'); | return pht('Read transactions and comments for an object.'); | ||||
| } | } | ||||
| public function getMethodStatus() { | public function getMethodDocumentation() { | ||||
| return self::METHOD_STATUS_UNSTABLE; | $markup = pht(<<<EOREMARKUP | ||||
| } | When an object (like a task) is edited, Phabricator creates a "transaction" | ||||
| and applies it. This list of transactions on each object is the basis for | |||||
| essentially all edits and comments in Phabricator. Reviewing the transaction | |||||
| record allows you to see who edited an object, when, and how their edit changed | |||||
| things. | |||||
| One common reason to call this method is that you're implmenting a webhook and | |||||
| just received a notification that an object has changed. See the Webhooks | |||||
| documentation for more detailed discussion of this use case. | |||||
| Constraints | |||||
| =========== | |||||
| These constraints are supported: | |||||
| - `phids` //Optional list<phid>.// Find specific transactions by PHID. This | |||||
| is most likely to be useful if you're responding to a webhook notification | |||||
| and want to inspect only the related events. | |||||
| - `authorPHIDs` //Optional list<phid>.// Find transactions with particular | |||||
| authors. | |||||
| Transaction Format | |||||
| ================== | |||||
| Each transaction has custom data describing what the transaction did. The | |||||
| format varies from transaction to transaction. The easiest way to figure out | |||||
| exactly what a particular transaction looks like is to make the associated kind | |||||
| of edit to a test object, then query that object. | |||||
| Not all transactions have data: by default, transactions have a `null` "type" | |||||
| and no additional data. This API does not expose raw transaction data because | |||||
| some of it is internal, oddly named, misspelled, confusing, not useful, or | |||||
| could create security or policy problems to expose directly. | |||||
| New transactions are exposed (with correctly spelled, comprehensible types and | |||||
| useful, reasonable fields) as we become aware of use cases for them. | |||||
| EOREMARKUP | |||||
| ); | |||||
| $markup = $this->newRemarkupDocumentationView($markup); | |||||
| public function getMethodStatusDescription() { | return id(new PHUIObjectBoxView()) | ||||
| return pht('This method is new and experimental.'); | ->setCollapsed(true) | ||||
| ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | |||||
| ->setHeaderText(pht('Method Details')) | |||||
| ->appendChild($markup); | |||||
| } | } | ||||
| protected function defineParamTypes() { | protected function defineParamTypes() { | ||||
| return array( | return array( | ||||
| 'objectIdentifier' => 'phid|string', | 'objectIdentifier' => 'phid|string', | ||||
| 'constraints' => 'map<string, wild>', | 'constraints' => 'map<string, wild>', | ||||
| ) + $this->getPagerParamTypes(); | ) + $this->getPagerParamTypes(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines | |||||