Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F1369443
ReleephQueryProdutsConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
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
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jul 7, 3:15 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
322293
Default Alt Text
ReleephQueryProdutsConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment