You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow clients to provide an existing JWT to the API. With this option it is possible to create multiple API instances which share the same JWT token. Reduced access level for some methods and constructors based on their current usage.
Copy file name to clipboardExpand all lines: src/main/java/com/github/m0nk3y2k4/thetvdb/api/TheTVDBApi.java
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@
8
8
importjavax.annotation.Nonnull;
9
9
importjava.util.List;
10
10
importjava.util.Map;
11
+
importjava.util.Optional;
11
12
12
13
publicinterfaceTheTVDBApi {
13
14
@@ -20,6 +21,27 @@ public interface TheTVDBApi {
20
21
*/
21
22
voidinit() throwsAPIException;
22
23
24
+
/**
25
+
* Initializes the current API with the given token. This token will be used for authentication of all requests that are sent to the remote service by this API instance.
26
+
* The given string must be a valid Base64 encoded token in the regular JWT format <i>"{header}.{payload}.{signature}"</i>.
27
+
* <p/>
28
+
* If the given token is (or becomes) expired it will be replaced by a new JWT automatically. The new token will be requested from the remove service based
29
+
* on the constructor parameters used to create this API instance.
30
+
*
31
+
* @param token JSON Web Token to be used for remote API communication/authorization
32
+
*
33
+
* @throws APIException If the given string does not match the JSON Web Token format
34
+
*/
35
+
voidinit(@NonnullStringtoken) throwsAPIException;
36
+
37
+
/**
38
+
* Returns the JSON Web Token used for authentication of all requests that are sent to the remote service by this API instance. If the current API has not yet been
39
+
* initialized an empty <i>Optional</i> instance will be returned.
40
+
*
41
+
* @return The JWT used by this API or an empty <i>Optional</i> if the API has not been initialized
42
+
*/
43
+
Optional<String> getToken();
44
+
23
45
/**
24
46
* Sets the preferred language to be used for communication with the remote service. Some of the API calls might use this setting in order to only return results that
25
47
* match the given language. If available, the data returned by the remote API will be translated to the given language. The default language code is <b>"en"</b>. For a list
0 commit comments