Skip to content

Commit af5e56b

Browse files
authored
Changed indentation of Java code snippets inside the README.md
1 parent 5185809 commit af5e56b

File tree

1 file changed

+52
-52
lines changed

1 file changed

+52
-52
lines changed

README.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ In case your build tool isn't supported, or you're not using any build framework
148148
manually as _.jar_ file. The files (with and without dependencies) can either be obtained from the assets section of the
149149
corresponding [release](https://github.com/m0nk3y2k4/thetvdb-java-api/releases) or by cloning the repository and building
150150
the artifacts locally:
151-
```shell script
151+
```shell
152152
mvn clean install
153153
```
154154

@@ -163,13 +163,13 @@ instances, free configurable query parameters and proxies.
163163

164164
So let's create a new API instance using the factory methods.
165165
```java
166-
// "Simple" authentication with API-Key only
167-
TheTVDBApi api = TheTVDBApiFactory.createApi("API_KEY");
166+
// "Simple" authentication with API-Key only
167+
TheTVDBApi api = TheTVDBApiFactory.createApi("API_KEY");
168168

169-
// or...
169+
// or...
170170

171-
// "Advanced" authentication with API-Key, user key and user name
172-
TheTVDBApi usersApi = TheTVDBApiFactory.createApi("API_KEY", "Userkey", "Username");
171+
// "Advanced" authentication with API-Key, user key and user name
172+
TheTVDBApi usersApi = TheTVDBApiFactory.createApi("API_KEY", "Userkey", "Username");
173173
```
174174
>Please keep in mind that the _username_ and _key_ are **ONLY** required for the [/user](https://api.thetvdb.com/swagger#/Users)
175175
>routes.
@@ -179,17 +179,17 @@ foremost we have to invoke the _/login_ route once. This will induce the remote
179179
[JSON Web Token](https://en.wikipedia.org/wiki/JSON_Web_Token) which will be needed for further authentication. After we
180180
have successfully requested a JWT, we can now go on to actually retrieve some data from the API.
181181
```java
182-
api.login(); // We could also use "api.init()" which does exactly the same
182+
api.login(); // We could also use "api.init()" which does exactly the same
183183

184-
// Set the preferred language. If possible the remote API will return the requested data in this language
185-
// If not set, "en"' is the default
186-
api.setLanguage("it");
184+
// Set the preferred language. If possible the remote API will return the requested data in this language
185+
// If not set, "en"' is the default
186+
api.setLanguage("it");
187187

188-
// Alternatively: invoking the "/languages" endpoint will get us a list of all supported languages
189-
List<Language> allLanguages = api.getAvailableLanguages();
190-
Language italian = allLanguages.stream()
191-
.filter(l -> l.getName().equals("italiano")).findFirst().get();
192-
api.setLanguage(italian.getAbbreviation());
188+
// Alternatively: invoking the "/languages" endpoint will get us a list of all supported languages
189+
List<Language> allLanguages = api.getAvailableLanguages();
190+
Language italian = allLanguages.stream()
191+
.filter(l -> l.getName().equals("italiano")).findFirst().get();
192+
api.setLanguage(italian.getAbbreviation());
193193
```
194194
>The connector comes with some integrated auto-login functionality, which will automatically try to request a new JWT
195195
>in case the authorization failed. Although this might come in handy at times, it is **strongly recommended** to manually
@@ -203,16 +203,16 @@ usual object-oriented way.
203203
Finally, let's see how to query for specific information. Let's imagine we would like to get all episodes of season 3
204204
for a specific TV Series. We can do that by using a corresponding set of `QueryParameters`.
205205
```java
206-
long seriesID = 296762;
207-
QueryParameters query = TheTVDBApiFactory.createQueryParameters();
208-
query.addParameter(Query.Series.AIREDSEASON, "3");
206+
long seriesID = 296762;
207+
QueryParameters query = TheTVDBApiFactory.createQueryParameters();
208+
query.addParameter(Query.Series.AIREDSEASON, "3");
209209

210-
// Use your own custom set of query parameters
211-
List<Episode> seasonThree = api.queryEpisodes(seriesID, query);
210+
// Use your own custom set of query parameters
211+
List<Episode> seasonThree = api.queryEpisodes(seriesID, query);
212212

213-
System.out.println("Here come all the episodes of season 3:");
214-
seasonThree.stream().forEach(e -> System.out.println(
215-
e.getAiredSeason() + "." + e.getAiredEpisodeNumber() + ": " + e.getEpisodeName()));
213+
System.out.println("Here come all the episodes of season 3:");
214+
seasonThree.stream().forEach(e -> System.out.println(
215+
e.getAiredSeason() + "." + e.getAiredEpisodeNumber() + ": " + e.getEpisodeName()));
216216
```
217217
```
218218
Here come all the episodes of season 3:
@@ -225,13 +225,13 @@ Here come all the episodes of season 3:
225225
For certain use cases the connector provides additional shortcut methods. Querying for a specific season is one of them,
226226
so we could do the exact same example with even less code.
227227
```java
228-
long seriesID = 296762;
228+
long seriesID = 296762;
229229

230-
List<Episode> seasonThree = api.queryEpisodesByAiredSeason(seriesID, 3);
230+
List<Episode> seasonThree = api.queryEpisodesByAiredSeason(seriesID, 3);
231231

232-
System.out.println("And again, all the episodes of season 3:");
233-
seasonThree.stream().forEach(e -> System.out.println(
234-
e.getAiredSeason() + "." + e.getAiredEpisodeNumber() + ": " + e.getEpisodeName()));
232+
System.out.println("And again, all the episodes of season 3:");
233+
seasonThree.stream().forEach(e -> System.out.println(
234+
e.getAiredSeason() + "." + e.getAiredEpisodeNumber() + ": " + e.getEpisodeName()));
235235
```
236236
```
237237
And again, all the episodes of season 3:
@@ -254,17 +254,17 @@ If the prefabbed DTO's do not meet your requirements or if you prefer to take ca
254254
is the layout to go with. It supports all basic routes (without shortcut methods though) but instead of mapping the metadata
255255
into a DTO it will simply return the raw JSON as it was received from the remote API.
256256
```java
257-
// Create a new API instance the usual way
258-
TheTVDBApi api = TheTVDBApiFactory.createApi("API_KEY");
257+
// Create a new API instance the usual way
258+
TheTVDBApi api = TheTVDBApiFactory.createApi("API_KEY");
259259

260-
// Create a JSON layout from the existing API by invoking the "json()" method
261-
TheTVDBApi.JSON jsonApi = api.json();
260+
// Create a JSON layout from the existing API by invoking the "json()" method
261+
TheTVDBApi.JSON jsonApi = api.json();
262262

263-
long seriesID = 296762;
264-
QueryParameters query = TheTVDBApiFactory.createQueryParameters(Map.of(Query.Series.AIREDSEASON, "3"));
263+
long seriesID = 296762;
264+
QueryParameters query = TheTVDBApiFactory.createQueryParameters(Map.of(Query.Series.AIREDSEASON, "3"));
265265

266-
JsonNode seasonThreeJSON = jsonApi.queryEpisodes(seriesID, query);
267-
// jsonApi.queryEpisodesByAiredSeason(seriesID, 3); --> This wont work! Shortcut methods are only available in the default layout
266+
JsonNode seasonThreeJSON = jsonApi.queryEpisodes(seriesID, query);
267+
// jsonApi.queryEpisodesByAiredSeason(seriesID, 3); --> This wont work! Shortcut methods are only available in the default layout
268268
```
269269

270270
##### Extended layout
@@ -273,22 +273,22 @@ information received from the remote API, namely the "errors" and the "links" JS
273273
it supports all basic routes (without shortcut methods). All methods of this layout will return an `APIResponse<T>`
274274
object which wraps the actual metadata DTO together with the error and pagination information.
275275
```java
276-
// Again, create the layout from any existing API
277-
TheTVDBApi.Extended extendedApi = api.extended();
276+
// Again, create the layout from any existing API
277+
TheTVDBApi.Extended extendedApi = api.extended();
278278

279-
// Get the 2nd page of all episodes for this TV Series (max. 100 per page)
280-
final long page = 2;
281-
QueryParameters query = TheTVDBApiFactory.createQueryParameters()
282-
.addParameter(Query.Series.PAGE, String.valueOf(page));
279+
// Get the 2nd page of all episodes for this TV Series (max. 100 per page)
280+
final long page = 2;
281+
QueryParameters query = TheTVDBApiFactory.createQueryParameters()
282+
.addParameter(Query.Series.PAGE, String.valueOf(page));
283283

284-
APIResponse<List<Episode>> response = extendedApi.queryEpisodes(75760, query);
284+
APIResponse<List<Episode>> response = extendedApi.queryEpisodes(75760, query);
285285

286-
// Get the metadata. This is actually what the default layout does.
287-
List<Episode> episodesSecondPage = response.getData();
286+
// Get the metadata. This is actually what the default layout does.
287+
List<Episode> episodesSecondPage = response.getData();
288288

289-
// Errors and Links will not always be available and therefore will be returned as Optionals
290-
response.getErrors().map(Errors::getInvalidQueryParams).ifPresent(System.err::println);
291-
boolean morePages = response.getLinks().map(Links::getLast).map(lastPage -> lastPage > page).orElse(false);
289+
// Errors and Links will not always be available and therefore will be returned as Optionals
290+
response.getErrors().map(Errors::getInvalidQueryParams).ifPresent(System.err::println);
291+
boolean morePages = response.getLinks().map(Links::getLast).map(lastPage -> lastPage > page).orElse(false);
292292
```
293293
>Please note that _Errors_ and _Links_ are not always available but only for certain endpoints. See the _TheTVDB.com_ API
294294
>documentation for detailed information.
@@ -298,11 +298,11 @@ The connector will send all requests directly towards the _TheTVDB.com_ [RESTful
298298
your runtime environment is not able to access this resource directly, you can instruct the connector to send its requests
299299
to a different host which will forward them to the remote API.
300300
```java
301-
Proxy localProxy = TheTVDBApiFactory.createProxy("https", "my.local.proxy", 10000);
302-
TheTVDBApi proxiedApi = TheTVDBApiFactory.createApi("API_KEY", localProxy);
301+
Proxy localProxy = TheTVDBApiFactory.createProxy("https", "my.local.proxy", 10000);
302+
TheTVDBApi proxiedApi = TheTVDBApiFactory.createApi("API_KEY", localProxy);
303303

304-
// Data will be requested from "https://my.local.proxy:10000/movies/2559"
305-
Movie excellent = proxiedApi.getMovie(2559);
304+
// Data will be requested from "https://my.local.proxy:10000/movies/2559"
305+
Movie excellent = proxiedApi.getMovie(2559);
306306
```
307307

308308
## Development

0 commit comments

Comments
 (0)