started to fill client part
This commit is contained in:
ClientPart
ClientServerCommon
Core
build.gradlegradle/wrapper
settings.gradlesrc/main/kotlin/com/github/insanusmokrassar/postssystem/core
41
ClientPart/build.gradle
Normal file
41
ClientPart/build.gradle
Normal file
@ -0,0 +1,41 @@
|
||||
project.version = "0.1.0"
|
||||
project.group = "com.insanusmokrassar"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java-library'
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'kotlinx-serialization'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
api project(":Core")
|
||||
api project(":ClientServerCommon")
|
||||
|
||||
api "io.ktor:ktor-client:$ktor_version"
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = [ disableImplicitReflectionSerializerAnnotation ]
|
||||
}
|
||||
}
|
1
ClientPart/gradle.properties
Normal file
1
ClientPart/gradle.properties
Normal file
@ -0,0 +1 @@
|
||||
ktor_version=1.2.4
|
1
ClientPart/settings.gradle
Normal file
1
ClientPart/settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
rootProject.name = 'postssystem.core.client'
|
38
ClientPart/src/main/kotlin/com/insanusmokrassar/postssystem/core/client/ReadableHttpPostsAPI.kt
Normal file
38
ClientPart/src/main/kotlin/com/insanusmokrassar/postssystem/core/client/ReadableHttpPostsAPI.kt
Normal file
@ -0,0 +1,38 @@
|
||||
package com.insanusmokrassar.postssystem.core.client
|
||||
|
||||
import com.insanusmokrassar.postssystem.core.api.ReadPostsAPI
|
||||
import com.insanusmokrassar.postssystem.core.clientserver.common.*
|
||||
import com.insanusmokrassar.postssystem.core.content.ContentId
|
||||
import com.insanusmokrassar.postssystem.core.post.Post
|
||||
import com.insanusmokrassar.postssystem.core.post.PostId
|
||||
import com.insanusmokrassar.postssystem.core.utils.pagination.Pagination
|
||||
import com.insanusmokrassar.postssystem.core.utils.pagination.PaginationResult
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.request.post
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class ReadableHttpPostsAPI(
|
||||
private val client: HttpClient = HttpClient(),
|
||||
private val baseAddress: String
|
||||
) : ReadPostsAPI {
|
||||
private val postByIdAddress = "$baseAddress/$getPostByIdAddress"
|
||||
private val postsByContentIdAddress = "$baseAddress/$getPostsByContentIdAddress"
|
||||
private val postsByDatesAddress = "$baseAddress/$getPostsByDatesAddress"
|
||||
private val postsByPaginationAddress = "$baseAddress/$getPostsByPaginationAddress"
|
||||
|
||||
override suspend fun getPostById(id: PostId): Post? {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override suspend fun getPostsByContent(id: ContentId): List<Post> {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override suspend fun getPostsByDates(from: DateTime?, to: DateTime?): List<Post> {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override suspend fun getPostsByPagination(pagination: Pagination): PaginationResult<Post> {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
26
ClientPart/src/main/kotlin/com/insanusmokrassar/postssystem/core/client/WritableHttpPostsAPI.kt
Normal file
26
ClientPart/src/main/kotlin/com/insanusmokrassar/postssystem/core/client/WritableHttpPostsAPI.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package com.insanusmokrassar.postssystem.core.client
|
||||
|
||||
import com.insanusmokrassar.postssystem.core.api.WritePostsAPI
|
||||
import com.insanusmokrassar.postssystem.core.post.*
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
class WritableHttpPostsAPI : WritePostsAPI {
|
||||
override val postCreatedFlow: Flow<Post>
|
||||
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
||||
override val postDeletedFlow: Flow<Post>
|
||||
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
||||
override val postUpdatedFlow: Flow<Post>
|
||||
get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates.
|
||||
|
||||
override suspend fun createPost(content: PostContents): Post? {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override suspend fun deletePost(id: PostId): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
override suspend fun updatePostContent(postId: PostId, content: PostContents): Boolean {
|
||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user