Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F110147252
UserAddStatusConduitAPIMethod.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
Thu, Apr 24, 22:19
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Apr 26, 22:19 (2 d)
Engine
blob
Format
Raw Data
Handle
25789424
Attached To
rPH Phabricator
UserAddStatusConduitAPIMethod.php
View Options
<?php
final
class
UserAddStatusConduitAPIMethod
extends
UserConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'user.addstatus'
;
}
public
function
getMethodStatus
()
{
return
self
::
METHOD_STATUS_DEPRECATED
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Add status information to the logged-in user.'
);
}
public
function
getMethodStatusDescription
()
{
return
pht
(
'Statuses are becoming full-fledged events as part of the '
.
'Calendar application.'
);
}
protected
function
defineParamTypes
()
{
$status_const
=
$this
->
formatStringConstants
(
array
(
'away'
,
'sporadic'
));
return
array
(
'fromEpoch'
=>
'required int'
,
'toEpoch'
=>
'required int'
,
'status'
=>
'required '
.
$status_const
,
'description'
=>
'optional string'
,
);
}
protected
function
defineReturnType
()
{
return
'void'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-BAD-EPOCH'
=>
"'toEpoch' must be bigger than 'fromEpoch'."
,
'ERR-OVERLAP'
=>
'There must be no status in any part of the specified epoch.'
,
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$user_phid
=
$request
->
getUser
()->
getPHID
();
$from
=
$request
->
getValue
(
'fromEpoch'
);
$to
=
$request
->
getValue
(
'toEpoch'
);
$status
=
$request
->
getValue
(
'status'
);
$description
=
$request
->
getValue
(
'description'
,
''
);
id
(
new
PhabricatorCalendarEvent
())
->
setUserPHID
(
$user_phid
)
->
setDateFrom
(
$from
)
->
setDateTo
(
$to
)
->
setTextStatus
(
$status
)
->
setDescription
(
$description
)
->
save
();
}
}
Event Timeline
Log In to Comment