public NamespacesList < Pair > getPairs ( String namespace , String predicate , int perPage , int page ) throws FlickrException { Map < String , Object > parameters = new HashMap < String , Object > ( ) ; NamespacesList < Pair > nsList = new NamespacesList < Pair > ( ) ; parameters . put ( "method" , METHOD_GET_PAIRS ) ; if ( namespace != null ) { parameters . put ( "namespace" , namespace ) ; } 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 ( "pair" ) ; nsList . setPage ( nsElement . getAttribute ( "page" ) ) ; nsList . setPages ( nsElement . getAttribute ( "pages" ) ) ; nsList . setPerPage ( nsElement . getAttribute ( "perPage" ) ) ; nsList . setTotal ( "" + nsNodes . getLength ( ) ) ; for ( int i = 0 ; i < nsNodes . getLength ( ) ; i ++ ) { Element element = ( Element ) nsNodes . item ( i ) ; nsList . add ( parsePair ( element ) ) ; } return nsList ; }
Return a list of unique namespace and predicate pairs optionally limited by predicate or namespace in alphabetical order .