Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ImageUrl in favor of a regular String #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -17,12 +16,12 @@ data class Channel(
override val title: String,
override val lead: String? = null,
override val description: String? = null,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val imageFocalPoint: FocalPoint? = null,
override val imageTitle: String? = null,
override val imageCopyright: String? = null,
override val transmission: Transmission,
override val timeTableUrl: String? = null,
@SerialName("imageUrlRaw")
override val rawImageUrl: ImageUrl? = null
override val rawImageUrl: String? = null
) : SRGChannelMetadata
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -23,7 +22,7 @@ data class Chapter(
override val title: String,
override val lead: String? = null,
override val description: String? = null,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val imageTitle: String? = null,
override val imageCopyright: String? = null,
override val blockReason: BlockReason? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
Expand All @@ -17,7 +16,7 @@ import java.util.Date
data class Episode(
val id: String,
override val title: String,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val lead: String? = null,
override val description: String? = null,
override val imageTitle: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -24,7 +23,7 @@ data class Media(
override val type: Type,
override val date: Date,
override val duration: Long,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val imageFocalPoint: FocalPoint? = null,
override val lead: String? = null,
override val description: String? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

Expand All @@ -17,15 +16,14 @@ data class NowAndNext(
override val title: String,
override val lead: String? = null,
override val description: String? = null,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val imageFocalPoint: FocalPoint? = null,
override val imageTitle: String? = null,
override val imageCopyright: String? = null,
override val transmission: Transmission,
override val timeTableUrl: String? = null,
@SerialName("imageUrlRaw")
override val rawImageUrl: ImageUrl? = null,
override val rawImageUrl: String? = null,
val now: Program? = null,
val next: Program? = null
) :
SRGChannelMetadata
) : SRGChannelMetadata
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -21,7 +20,7 @@ data class Program(
val endTime: Date,
override val lead: String? = null,
override val description: String? = null,
val imageUrl: ImageUrl? = null,
val imageUrl: String? = null,
val imageFocalPoint: FocalPoint? = null,
val imageTitle: String? = null,
val imageCopyright: String? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import kotlinx.serialization.Serializable

/**
Expand Down Expand Up @@ -31,7 +30,7 @@ data class Representation(
val pickRandomElement: Boolean
get() = properties?.pickRandomElement == true

val imageUrl: ImageUrl?
val imageUrl: String?
get() = properties?.imageUrl

val imageFocalPoint: FocalPoint?
Expand All @@ -47,7 +46,7 @@ data class Representation(
val label: String? = null,
val hasDetailPage: Boolean? = null,
val pickRandomElement: Boolean? = null,
val imageUrl: ImageUrl? = null,
val imageUrl: String? = null,
val imageFocalPoint: FocalPoint? = null,
val link: Link? = null,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl

/**
* Copyright (c) SRG SSR. All rights reserved.
* <p>
Expand All @@ -23,7 +21,7 @@ interface SRGMetadata {
}

interface SRGImageMetadata {
val imageUrl: ImageUrl
val imageUrl: String
val imageTitle: String?
val imageCopyright: String?
val imageFocalPoint: FocalPoint?
Expand All @@ -32,5 +30,5 @@ interface SRGImageMetadata {
interface SRGChannelMetadata : SRGIdentifierMetadata, SRGMetadata, SRGImageMetadata {
val transmission: Transmission
val timeTableUrl: String?
val rawImageUrl: ImageUrl?
val rawImageUrl: String?
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand Down Expand Up @@ -36,7 +35,7 @@ data class Segment @JvmOverloads constructor(
override val playableAbroad: Boolean,
override val lead: String? = null,
override val description: String? = null,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val imageFocalPoint: FocalPoint? = null,
override val imageTitle: String? = null,
override val imageCopyright: String? = null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import kotlinx.serialization.Serializable

/**
Expand All @@ -15,17 +14,17 @@ data class Show(
val transmission: Transmission,
override val urn: String,
override val title: String,
override val imageUrl: ImageUrl,
override val imageUrl: String,
override val lead: String? = null,
override val description: String? = null,
val primaryChannelUrn: String? = null,
val primaryChannelId: String? = null,
override val imageFocalPoint: FocalPoint? = null,
override val imageTitle: String? = null,
override val imageCopyright: String? = null,
val bannerImageUrl: ImageUrl? = null,
val posterImageUrl: ImageUrl? = null,
val podcastImageUrl: ImageUrl? = null,
val bannerImageUrl: String? = null,
val posterImageUrl: String? = null,
val podcastImageUrl: String? = null,
val podcastSubscriptionUrl: String? = null,
val podcastFeedSdUrl: String? = null,
val podcastFeedHdUrl: String? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.serializer.DateSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.UseSerializers
Expand All @@ -26,8 +25,8 @@ data class Song(
@Serializable
data class Cd(
val name: String,
val coverUrlSmall: ImageUrl? = null,
val coverUrlLarge: ImageUrl? = null
val coverUrlSmall: String? = null,
val coverUrlLarge: String? = null
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ch.srg.dataProvider.integrationlayer.data.remote

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import kotlinx.serialization.Serializable

/**
Expand All @@ -18,7 +17,7 @@ data class Topic(
override val lead: String? = null,
override val description: String? = null,
val viewedMedias: Int? = null,
val imageUrl: ImageUrl? = null,
val imageUrl: String? = null,
val imageTitle: String? = null,
val imageFocalPoint: FocalPoint? = null,
val imageCopyright: String? = null,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
package ch.srg.dataProvider.integrationlayer.request.image

import ch.srg.dataProvider.integrationlayer.data.ImageUrl
import ch.srg.dataProvider.integrationlayer.data.ImageUrlDecorator
import ch.srg.dataProvider.integrationlayer.request.IlHost

@JvmOverloads
fun ImageUrl.decorated(widthPixels: Int, ilHost: IlHost = IlHost.PROD): String {
fun String.decorated(widthPixels: Int, ilHost: IlHost = IlHost.PROD): String {
return decorated(ImageUrlDecoratorInstances.getOrCreate(ilHost), widthPixels)
}

@JvmOverloads
fun ImageUrl.decorated(width: ImageWidth, ilHost: IlHost = IlHost.PROD): String {
fun String.decorated(width: ImageWidth, ilHost: IlHost = IlHost.PROD): String {
return decorated(widthPixels = width.widthPixels, ilHost = ilHost)
}

@JvmOverloads
fun ImageUrl.decorated(imageSize: ImageSize, ilHost: IlHost = IlHost.PROD): String {
fun String.decorated(imageSize: ImageSize, ilHost: IlHost = IlHost.PROD): String {
return decorated(width = imageSize.width, ilHost = ilHost)
}

fun ImageUrl.decorated(decorator: ImageUrlDecorator, width: ImageWidth): String {
fun String.decorated(decorator: ImageUrlDecorator, widthPixels: Int): String {
return decorator.decorate(this, widthPixels)
}

fun String.decorated(decorator: ImageUrlDecorator, width: ImageWidth): String {
return decorated(decorator, width.widthPixels)
}

fun ImageUrl.decorated(decorator: ImageUrlDecorator, imageSize: ImageSize): String {
fun String.decorated(decorator: ImageUrlDecorator, imageSize: ImageSize): String {
return decorated(decorator, imageSize.width)
}

Expand Down
Loading
Loading