-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be7a7b3
commit 201972e
Showing
5 changed files
with
78 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
data/network/src/main/java/io/filmtime/data/network/annotation/TraktApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.filmtime.data.network.annotation | ||
|
||
import javax.inject.Qualifier | ||
|
||
@Qualifier | ||
@Target( | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.VALUE_PARAMETER, | ||
) | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class TraktNetwork | ||
|
||
|
||
@Qualifier | ||
@Target( | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.VALUE_PARAMETER, | ||
) | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class TraktOkHttp | ||
|
||
@Qualifier | ||
@Target( | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY_GETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.VALUE_PARAMETER, | ||
) | ||
@Retention(AnnotationRetention.BINARY) | ||
annotation class TraktHeaderInterceptor |
18 changes: 18 additions & 0 deletions
18
data/network/src/main/java/io/filmtime/data/network/interceptor/TraktHeadersInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package io.filmtime.data.network.interceptor | ||
|
||
import io.filmtime.data.network.BuildConfig | ||
import okhttp3.Interceptor | ||
import okhttp3.Request | ||
import okhttp3.Response | ||
|
||
class TraktHeadersInterceptor : Interceptor { | ||
override fun intercept(chain: Interceptor.Chain): Response { | ||
val original = chain.request() | ||
val requestBuilder: Request.Builder = original.newBuilder() | ||
.header("trakt-api-key", BuildConfig.TRAKT_CLIENT_ID) | ||
.header("trakt-api-version", "2") | ||
|
||
val request: Request = requestBuilder.build() | ||
return chain.proceed(request) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters