public NamespacesList < Namespace > getNamespaces ( String predicate , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; NamespacesList < Namespace > nsList = new NamespacesList < Namespace > ( ) ; parameters . put ( "method" , METHOD_GET_NAMESPACES ) ; if ( predicate != null ) { parameters . put ( "predicate" , predicate ) ; } if ( perPage > 0 ) { parameters . put ( "per_page" , "" + perPage ) ; } if ( page > 0 ) { parameters . put ( "page" , "" + page ) ; } Response response = transportAPI . get ( transportAPI . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element nsElement = response . getPayload ( ) ; NodeList nsNodes = nsElement . getElementsByTagName ( "namespace" ) ; nsList . setPage ( "1" ) ; nsList . setPages ( "1" ) ; nsList . setPerPage ( "" + nsNodes . getLength ( ) ) ; nsList . setTotal ( "" + nsNodes . getLength ( ) ) ; for ( int i = 0 ; i < nsNodes . getLength ( ) ; i ++ ) { Element element = ( Element ) nsNodes . item ( i ) ; nsList . add ( parseNamespace ( element ) ) ; } return nsList ; }
Return a list of unique namespaces optionally limited by a given predicate in alphabetical order .