mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
Provide basic Conduit documentation.
This commit is contained in:
parent
f2cedd8108
commit
a5e22e87e2
44 changed files with 185 additions and 0 deletions
|
@ -12,6 +12,7 @@
|
|||
"diffusion" : "Diffusion (Repository Browser)",
|
||||
"maniphest" : "Maniphest (Task Tracking)",
|
||||
"herald" : "Herald (Notifications)",
|
||||
"conduit" : "Conduit (Phabricator HTTP API)",
|
||||
"celerity" : "Celerity (CSS/JS Management)",
|
||||
"aphront" : "Aphront (Web Stack)",
|
||||
"console" : "DarkConsole (Debugging Console)",
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitAPIController
|
||||
extends PhabricatorConduitController {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
abstract class PhabricatorConduitController extends PhabricatorController {
|
||||
|
||||
public function buildStandardPageResponse($view, array $data) {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitConsoleController
|
||||
extends PhabricatorConduitController {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitLogController extends PhabricatorConduitController {
|
||||
|
||||
public function processRequest() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitTokenController extends PhabricatorConduitController {
|
||||
|
||||
public function processRequest() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
abstract class ConduitAPIMethod {
|
||||
|
||||
abstract public function getMethodDescription();
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_conduit_connect_Method extends ConduitAPIMethod {
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_conduit_getcertificate_Method extends ConduitAPIMethod {
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_conduit_ping_Method extends ConduitAPIMethod {
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_daemon_launched_Method extends ConduitAPIMethod {
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_daemon_log_Method extends ConduitAPIMethod {
|
||||
|
||||
public function shouldRequireAuthentication() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_creatediff_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_createrevision_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_find_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getalldiffs_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getcommitmessage_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getcommitpaths_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getdiff_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getrevision_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_getrevisionfeedback_Method
|
||||
extends ConduitAPIMethod {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_markcommitted_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_parsecommitmessage_Method
|
||||
extends ConduitAPIMethod {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_setdiffproperty_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_updaterevision_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,8 +16,12 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_updatetaskrevisionassoc_Method
|
||||
extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
return "Given a task together with its original and new associated ".
|
||||
"revisions, update the revisions for their attached_tasks.";
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_differential_updateunitresults_Method
|
||||
extends ConduitAPIMethod {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_diffusion_getcommits_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_diffusion_getrecentcommitsbypath_Method
|
||||
extends ConduitAPIMethod {
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_file_download_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_file_upload_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_maniphest_info_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_paste_info_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_path_getowners_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_user_find_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPI_user_whoami_Method extends ConduitAPIMethod {
|
||||
|
||||
public function getMethodDescription() {
|
||||
|
|
|
@ -16,5 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitException extends Exception {
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class ConduitAPIRequest {
|
||||
|
||||
protected $params;
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
abstract class PhabricatorConduitDAO extends PhabricatorLiskDAO {
|
||||
|
||||
public function getApplicationName() {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitConnectionLog extends PhabricatorConduitDAO {
|
||||
|
||||
protected $client;
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitMethodCallLog extends PhabricatorConduitDAO {
|
||||
|
||||
protected $connectionID;
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @group conduit
|
||||
*/
|
||||
class PhabricatorConduitCertificateToken extends PhabricatorConduitDAO {
|
||||
|
||||
protected $userPHID;
|
||||
|
|
57
src/docs/technical/conduit.diviner
Normal file
57
src/docs/technical/conduit.diviner
Normal file
|
@ -0,0 +1,57 @@
|
|||
@title Conduit Technical Documentation
|
||||
@group conduit
|
||||
|
||||
Technical overview of the Conduit API.
|
||||
|
||||
= Overview =
|
||||
|
||||
Conduit is an informal mechanism for transferring ad-hoc JSON blobs around on
|
||||
the internet.
|
||||
|
||||
Theoretically, it provides an API to Phabricator so external scripts (including
|
||||
scripts written in other languages) can interface with the applications in the
|
||||
Phabricator suite. It technically does this, sort of, but it is unstable and
|
||||
incomplete so you should keep your expectations very low if you choose to build
|
||||
things on top of it.
|
||||
|
||||
NOTE: Hopefully, this should improve over time, but making Conduit more robust
|
||||
isn't currently a major project priority because there isn't much demand for it
|
||||
outside of internal scripts. If you want to use Conduit to build things on top
|
||||
of Phabricator, let us know so we can adjust priorities.
|
||||
|
||||
Conduit provides an authenticated HTTP API for Phabricator. It is informal and
|
||||
extremely simple: you post a JSON blob and you get a JSON blob back. You can
|
||||
access Conduit in PHP with @{class@libphutil:ConduitClient}, or in any language
|
||||
by executing ##arc call-conduit method## (see ##arc help call-conduit## for
|
||||
more information). You can see and test available methods at ##/conduit/## in
|
||||
the web interface.
|
||||
|
||||
Arcanist is implemented using Conduit, and @{class:PhabricatorIRCBot} is
|
||||
intended as a practical example of how to write a program which interfaces with
|
||||
Phabricator over Conduit.
|
||||
|
||||
= Class Relationships =
|
||||
|
||||
The primary Conduit workflow is exposed at ##/api/##, which routes to
|
||||
@{class:PhabricatorConduitAPIController}. This controller builds a
|
||||
@{class:ConduitAPIRequest} representing authentication information and POST
|
||||
parameters, instantiates an appropriate subclass of @{class:ConduitAPIMethod},
|
||||
and passes the request to it. Subclasses of @{class:ConduitAPIMethod} implement
|
||||
the actual methods which Conduit exposes.
|
||||
|
||||
Conduit calls which fail throw @{class:ConduitException}, which the controller
|
||||
handles.
|
||||
|
||||
There is a web interface for viewing and testing Conduit called the "Conduit
|
||||
Console", implemented by @{class:PhabricatorConduitConsoleController} at
|
||||
##/conduit/##.
|
||||
|
||||
A log of connections and calls is stored by
|
||||
@{class:PhabriatorConduitConnectionLog} and
|
||||
@{class:PhabricatorConduitMethodCallLog}, and can be accessed on the web via
|
||||
@{class:PhabricatorConduitLogController} at ##/conduit/log/##.
|
||||
|
||||
Conduit provides a token-based handshake mechanism used by
|
||||
##arc install-certificate## at ##/conduit/token/##, implemented by
|
||||
@{class:PhabricatorConduitTokenController} which stores generated tokens using
|
||||
@{class:PhabricatorConduitCertificateToken}.
|
|
@ -57,6 +57,9 @@ function queryfx_one($conn, $sql/*, ... */) {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @group storage
|
||||
*/
|
||||
function vqueryfx_all($conn, $sql, array $argv) {
|
||||
array_unshift($argv, $conn, $sql);
|
||||
call_user_func_array('queryfx', $argv);
|
||||
|
|
Loading…
Reference in a new issue