Skip to content

Commit e0f6500

Browse files
committed
Renamed nested API interface for better readability.
1 parent a6b45dc commit e0f6500

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

src/main/java/com/github/m0nk3y2k4/thetvdb/api/TheTVDBApi.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public interface TheTVDBApi {
5656
* <p/>
5757
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Episodes/get_episodes_id">/episodes/{id}</a>
5858
*
59-
* @see TheTVDBApiJSON#getEpisode(long) TheTVDBApi.TheTVDBApiJSON.getEpisode(episodeId)
59+
* @see JSON#getEpisode(long) TheTVDBApi.JSON.getEpisode(episodeId)
6060
*
6161
* @param episodeId The ID of the episode
6262
*
@@ -72,7 +72,7 @@ public interface TheTVDBApi {
7272
* <p/>
7373
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Languages/get_languages">/languages</a>
7474
*
75-
* @see TheTVDBApiJSON#getAvailableLanguages()
75+
* @see JSON#getAvailableLanguages()
7676
*
7777
* @return List of available languages mapped as Java objects based on the JSON data returned by the remote service
7878
*
@@ -86,7 +86,7 @@ public interface TheTVDBApi {
8686
* <p/>
8787
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Languages/get_languages_id">/languages/{id}</a>
8888
*
89-
* @see TheTVDBApiJSON#getLanguage(long) TheTVDBApi.TheTVDBApiJSON.getLanguage(languageId)
89+
* @see JSON#getLanguage(long) TheTVDBApi.JSON.getLanguage(languageId)
9090
*
9191
* @param languageId The ID of the language
9292
*
@@ -102,7 +102,7 @@ public interface TheTVDBApi {
102102
* <p/>
103103
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Search/get_search_series">/search/series</a>
104104
*
105-
* @see TheTVDBApiJSON#searchSeries(QueryParameters) TheTVDBApi.TheTVDBApiJSON.searchSeries(queryParameters)
105+
* @see JSON#searchSeries(QueryParameters) TheTVDBApi.JSON.searchSeries(queryParameters)
106106
*
107107
* @param queryParameters Object containing key/value pairs of query search parameters. For a complete list of possible search parameters
108108
* see the API documentation or use {@link #getAvailableSeriesSearchParameters()}.
@@ -154,8 +154,8 @@ public interface TheTVDBApi {
154154
* <p/>
155155
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Search/get_search_series_params">/search/series/params</a>
156156
*
157-
* @see TheTVDBApiJSON#getAvailableSeriesSearchParameters()
158-
* @see TheTVDBApiJSON#searchSeries(QueryParameters) TheTVDBApi.TheTVDBApiJSON.searchSeries(queryParams)
157+
* @see JSON#getAvailableSeriesSearchParameters()
158+
* @see JSON#searchSeries(QueryParameters) TheTVDBApi.JSON.searchSeries(queryParams)
159159
* @see #searchSeries(QueryParameters) searchSeries(queryParams)
160160
*
161161
* @return List of possible parameters to query by in the series search
@@ -169,7 +169,7 @@ public interface TheTVDBApi {
169169
* <p/>
170170
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Series/get_series_id">/series/{id}</a>
171171
*
172-
* @see TheTVDBApiJSON#getSeries(long) TheTVDBApi.TheTVDBApiJSON.getSeries(seriesId)
172+
* @see JSON#getSeries(long) TheTVDBApi.JSON.getSeries(seriesId)
173173
*
174174
* @param seriesId The TheTVDB series ID
175175
*
@@ -185,7 +185,7 @@ public interface TheTVDBApi {
185185
* <p/>
186186
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Series/head_series_id">/series/{id}</a>
187187
*
188-
* @see TheTVDBApiJSON#getSeriesHeaderInformation(long) TheTVDBApi.TheTVDBApiJSON.getSeriesHeaderInformation(seriesId)
188+
* @see JSON#getSeriesHeaderInformation(long) TheTVDBApi.JSON.getSeriesHeaderInformation(seriesId)
189189
*
190190
* @param seriesId The TheTVDB series ID
191191
*
@@ -200,7 +200,7 @@ public interface TheTVDBApi {
200200
* <p/>
201201
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Series/get_series_id_actors">/series/{id}/actors</a>
202202
*
203-
* @see TheTVDBApiJSON#getActors(long) TheTVDBApi.TheTVDBApiJSON.getActors(seriesId)
203+
* @see JSON#getActors(long) TheTVDBApi.JSON.getActors(seriesId)
204204
*
205205
* @param seriesId The TheTVDB series ID
206206
*
@@ -216,7 +216,7 @@ public interface TheTVDBApi {
216216
* <p/>
217217
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Series/get_series_id_episodes">/series/{id}/episodes</a>
218218
*
219-
* @see TheTVDBApiJSON#getEpisodes(long, QueryParameters) TheTVDBApi.TheTVDBApiJSON.getEpisodes(seriesId, queryParameters)
219+
* @see JSON#getEpisodes(long, QueryParameters) TheTVDBApi.JSON.getEpisodes(seriesId, queryParameters)
220220
*
221221
* @param seriesId The TheTVDB series ID
222222
* @param queryParameters Object containing key/value pairs of query parameters. For a complete list of possible search parameters
@@ -265,7 +265,7 @@ public interface TheTVDBApi {
265265
* <p/>
266266
* <i>Corresponds to remote API route:</i> <a href="https://api.thetvdb.com/swagger#!/Series/get_series_id_episodes_query">/series/{id}/episodes/query</a>
267267
*
268-
* @see TheTVDBApiJSON#queryEpisodes(long, QueryParameters) TheTVDBApi.TheTVDBApiJSON.queryEpisodes(seriesId, queryParameters)
268+
* @see JSON#queryEpisodes(long, QueryParameters) TheTVDBApi.JSON.queryEpisodes(seriesId, queryParameters)
269269
*
270270
* @param seriesId The TheTVDB series ID
271271
* @param queryParameters Object containing key/value pairs of query parameters. For a complete list of possible search parameters
@@ -279,7 +279,7 @@ public interface TheTVDBApi {
279279

280280
/**
281281
* Returns all episodes of a specific series and season mapped as Java objects. Results will be paginated. Note that this method
282-
* is deterministic and will always return the <b>first</b> result page of the available episodes. This is a shortcut-method for {@link TheTVDBApiJSON#queryEpisodes(long, QueryParameters)}
282+
* is deterministic and will always return the <b>first</b> result page of the available episodes. This is a shortcut-method for {@link JSON#queryEpisodes(long, QueryParameters)}
283283
* with a single "airedSeason" query parameter.
284284
*
285285
* @see #queryEpisodesByAiredSeason(long, long, long) queryEpisodesByAiredSeason(seriesId, airedSeason, page)
@@ -295,7 +295,7 @@ public interface TheTVDBApi {
295295

296296
/**
297297
* Returns all episodes of a specific series and season mapped as Java objects. Results will be paginated. For seasons with
298-
* a high number of episodes use the <code>page</code> parameter to browse to a specific result page. This is a shortcut-method for {@link TheTVDBApiJSON#queryEpisodes(long, QueryParameters)}
298+
* a high number of episodes use the <code>page</code> parameter to browse to a specific result page. This is a shortcut-method for {@link JSON#queryEpisodes(long, QueryParameters)}
299299
* with a "airedSeason" and "page" query parameter.
300300
*
301301
* @see #queryEpisodesByAiredSeason(long, long) queryEpisodesByAiredSeason(seriesId, airedSeason)
@@ -312,7 +312,7 @@ public interface TheTVDBApi {
312312

313313
/**
314314
* Returns all episodes of a specific series, matching the <code>airedEpisode</code> parameter, mapped as Java objects. Results will be paginated.
315-
* This is a shortcut-method for {@link TheTVDBApiJSON#queryEpisodes(long, QueryParameters)} with a single "airedEpisode" query parameter.
315+
* This is a shortcut-method for {@link JSON#queryEpisodes(long, QueryParameters)} with a single "airedEpisode" query parameter.
316316
* <p/>
317317
* Note that an aired episode number might be associated with a specific season. If the series consists of more than one season this method will return the matching aired episodes
318318
* from all the seasons. Use {@link #queryEpisodesByAbsoluteNumber(long, long)} in order to query for a single episode.
@@ -330,7 +330,7 @@ public interface TheTVDBApi {
330330

331331
/**
332332
* Returns a specific episode of a series, mapped as Java object. Results will be paginated.
333-
* This is a shortcut-method for {@link TheTVDBApiJSON#queryEpisodes(long, QueryParameters)} with a single "absoluteNumber" query parameter.
333+
* This is a shortcut-method for {@link JSON#queryEpisodes(long, QueryParameters)} with a single "absoluteNumber" query parameter.
334334
* <p/>
335335
* Note that (unlike an aired episode number) an absolute episode number should most likely be unique throughout all episodes of a specific series. So in most cases the returned
336336
* list will consist of only one element. However, as the remote API doesn't give any guarantees that querying with an "absoluteNumber" parameter always returns one episode record
@@ -401,9 +401,9 @@ public interface TheTVDBApi {
401401

402402
List<Rating> addToRatings(@Nonnull String itemType, long itemId, long itemRating) throws APIException;
403403

404-
TheTVDBApiJSON json();
404+
JSON json();
405405

406-
interface TheTVDBApiJSON {
406+
interface JSON {
407407

408408
/**
409409
* Returns the full information for a given episode id as raw JSON.

src/main/java/com/github/m0nk3y2k4/thetvdb/internal/api/impl/TheTVDBApiImpl.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class TheTVDBApiImpl implements TheTVDBApi {
3131

3232
/** Wrapper API: Consolidates TheTVDB-API calls which return raw JSON */
33-
private final TheTVDBApiJSONImpl jsonApi;
33+
private final JSONApi jsonApi = new JSONApi();
3434

3535
/** The actual connection to the remote API */
3636
private final APIConnection con;
@@ -52,7 +52,6 @@ public TheTVDBApiImpl(@Nonnull String apiKey) {
5252
throw new IllegalArgumentException("APIKey must not be null or empty!");
5353
}
5454

55-
this.jsonApi = new TheTVDBApiJSONImpl();
5655
this.con = new APIConnection(apiKey);
5756
}
5857

@@ -70,7 +69,6 @@ public TheTVDBApiImpl(@Nonnull String apiKey, @Nonnull String userKey, @Nonnull
7069
throw new IllegalArgumentException("APIKey/UserKey/UserName must not be null or empty!");
7170
}
7271

73-
this.jsonApi = new TheTVDBApiJSONImpl();
7472
this.con = new APIConnection(apiKey, userKey, userName);
7573
}
7674

@@ -337,13 +335,13 @@ public List<Rating> addToRatings(@Nonnull String itemType, long itemId, long ite
337335
}
338336

339337
@Override
340-
public TheTVDBApiJSON json() {
338+
public JSON json() {
341339
return jsonApi;
342340
}
343341

344-
class TheTVDBApiJSONImpl implements TheTVDBApiJSON {
342+
private class JSONApi implements JSON {
345343

346-
TheTVDBApiJSONImpl() {}
344+
private JSONApi() {}
347345

348346
@Override
349347
public JsonNode getEpisode(long episodeId) throws APIException {

0 commit comments

Comments
 (0)