33class BricksetSnippetAPI extends ApiBase {
44
55 public function execute () {
6- $ id = $ this ->getMain ()->getVal ('id ' );
7- $ name = $ this ->getMain ()->getVal ('name ' );
6+ $ set = $ this ->getMain ()->getVal ('set ' );
87
9- $ title = BricksetSnippet::getTitle ( $ id , $ name );
10-
11- $ title = Title::newFromText ( '7965 Millennium Falcon ' );
8+ $ title = BricksetSnippet::getTitle ( $ set );
129
1310 if ( $ title ) {
1411
@@ -34,11 +31,7 @@ public function getDescription() {
3431
3532 public function getAllowedParams () {
3633 return array (
37- 'id ' => array (
38- ApiBase::PARAM_TYPE => 'string ' ,
39- ApiBase::PARAM_REQUIRED => true
40- ),
41- 'name ' => array (
34+ 'set ' => array (
4235 ApiBase::PARAM_TYPE => 'string ' ,
4336 ApiBase::PARAM_REQUIRED => true
4437 ),
@@ -47,14 +40,13 @@ public function getAllowedParams() {
4740
4841 public function getParamDescription () {
4942 return array (
50- 'id ' => 'The ID of the set to return ' ,
51- 'name ' => 'The name of the set to return '
43+ 'set ' => 'The set to search for ' ,
5244 );
5345 }
5446
5547 public function getExamples () {
5648 return array (
57- 'api.php?action=bricksetsnippet&id=4346&name=Robo_Pod&format=xml ' => 'Get the description for 4346 Robo Pod '
49+ 'api.php?action=bricksetsnippet&set=7965-1:%20Millennium%20Falcon ' => 'Get the description for 7965-1: Millennium Falcon '
5850 );
5951 }
6052}
0 commit comments