Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102538449
ReleephQueryProdutsConduitAPIMethod.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
Fri, Feb 21, 18:59
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Feb 23, 18:59 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24288169
Attached To
rPH Phabricator
ReleephQueryProdutsConduitAPIMethod.php
View Options
<?php
final
class
ReleephQueryProductsConduitAPIMethod
extends
ReleephConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'releeph.queryproducts'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Query information about Releeph products.'
);
}
public
function
defineParamTypes
()
{
return
array
(
'ids'
=>
'optional list<id>'
,
'phids'
=>
'optional list<phid>'
,
'repositoryPHIDs'
=>
'optional list<phid>'
,
'isActive'
=>
'optional bool'
,
)
+
$this
->
getPagerParamTypes
();
}
public
function
defineReturnType
()
{
return
'query-results'
;
}
public
function
defineErrorTypes
()
{
return
array
();
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$query
=
id
(
new
ReleephProductQuery
())
->
setViewer
(
$viewer
);
$ids
=
$request
->
getValue
(
'ids'
);
if
(
$ids
!==
null
)
{
$query
->
withIDs
(
$ids
);
}
$phids
=
$request
->
getValue
(
'phids'
);
if
(
$phids
!==
null
)
{
$query
->
withPHIDs
(
$phids
);
}
$repository_phids
=
$request
->
getValue
(
'repositoryPHIDs'
);
if
(
$repository_phids
!==
null
)
{
$query
->
withRepositoryPHIDs
(
$repository_phids
);
}
$is_active
=
$request
->
getValue
(
'isActive'
);
if
(
$is_active
!==
null
)
{
$query
->
withActive
(
$is_active
);
}
$pager
=
$this
->
newPager
(
$request
);
$products
=
$query
->
executeWithCursorPager
(
$pager
);
$data
=
array
();
foreach
(
$products
as
$product
)
{
$id
=
$product
->
getID
();
$uri
=
'/releeph/product/'
.
$id
.
'/'
;
$uri
=
PhabricatorEnv
::
getProductionURI
(
$uri
);
$data
[]
=
array
(
'id'
=>
$id
,
'phid'
=>
$product
->
getPHID
(),
'uri'
=>
$uri
,
'name'
=>
$product
->
getName
(),
'isActive'
=>
(
bool
)
$product
->
getIsActive
(),
'repositoryPHID'
=>
$product
->
getRepositoryPHID
(),
);
}
return
$this
->
addPagerResults
(
array
(
'data'
=>
$data
,
),
$pager
);
}
}
Event Timeline
Log In to Comment