private ResultList < Genre > getGenreList ( String language , MethodSub sub ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . LANGUAGE , language ) ; URL url = new ApiUrl ( apiKey , MethodBase . GENRE ) . subMethod ( sub ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { WrapperGenres wrapper = MAPPER . readValue ( webpage , WrapperGenres . class ) ; ResultList < Genre > results = new ResultList <> ( wrapper . getGenres ( ) ) ; wrapper . setResultProperties ( results ) ; return results ; } catch ( IOException ex ) { throw new MovieDbException ( ApiExceptionType . MAPPING_FAILED , "Failed to get genre " + sub . toString ( ) , url , ex ) ; } }
Get the list of genres for movies or TV