diff --git a/coil-network-core/api/android/coil-network-core.api b/coil-network-core/api/android/coil-network-core.api index 4e920ade60..49e75898c6 100644 --- a/coil-network-core/api/android/coil-network-core.api +++ b/coil-network-core/api/android/coil-network-core.api @@ -111,12 +111,17 @@ public final class coil3/network/NetworkHeaders$Companion { } public final class coil3/network/NetworkRequest { - public fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest; + public fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final synthetic fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)Lcoil3/network/NetworkRequest; public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILjava/lang/Object;)Lcoil3/network/NetworkRequest; + public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILjava/lang/Object;)Lcoil3/network/NetworkRequest; public fun equals (Ljava/lang/Object;)Z public final fun getBody ()Lcoil3/network/NetworkRequestBody; + public final fun getExtras ()Lcoil3/Extras; public final fun getHeaders ()Lcoil3/network/NetworkHeaders; public final fun getMethod ()Ljava/lang/String; public final fun getUrl ()Ljava/lang/String; diff --git a/coil-network-core/api/coil-network-core.klib.api b/coil-network-core/api/coil-network-core.klib.api index b7b3133389..11b3396b30 100644 --- a/coil-network-core/api/coil-network-core.klib.api +++ b/coil-network-core/api/coil-network-core.klib.api @@ -115,9 +115,12 @@ final class coil3.network/NetworkHeaders { // coil3.network/NetworkHeaders|null[ final class coil3.network/NetworkRequest { // coil3.network/NetworkRequest|null[0] constructor (kotlin/String, kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ...) // coil3.network/NetworkRequest.|(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?){}[0] + constructor (kotlin/String, kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ..., coil3/Extras = ...) // coil3.network/NetworkRequest.|(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?;coil3.Extras){}[0] final val body // coil3.network/NetworkRequest.body|{}body[0] final fun (): coil3.network/NetworkRequestBody? // coil3.network/NetworkRequest.body.|(){}[0] + final val extras // coil3.network/NetworkRequest.extras|{}extras[0] + final fun (): coil3/Extras // coil3.network/NetworkRequest.extras.|(){}[0] final val headers // coil3.network/NetworkRequest.headers|{}headers[0] final fun (): coil3.network/NetworkHeaders // coil3.network/NetworkRequest.headers.|(){}[0] final val method // coil3.network/NetworkRequest.method|{}method[0] @@ -126,6 +129,7 @@ final class coil3.network/NetworkRequest { // coil3.network/NetworkRequest|null[ final fun (): kotlin/String // coil3.network/NetworkRequest.url.|(){}[0] final fun copy(kotlin/String = ..., kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ...): coil3.network/NetworkRequest // coil3.network/NetworkRequest.copy|copy(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?){}[0] + final fun copy(kotlin/String = ..., kotlin/String = ..., coil3.network/NetworkHeaders = ..., coil3.network/NetworkRequestBody? = ..., coil3/Extras = ...): coil3.network/NetworkRequest // coil3.network/NetworkRequest.copy|copy(kotlin.String;kotlin.String;coil3.network.NetworkHeaders;coil3.network.NetworkRequestBody?;coil3.Extras){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // coil3.network/NetworkRequest.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // coil3.network/NetworkRequest.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // coil3.network/NetworkRequest.toString|toString(){}[0] diff --git a/coil-network-core/api/jvm/coil-network-core.api b/coil-network-core/api/jvm/coil-network-core.api index 08eb3c8214..dffce02b48 100644 --- a/coil-network-core/api/jvm/coil-network-core.api +++ b/coil-network-core/api/jvm/coil-network-core.api @@ -111,12 +111,17 @@ public final class coil3/network/NetworkHeaders$Companion { } public final class coil3/network/NetworkRequest { - public fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)V public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest; + public fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)V + public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final synthetic fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;)Lcoil3/network/NetworkRequest; + public final fun copy (Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;)Lcoil3/network/NetworkRequest; public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;ILjava/lang/Object;)Lcoil3/network/NetworkRequest; + public static synthetic fun copy$default (Lcoil3/network/NetworkRequest;Ljava/lang/String;Ljava/lang/String;Lcoil3/network/NetworkHeaders;Lcoil3/network/NetworkRequestBody;Lcoil3/Extras;ILjava/lang/Object;)Lcoil3/network/NetworkRequest; public fun equals (Ljava/lang/Object;)Z public final fun getBody ()Lcoil3/network/NetworkRequestBody; + public final fun getExtras ()Lcoil3/Extras; public final fun getHeaders ()Lcoil3/network/NetworkHeaders; public final fun getMethod ()Ljava/lang/String; public final fun getUrl ()Ljava/lang/String; diff --git a/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkClient.kt b/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkClient.kt index 634a363726..dece7e7ce6 100644 --- a/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkClient.kt +++ b/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkClient.kt @@ -1,5 +1,6 @@ package coil3.network +import coil3.Extras import coil3.annotation.Poko import coil3.network.internal.HTTP_METHOD_GET import coil3.network.internal.HTTP_RESPONSE_OK @@ -34,17 +35,42 @@ class NetworkRequest( val method: String = HTTP_METHOD_GET, val headers: NetworkHeaders = NetworkHeaders.EMPTY, val body: NetworkRequestBody? = null, + val extras: Extras = Extras.EMPTY, ) { fun copy( url: String = this.url, method: String = this.method, headers: NetworkHeaders = this.headers, body: NetworkRequestBody? = this.body, + extras: Extras = this.extras, ) = NetworkRequest( url = url, method = method, headers = headers, body = body, + extras = extras, + ) + + @Deprecated("Kept for binary compatibility.", level = DeprecationLevel.HIDDEN) + constructor( + url: String, + method: String = HTTP_METHOD_GET, + headers: NetworkHeaders = NetworkHeaders.EMPTY, + body: NetworkRequestBody? = null, + ) : this(url, method, headers, body) + + @Deprecated("Kept for binary compatibility.", level = DeprecationLevel.HIDDEN) + fun copy( + url: String = this.url, + method: String = this.method, + headers: NetworkHeaders = this.headers, + body: NetworkRequestBody? = this.body, + ) = NetworkRequest( + url = url, + method = method, + headers = headers, + body = body, + extras = this.extras, ) } diff --git a/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkFetcher.kt b/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkFetcher.kt index 32b7eda936..e05dac6744 100644 --- a/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkFetcher.kt +++ b/coil-network-core/src/commonMain/kotlin/coil3/network/NetworkFetcher.kt @@ -184,6 +184,7 @@ class NetworkFetcher( method = options.httpMethod, headers = headers.build(), body = options.httpBody, + extras = options.extras, ) } diff --git a/coil-network-core/src/commonTest/kotlin/coil3/network/NetworkFetcherTest.kt b/coil-network-core/src/commonTest/kotlin/coil3/network/NetworkFetcherTest.kt index 57e7d068de..3c44e7275b 100644 --- a/coil-network-core/src/commonTest/kotlin/coil3/network/NetworkFetcherTest.kt +++ b/coil-network-core/src/commonTest/kotlin/coil3/network/NetworkFetcherTest.kt @@ -49,7 +49,7 @@ class NetworkFetcherTest : RobolectricTest() { assertIs(result) - val expected = NetworkRequest(url, method, headers, body) + val expected = NetworkRequest(url, method, headers, body, options.extras) assertEquals(expected, networkClient.requests.single()) }