3 final class ConduitAPIRequest
extends Phobject
{
7 private $isClusterRequest = false;
9 private $isStrictlyTyped = true;
11 public function __construct(array $params, $strictly_typed) {
12 $this->params
= $params;
13 $this->isStrictlyTyped
= $strictly_typed;
16 public function getValue($key, $default = null) {
17 return coalesce(idx($this->params
, $key), $default);
20 public function getValueExists($key) {
21 return array_key_exists($key, $this->params
);
24 public function getAllParameters() {
28 public function setUser(PhabricatorUser
$user) {
34 * Retrieve the authentic identity of the user making the request. If a
35 * method requires authentication (the default) the user object will always
36 * be available. If a method does not require authentication (i.e., overrides
37 * shouldRequireAuthentication() to return false) the user object will NEVER
40 * @return PhabricatorUser Authentic user, available ONLY if the method
41 * requires authentication.
43 public function getUser() {
47 'You can not access the user inside the implementation of a Conduit '.
48 'method which does not require authentication (as per %s).',
49 'shouldRequireAuthentication()'));
54 public function getViewer() {
55 return $this->getUser();
58 public function setOAuthToken(
59 PhabricatorOAuthServerAccessToken
$oauth_token) {
60 $this->oauthToken
= $oauth_token;
64 public function getOAuthToken() {
65 return $this->oauthToken
;
68 public function setIsClusterRequest($is_cluster_request) {
69 $this->isClusterRequest
= $is_cluster_request;
73 public function getIsClusterRequest() {
74 return $this->isClusterRequest
;
77 public function getIsStrictlyTyped() {
78 return $this->isStrictlyTyped
;
81 public function newContentSource() {
82 return PhabricatorContentSource
::newForSource(
83 PhabricatorConduitContentSource
::SOURCECONST
);