MediaService { public Observable<MediaContainer> browse(HttpUrl url, String libKey, String mediaKey, int offset) { return api.get(url.newBuilder() .addPathSegments("library/sections") .addPathSegment(libKey) .addPathSegment("all") .query("sort=titleSort:asc&X-Plex-Container-Size=50") .addQueryParameter("type", mediaKey) .addQueryParameter("X-Plex-Container-Start", String.valueOf(offset)) .addQueryParameter(TOKEN, url.queryParameter(TOKEN)) .build()); } MediaService(Api api); Observable<MediaContainer> sections(HttpUrl url); Observable<MediaContainer> albums(HttpUrl url, String artistKey); Observable<MediaContainer> tracks(HttpUrl url, String albumKey); Observable<MediaContainer> popularTracks(HttpUrl url, String libKey, String artistKey); Observable<MediaContainer> browse(HttpUrl url, String libKey, String mediaKey,
                                           int offset); Observable<MediaContainer> recentArtists(HttpUrl url, String libKey); Observable<MediaContainer> firstCharacter(HttpUrl url, String libKey, String mediaKey); Completable timeline(HttpUrl url, long queueItemId, String trackKey, String trackRatingKey,
                              String state, long duration, long time); Single<MediaContainer> playQueue(HttpUrl url, String trackKey, String trackParentKey,
                                          String libraryId);  }
@Test public void browse() { media.browse(URL, "libKey", "mediaKey", 100); assertThat(api.actual, is("https: "&X-Plex-Container-Size=50&type=mediaKey&X-Plex-Container-Start=100&X-Plex-Token=token")); }