Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F101921914
ReleephQueryBranchesConduitAPIMethod.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
Sat, Feb 15, 04:34
Size
1 KB
Mime Type
text/x-php
Expires
Mon, Feb 17, 04:34 (2 d)
Engine
blob
Format
Raw Data
Handle
24199287
Attached To
rPH Phabricator
ReleephQueryBranchesConduitAPIMethod.php
View Options
<?php
final
class
ReleephQueryBranchesConduitAPIMethod
extends
ReleephConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'releeph.querybranches'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Query information about Releeph branches.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional list<id>'
,
'phids'
=>
'optional list<phid>'
,
'productPHIDs'
=>
'optional list<phid>'
,
)
+
$this
->
getPagerParamTypes
();
}
protected
function
defineReturnType
()
{
return
'query-results'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$query
=
id
(
new
ReleephBranchQuery
())
->
setViewer
(
$viewer
);
$ids
=
$request
->
getValue
(
'ids'
);
if
(
$ids
!==
null
)
{
$query
->
withIDs
(
$ids
);
}
$phids
=
$request
->
getValue
(
'phids'
);
if
(
$phids
!==
null
)
{
$query
->
withPHIDs
(
$phids
);
}
$product_phids
=
$request
->
getValue
(
'productPHIDs'
);
if
(
$product_phids
!==
null
)
{
$query
->
withProductPHIDs
(
$product_phids
);
}
$pager
=
$this
->
newPager
(
$request
);
$branches
=
$query
->
executeWithCursorPager
(
$pager
);
$data
=
array
();
foreach
(
$branches
as
$branch
)
{
$id
=
$branch
->
getID
();
$uri
=
'/releeph/branch/'
.
$id
.
'/'
;
$uri
=
PhabricatorEnv
::
getProductionURI
(
$uri
);
$data
[]
=
array
(
'id'
=>
$id
,
'phid'
=>
$branch
->
getPHID
(),
'uri'
=>
$uri
,
'name'
=>
$branch
->
getName
(),
'productPHID'
=>
$branch
->
getProduct
()->
getPHID
(),
);
}
return
$this
->
addPagerResults
(
array
(
'data'
=>
$data
,
),
$pager
);
}
}
Event Timeline
Log In to Comment