Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97862205
ConduitAPI_differential_createrevision_Method.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Jan 6, 21:49
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jan 8, 21:49 (2 d)
Engine
blob
Format
Raw Data
Handle
23422192
Attached To
rPH Phabricator
ConduitAPI_differential_createrevision_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_differential_createrevision_Method
extends
ConduitAPIMethod
{
public
function
getMethodDescription
()
{
return
"Create a new Differential revision."
;
}
public
function
defineParamTypes
()
{
return
array
(
// TODO: Arcanist passes this; prevent fatals after D4191 until Conduit
// version 7 or newer.
'user'
=>
'ignored'
,
'diffid'
=>
'required diffid'
,
'fields'
=>
'required dict'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty dict'
;
}
public
function
defineErrorTypes
()
{
return
array
(
'ERR_BAD_DIFF'
=>
'Bad diff ID.'
,
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$fields
=
$request
->
getValue
(
'fields'
);
$diff
=
id
(
new
DifferentialDiffQuery
())
->
setViewer
(
$request
->
getUser
())
->
withIDs
(
array
(
$request
->
getValue
(
'diffid'
)))
->
executeOne
();
if
(!
$diff
)
{
throw
new
ConduitException
(
'ERR_BAD_DIFF'
);
}
$revision
=
DifferentialRevisionEditor
::
newRevisionFromConduitWithDiff
(
$fields
,
$diff
,
$request
->
getUser
());
return
array
(
'revisionid'
=>
$revision
->
getID
(),
'uri'
=>
PhabricatorEnv
::
getURI
(
'/D'
.
$revision
->
getID
()),
);
}
}
Event Timeline
Log In to Comment