Documentation
¶
Overview ¶
Package conduit calls Phabricator's Conduit API: it encodes a method's parameters, authenticates the call and decodes Conduit's result envelope.
It holds one generic Call and no per-method wrappers. Each caller keeps its own typed requests and results and decides what a missing object means for it, so a method only one caller uses never lands here.
The API token travels inside the JSON parameters, as "__conduit__.token". Conduit ignores an "api.token" field once the parameters are JSON, so auth cannot be left to a transport the way it is for other HTTP APIs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls Conduit methods with one API token. It is safe for concurrent use.
func NewClient ¶
NewClient wraps httpClient, which must resolve relative paths against the Phabricator host (e.g. via platform/http.BaseURLTransport) and carries the caller's timeout and connection limits. token authenticates every call.
func (*Client) Call ¶
Call invokes method with params, which must encode as a JSON object (nil sends none), and decodes the result into result unless it is nil. A non-200 reply is a *platform/http.StatusError and a Conduit error_code is an *Error. A null result, or an empty array (PHP's encoding of an empty map), leaves result untouched.
type Error ¶
type Error struct {
// Code is Conduit's error_code, e.g. ERR-INVALID-SESSION.
Code string
// Info is Conduit's error_info, a human-readable description.
Info string
}
Error is a failure Conduit reports in its result envelope. Conduit answers such failures, including a missing or invalid token (ERR-INVALID-SESSION), with HTTP 200, so they never surface as a platform/http.StatusError.