@@ -434,12 +434,15 @@ def deleteReleaseByIdOrName(self, app_folder, release_id_or_name, progress):
434434 .param ('app_revision' , 'The revision of the application.' , required = False )
435435 .param ('baseName' , 'The baseName of the extension' , required = False )
436436 .param ('q' , 'The search query.' , required = False )
437+ .param ('tier' , 'Tier of the extension.' , required = False , enum = [1 , 3 , 5 ])
438+ .param ('tier_compare' , 'Comparison type for the tier.' ,
439+ required = False , enum = ['exact' , 'lte' ], default = 'lte' )
437440 .pagingParams (defaultSort = 'created' , defaultSortDir = SortDir .DESCENDING )
438441 .errorResponse (),
439442 )
440443 @access .public (scope = TokenScope .DATA_READ )
441444 def getExtensions (self , app_id , extension_name , release_id , extension_id , os , arch ,
442- app_revision , baseName , q , limit , sort , offset = 0 ):
445+ app_revision , baseName , q , tier , tier_compare , limit , sort , offset = 0 ):
443446 """
444447 Get a list of extension which is filtered by some optional parameters. If the ``release_id``
445448 provided correspond to the draft release, then you must provide the app_revision to use
@@ -454,6 +457,8 @@ def getExtensions(self, app_id, extension_name, release_id, extension_id, os, ar
454457 :param app_revision: The revision of the application
455458 :param baseName: The baseName of the extension
456459 :param q: Text expected to be found in the extension name or description
460+ :param tier: Tier of the extension.
461+ :param tier_compare: Comparison type for the tier specified as "exact" or "lte" (less than or equal to).
457462 :return: The list of extensions
458463 """
459464 user = self .getCurrentUser ()
@@ -484,6 +489,12 @@ def getExtensions(self, app_id, extension_name, release_id, extension_id, os, ar
484489 {'meta.baseName' : {'$regex' : escaped_query , '$options' : 'i' }},
485490 {'meta.description' : {'$regex' : escaped_query , '$options' : 'i' }},
486491 ]
492+ if tier :
493+ if tier_compare == 'lte' :
494+ filters ['meta.tier' ] = {'$lte' : tier }
495+ else :
496+ # Provide an exact match base on tier
497+ filters ['meta.tier' ] = tier
487498 if ObjectId .is_valid (release_id ):
488499 release = self ._model .load (release_id , user = user , level = AccessType .READ )
489500 if release ['name' ] == constants .DRAFT_RELEASE_NAME :
@@ -563,7 +574,7 @@ def getExtensions(self, app_id, extension_name, release_id, extension_id, os, ar
563574 .param ('category' , 'Category under which to place the extension. Subcategories should be '
564575 'delimited by character. If none is passed, will render under '
565576 'the Miscellaneous category..' , required = False )
566-
577+ . param ( 'tier' , 'Tier of the extension.' , required = False , dataType = 'integer' )
567578 .param ('homepage' , 'The url of the extension homepage.' , required = False )
568579 .param ('screenshots' , 'Space-separate list of URLs of screenshots for the extension.' ,
569580 required = False )
@@ -579,7 +590,7 @@ def getExtensions(self, app_id, extension_name, release_id, extension_id, os, ar
579590 @access .user (scope = TokenScope .DATA_WRITE )
580591 def createOrUpdateExtension (self , app_id , os , arch , baseName , repository_type , repository_url ,
581592 revision , app_revision , description ,
582- icon_url , development_status , category , enabled , homepage ,
593+ icon_url , development_status , category , tier , enabled , homepage ,
583594 screenshots , contributors , dependency , license ):
584595 """
585596 Create or update an extension item.
@@ -600,6 +611,7 @@ def createOrUpdateExtension(self, app_id, os, arch, baseName, repository_type, r
600611 :param revision: The revision of the extension.
601612 :param app_revision: The revision of the application.
602613 :param description: The description of the extension.
614+ :param tier: Tier of the extension.
603615 :return: The created/updated extension.
604616 """
605617 creator = self .getCurrentUser ()
@@ -645,6 +657,8 @@ def createOrUpdateExtension(self, app_id, os, arch, baseName, repository_type, r
645657 params ['development_status' ] = development_status
646658 if category :
647659 params ['category' ] = category
660+ if tier :
661+ params ['tier' ] = tier
648662 if enabled :
649663 params ['enabled' ] = enabled
650664 if homepage :
0 commit comments