mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-23 09:07:14 +00:00
commit
f7dd2b5ce7
2
.github/workflows/dokka_push.yml
vendored
2
.github/workflows/dokka_push.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
run: cd /usr/local/lib/android/sdk/build-tools/32.0.0/ && mv d8 dx && cd lib && mv d8.jar dx.jar
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew dokkaHtml
|
run: ./gradlew build && ./gradlew dokkaHtml
|
||||||
- name: Publish KDocs
|
- name: Publish KDocs
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.11.11
|
||||||
|
|
||||||
|
* `Crypto`:
|
||||||
|
* `hmacSha256` has been deprecated
|
||||||
|
* `Ktor`:
|
||||||
|
* `Client`:
|
||||||
|
* `BodyPair` has been deprecated
|
||||||
|
|
||||||
## 0.11.10
|
## 0.11.10
|
||||||
|
|
||||||
* `Repos`:
|
* `Repos`:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
package dev.inmo.micro_utils.crypto
|
package dev.inmo.micro_utils.crypto
|
||||||
|
|
||||||
|
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
|
||||||
expect fun SourceString.hmacSha256(key: String): String
|
expect fun SourceString.hmacSha256(key: String): String
|
||||||
|
@ -8,6 +8,7 @@ external interface CryptoJs {
|
|||||||
@JsNonModule
|
@JsNonModule
|
||||||
external val CryptoJS: CryptoJs
|
external val CryptoJS: CryptoJs
|
||||||
|
|
||||||
|
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
|
||||||
actual fun SourceString.hmacSha256(key: String): String {
|
actual fun SourceString.hmacSha256(key: String): String {
|
||||||
return CryptoJS.asDynamic().HmacSHA256(this, key).toString().unsafeCast<String>()
|
return CryptoJS.asDynamic().HmacSHA256(this, key).toString().unsafeCast<String>()
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package dev.inmo.micro_utils.crypto
|
|||||||
import javax.crypto.Mac
|
import javax.crypto.Mac
|
||||||
import javax.crypto.spec.SecretKeySpec
|
import javax.crypto.spec.SecretKeySpec
|
||||||
|
|
||||||
|
@Deprecated("Deprecated due to incorrect of work sometimes and redundancy. Can be replaced by korlibs krypto")
|
||||||
actual fun SourceString.hmacSha256(key: String): String {
|
actual fun SourceString.hmacSha256(key: String): String {
|
||||||
val mac = Mac.getInstance("HmacSHA256")
|
val mac = Mac.getInstance("HmacSHA256")
|
||||||
|
|
||||||
|
@ -14,5 +14,5 @@ crypto_js_version=4.1.1
|
|||||||
# Project data
|
# Project data
|
||||||
|
|
||||||
group=dev.inmo
|
group=dev.inmo
|
||||||
version=0.11.10
|
version=0.11.11
|
||||||
android_code_version=134
|
android_code_version=135
|
||||||
|
@ -12,6 +12,7 @@ import io.ktor.http.*
|
|||||||
import io.ktor.utils.io.core.ByteReadPacket
|
import io.ktor.utils.io.core.ByteReadPacket
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
|
|
||||||
|
@Deprecated("This class will be removed in next")
|
||||||
typealias BodyPair<T> = Pair<SerializationStrategy<T>, T>
|
typealias BodyPair<T> = Pair<SerializationStrategy<T>, T>
|
||||||
|
|
||||||
class UnifiedRequester(
|
class UnifiedRequester(
|
||||||
@ -33,7 +34,7 @@ class UnifiedRequester(
|
|||||||
|
|
||||||
suspend fun <BodyType, ResultType> unipost(
|
suspend fun <BodyType, ResultType> unipost(
|
||||||
url: String,
|
url: String,
|
||||||
bodyInfo: BodyPair<BodyType>,
|
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>
|
resultDeserializer: DeserializationStrategy<ResultType>
|
||||||
) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat)
|
) = client.unipost(url, bodyInfo, resultDeserializer, serialFormat)
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ class UnifiedRequester(
|
|||||||
url: String,
|
url: String,
|
||||||
filename: String,
|
filename: String,
|
||||||
inputProvider: InputProvider,
|
inputProvider: InputProvider,
|
||||||
otherData: BodyPair<BodyType>,
|
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||||
mimetype: String = "*/*",
|
mimetype: String = "*/*",
|
||||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||||
@ -75,7 +76,7 @@ class UnifiedRequester(
|
|||||||
suspend fun <BodyType, ResultType> unimultipart(
|
suspend fun <BodyType, ResultType> unimultipart(
|
||||||
url: String,
|
url: String,
|
||||||
mppFile: MPPFile,
|
mppFile: MPPFile,
|
||||||
otherData: BodyPair<BodyType>,
|
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||||
mimetype: String = "*/*",
|
mimetype: String = "*/*",
|
||||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||||
@ -120,7 +121,7 @@ fun <T> SerializationStrategy<T>.encodeUrlQueryValue(
|
|||||||
|
|
||||||
suspend fun <BodyType, ResultType> HttpClient.unipost(
|
suspend fun <BodyType, ResultType> HttpClient.unipost(
|
||||||
url: String,
|
url: String,
|
||||||
bodyInfo: BodyPair<BodyType>,
|
bodyInfo: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||||
serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat
|
serialFormat: StandardKtorSerialFormat = standardKtorSerialFormat
|
||||||
) = post(url) {
|
) = post(url) {
|
||||||
@ -162,7 +163,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
|
|||||||
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
||||||
url: String,
|
url: String,
|
||||||
filename: String,
|
filename: String,
|
||||||
otherData: BodyPair<BodyType>,
|
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
inputProvider: InputProvider,
|
inputProvider: InputProvider,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||||
mimetype: String = "*/*",
|
mimetype: String = "*/*",
|
||||||
@ -220,7 +221,7 @@ suspend fun <ResultType> HttpClient.unimultipart(
|
|||||||
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
suspend fun <BodyType, ResultType> HttpClient.unimultipart(
|
||||||
url: String,
|
url: String,
|
||||||
mppFile: MPPFile,
|
mppFile: MPPFile,
|
||||||
otherData: BodyPair<BodyType>,
|
otherData: Pair<SerializationStrategy<BodyType>, BodyType>,
|
||||||
resultDeserializer: DeserializationStrategy<ResultType>,
|
resultDeserializer: DeserializationStrategy<ResultType>,
|
||||||
mimetype: String = "*/*",
|
mimetype: String = "*/*",
|
||||||
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
additionalParametersBuilder: FormBuilder.() -> Unit = {},
|
||||||
|
@ -56,25 +56,25 @@ class KtorWriteStandardCrudRepo<ObjectType, IdType, InputValue> (
|
|||||||
|
|
||||||
override suspend fun create(values: List<InputValue>): List<ObjectType> = unifiedRequester.unipost(
|
override suspend fun create(values: List<InputValue>): List<ObjectType> = unifiedRequester.unipost(
|
||||||
buildStandardUrl(baseUrl, createRouting),
|
buildStandardUrl(baseUrl, createRouting),
|
||||||
BodyPair(listInputSerializer, values),
|
Pair(listInputSerializer, values),
|
||||||
listObjectsSerializer
|
listObjectsSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost(
|
override suspend fun update(id: IdType, value: InputValue): ObjectType? = unifiedRequester.unipost(
|
||||||
buildStandardUrl(baseUrl, updateRouting),
|
buildStandardUrl(baseUrl, updateRouting),
|
||||||
BodyPair(inputUpdateSerializer, id to value),
|
Pair(inputUpdateSerializer, id to value),
|
||||||
objectsNullableSerializer
|
objectsNullableSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost(
|
override suspend fun update(values: List<UpdatedValuePair<IdType, InputValue>>): List<ObjectType> = unifiedRequester.unipost(
|
||||||
buildStandardUrl(baseUrl, updateManyRouting),
|
buildStandardUrl(baseUrl, updateManyRouting),
|
||||||
BodyPair(listInputUpdateSerializer, values),
|
Pair(listInputUpdateSerializer, values),
|
||||||
listObjectsSerializer
|
listObjectsSerializer
|
||||||
)
|
)
|
||||||
|
|
||||||
override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost(
|
override suspend fun deleteById(ids: List<IdType>) = unifiedRequester.unipost(
|
||||||
buildStandardUrl(baseUrl, deleteByIdRouting),
|
buildStandardUrl(baseUrl, deleteByIdRouting),
|
||||||
BodyPair(listIdsSerializer, ids),
|
Pair(listIdsSerializer, ids),
|
||||||
Unit.serializer()
|
Unit.serializer()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
setRoute
|
setRoute
|
||||||
),
|
),
|
||||||
BodyPair(keyValueMapSerializer, toSet),
|
Pair(keyValueMapSerializer, toSet),
|
||||||
Unit.serializer()
|
Unit.serializer()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
unsetRoute,
|
unsetRoute,
|
||||||
),
|
),
|
||||||
BodyPair(keysListSerializer, toUnset),
|
Pair(keysListSerializer, toUnset),
|
||||||
Unit.serializer()
|
Unit.serializer()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class KtorWriteStandardKeyValueRepo<K, V> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
unsetWithValuesRoute,
|
unsetWithValuesRoute,
|
||||||
),
|
),
|
||||||
BodyPair(valuesListSerializer, toUnset),
|
Pair(valuesListSerializer, toUnset),
|
||||||
Unit.serializer()
|
Unit.serializer()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
removeRoute,
|
removeRoute,
|
||||||
),
|
),
|
||||||
BodyPair(keyValueMapSerializer, toRemove),
|
Pair(keyValueMapSerializer, toRemove),
|
||||||
Unit.serializer(),
|
Unit.serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
addRoute,
|
addRoute,
|
||||||
),
|
),
|
||||||
BodyPair(keyValueMapSerializer, toAdd),
|
Pair(keyValueMapSerializer, toAdd),
|
||||||
Unit.serializer(),
|
Unit.serializer(),
|
||||||
)
|
)
|
||||||
override suspend fun clear(k: Key) = unifiedRequester.unipost(
|
override suspend fun clear(k: Key) = unifiedRequester.unipost(
|
||||||
@ -64,7 +64,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
clearRoute,
|
clearRoute,
|
||||||
),
|
),
|
||||||
BodyPair(keySerializer, k),
|
Pair(keySerializer, k),
|
||||||
Unit.serializer(),
|
Unit.serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
clearWithValueRoute,
|
clearWithValueRoute,
|
||||||
),
|
),
|
||||||
BodyPair(valueSerializer, v),
|
Pair(valueSerializer, v),
|
||||||
Unit.serializer(),
|
Unit.serializer(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ class KtorWriteOneToManyKeyValueRepo<Key, Value> (
|
|||||||
baseUrl,
|
baseUrl,
|
||||||
setRoute,
|
setRoute,
|
||||||
),
|
),
|
||||||
BodyPair(keyValueMapSerializer, toSet),
|
Pair(keyValueMapSerializer, toSet),
|
||||||
Unit.serializer(),
|
Unit.serializer(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user