mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 08:13:49 +00:00
deprecate BodyPair
This commit is contained in:
parent
8250a2a021
commit
d4c5e849bf
@ -2,6 +2,10 @@
|
||||
|
||||
## 0.11.11
|
||||
|
||||
* `Ktor`:
|
||||
* `Client`:
|
||||
* `BodyPair` has been deprecated
|
||||
|
||||
## 0.11.10
|
||||
|
||||
* `Repos`:
|
||||
|
@ -12,6 +12,7 @@ import io.ktor.http.*
|
||||
import io.ktor.utils.io.core.ByteReadPacket
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Deprecated("This class will be removed in next")
|
||||
typealias BodyPair<T> = Pair<SerializationStrategy<T>, T>
|
||||
|
||||
class UnifiedRequester(
|
||||
@ -33,7 +34,7 @@ class UnifiedRequester(
|
||||
|
||||
suspend fun <BodyType, ResultType> unipost(
|
||||
url: String,
|
||||
bodyInfo: BodyPair<BodyType>,
|
||||
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>
|
||||
) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat)
|
||||
|
||||
@ -52,7 +53,7 @@ class UnifiedRequester(
|
||||
url: String,
|
||||
filename: String,
|
||||
inputProvider: InputProvider,
|
||||
otherData: BodyPair<BodyType>,
|
||||
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||
mimetype: String = "*/*",
|
||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||
@ -75,7 +76,7 @@ class UnifiedRequester(
|
||||
suspend fun <BodyType, ResultType> unimultipart(
|
||||
url: String,
|
||||
mppFile: MPPFile,
|
||||
otherData: BodyPair<BodyType>,
|
||||
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||
mimetype: String = "*/*",
|
||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||
@ -120,7 +121,7 @@ fun <T> SerializationStrategy<T>.encodeUrlQueryValue(
|
||||
|
||||
suspend fun <BodyType, ResultType> HttpClient.unipost(
|
||||
url: String,
|
||||
bodyInfo: BodyPair<BodyType>,
|
||||
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||
serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat
|
||||
) = post(url) {
|
||||
@ -162,7 +163,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
|
||||
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
||||
url: String,
|
||||
filename: String,
|
||||
otherData: BodyPair<BodyType>,
|
||||
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
inputProvider: InputProvider,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||
mimetype: String = "*/*",
|
||||
@ -220,7 +221,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
|
||||
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
||||
url: String,
|
||||
mppFile: MPPFile,
|
||||
otherData: BodyPair<BodyType>,
|
||||
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||
mimetype: String = "*/*",
|
||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||
|
@ -56,25 +56,25 @@ class KtorWriteStandardCrudRepo<ObjectType, IdType, InputValue> (
|
||||
|
||||
override suspend fun create(values: List<InputValue>): List<ObjectType> = unifiedRequester.unipost(
|
||||
buildStandardUrl(baseUrl, createRouting),
|
||||
BodyPair(listInputSerializer, values),
|
||||
Pair(listInputSerializer, values),
|
||||
listObjectsSerializer
|
||||
)
|
||||
|
||||
override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost(
|
||||
buildStandardUrl(baseUrl, updateRouting),
|
||||
BodyPair(inputUpdateSerializer, id to value),
|
||||
Pair(inputUpdateSerializer, id to value),
|
||||
objectsNullableSerializer
|
||||
)
|
||||
|
||||
override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost(
|
||||
buildStandardUrl(baseUrl, updateManyRouting),
|
||||
BodyPair(listInputUpdateSerializer, values),
|
||||
Pair(listInputUpdateSerializer, values),
|
||||
listObjectsSerializer
|
||||
)
|
||||
|
||||
override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost(
|
||||
buildStandardUrl(baseUrl, deleteByIdRouting),
|
||||
BodyPair(listIdsSerializer, ids),
|
||||
Pair(listIdsSerializer, ids),
|
||||
Unit.serializer()
|
||||
)
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
||||
baseUrl,
|
||||
setRoute
|
||||
),
|
||||
BodyPair(keyValueMapSerializer, toSet),
|
||||
Pair(keyValueMapSerializer, toSet),
|
||||
Unit.serializer()
|
||||
)
|
||||
|
||||
@ -54,7 +54,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
||||
baseUrl,
|
||||
unsetRoute,
|
||||
),
|
||||
BodyPair(keysListSerializer, toUnset),
|
||||
Pair(keysListSerializer, toUnset),
|
||||
Unit.serializer()
|
||||
)
|
||||
|
||||
@ -63,7 +63,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
||||
baseUrl,
|
||||
unsetWithValuesRoute,
|
||||
),
|
||||
BodyPair(valuesListSerializer, toUnset),
|
||||
Pair(valuesListSerializer, toUnset),
|
||||
Unit.serializer()
|
||||
)
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
baseUrl,
|
||||
removeRoute,
|
||||
),
|
||||
BodyPair(keyValueMapSerializer, toRemove),
|
||||
Pair(keyValueMapSerializer, toRemove),
|
||||
Unit.serializer(),
|
||||
)
|
||||
|
||||
@ -56,7 +56,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
baseUrl,
|
||||
addRoute,
|
||||
),
|
||||
BodyPair(keyValueMapSerializer, toAdd),
|
||||
Pair(keyValueMapSerializer, toAdd),
|
||||
Unit.serializer(),
|
||||
)
|
||||
override suspend fun clear(k: Key) = unifiedRequester.unipost(
|
||||
@ -64,7 +64,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
baseUrl,
|
||||
clearRoute,
|
||||
),
|
||||
BodyPair(keySerializer, k),
|
||||
Pair(keySerializer, k),
|
||||
Unit.serializer(),
|
||||
)
|
||||
|
||||
@ -73,7 +73,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
baseUrl,
|
||||
clearWithValueRoute,
|
||||
),
|
||||
BodyPair(valueSerializer, v),
|
||||
Pair(valueSerializer, v),
|
||||
Unit.serializer(),
|
||||
)
|
||||
|
||||
@ -82,7 +82,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
||||
baseUrl,
|
||||
setRoute,
|
||||
),
|
||||
BodyPair(keyValueMapSerializer, toSet),
|
||||
Pair(keyValueMapSerializer, toSet),
|
||||
Unit.serializer(),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user