1
0
Fork 0
mirror of https://github.com/anyproto/anytype-kotlin.git synced 2025-06-08 13:57:10 +09:00

DROID-133 Tech | Simple tables, api (#2700)

Co-authored-by: konstantiniiv <ki@anytype.io>
This commit is contained in:
Konstantin Ivanov 2022-11-09 11:48:16 +01:00 committed by GitHub
parent b30d60f4df
commit 72fa7d39f2
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 905 additions and 9 deletions

View file

@ -643,4 +643,122 @@ class BlockDataRepository(
): Payload {
return remote.blockDataViewSetSource(ctx, block, sources)
}
override suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>): Payload {
return remote.clearBlockStyle(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload {
return remote.fillTableColumn(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return remote.createTableRow(
ctx = ctx,
targetId = targetId,
position = position
)
}
override suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload {
return remote.setTableRowHeader(
ctx = ctx,
targetId = targetId,
isHeader = isHeader
)
}
override suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return remote.createTableColumn(
ctx = ctx,
targetId = targetId,
position = position
)
}
override suspend fun deleteTableColumn(ctx: Id, targetId: Id): Payload {
return remote.deleteTableColumn(
ctx = ctx,
targetId = targetId
)
}
override suspend fun deleteTableRow(ctx: Id, targetId: Id): Payload {
return remote.deleteTableRow(
ctx = ctx,
targetId = targetId
)
}
override suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return remote.duplicateTableColumn(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
}
override suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return remote.duplicateTableRow(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
}
override suspend fun sortTable(
ctx: Id,
columnId: String,
type: Block.Content.DataView.Sort.Type
): Payload {
return remote.sortTable(
ctx = ctx,
columnId = columnId,
type = type
)
}
override suspend fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload {
return remote.expandTable(
ctx = ctx,
targetId = targetId,
columns = columns,
rows = rows
)
}
}

View file

@ -52,10 +52,11 @@ interface BlockDataStore {
type: String?,
template: Id?
): Id
suspend fun openPage(id: String): Payload
suspend fun openObjectSet(id: String): Payload
suspend fun openProfile(id: String): Payload
suspend fun openObjectPreview(id: Id) : Payload
suspend fun openObjectPreview(id: Id): Payload
suspend fun closePage(id: String)
suspend fun closeDashboard(id: String)
suspend fun setDocumentEmojiIcon(command: Command.SetDocumentEmojiIcon): Payload
@ -67,7 +68,7 @@ interface BlockDataStore {
suspend fun removeDocumentIcon(ctx: Id): Payload
suspend fun setupBookmark(command: Command.SetupBookmark): Payload
suspend fun createAndFetchBookmarkBlock(command: Command.CreateBookmark): Payload
suspend fun createBookmarkObject(url: Url) : Id
suspend fun createBookmarkObject(url: Url): Id
suspend fun fetchBookmarkObject(ctx: Id, url: Url)
suspend fun undo(command: Command.Undo): Payload
suspend fun redo(command: Command.Redo): Payload
@ -198,14 +199,14 @@ interface BlockDataStore {
suspend fun cancelObjectSearchSubscription(subscriptions: List<Id>)
suspend fun relationListAvailable(ctx: Id): List<Relation>
suspend fun addRelationToObject(ctx: Id, relation: Id) : Payload
suspend fun addRelationToObject(ctx: Id, relation: Id): Payload
suspend fun deleteRelationFromObject(ctx: Id, relation: Id): Payload
suspend fun addNewRelationToObject(
ctx: Id,
name: String,
format: RelationFormat,
limitObjectTypes: List<Id>
) : Pair<Id, Payload>
): Pair<Id, Payload>
suspend fun debugSync(): String
suspend fun debugLocalStore(path: String): String
@ -231,13 +232,13 @@ interface BlockDataStore {
suspend fun addToFeaturedRelations(ctx: Id, relations: List<Id>): Payload
suspend fun removeFromFeaturedRelations(ctx: Id, relations: List<Id>): Payload
suspend fun setObjectIsFavorite(ctx: Id, isFavorite: Boolean) : Payload
suspend fun setObjectIsArchived(ctx: Id, isArchived: Boolean) : Payload
suspend fun setObjectIsFavorite(ctx: Id, isFavorite: Boolean): Payload
suspend fun setObjectIsArchived(ctx: Id, isArchived: Boolean): Payload
suspend fun setObjectListIsArchived(targets: List<Id>, isArchived: Boolean)
suspend fun deleteObjects(targets: List<Id>)
suspend fun setObjectLayout(ctx: Id, layout: ObjectType.Layout) : Payload
suspend fun setObjectLayout(ctx: Id, layout: ObjectType.Layout): Payload
suspend fun clearFileCache()
@ -259,5 +260,64 @@ interface BlockDataStore {
suspend fun blockDataViewSetSource(ctx: Id, block: Id, sources: List<String>): Payload
suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>) : Payload
suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>): Payload
suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>): Payload
suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload
suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload
suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun deleteTableColumn(
ctx: Id,
targetId: Id
): Payload
suspend fun deleteTableRow(
ctx: Id,
targetId: Id
): Payload
suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun sortTable(
ctx: Id,
columnId: Id,
type: Block.Content.DataView.Sort.Type
): Payload
suspend fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload
}

View file

@ -259,4 +259,62 @@ interface BlockRemote {
suspend fun blockDataViewSetSource(ctx: Id, block: Id, sources: List<String>): Payload
suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>) : Payload
suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>) : Payload
suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload
suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload
suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun deleteTableColumn(
ctx: Id,
targetId: Id
): Payload
suspend fun deleteTableRow(
ctx: Id,
targetId: Id
): Payload
suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun sortTable(
ctx: Id,
columnId: String, type: Block.Content.DataView.Sort.Type
): Payload
suspend fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload
}

View file

@ -559,4 +559,122 @@ class BlockRemoteDataStore(private val remote: BlockRemote) : BlockDataStore {
override suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>): Payload {
return remote.clearBlockContent(ctx, blockIds)
}
override suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>): Payload {
return remote.clearBlockStyle(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload {
return remote.fillTableColumn(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return remote.createTableRow(
ctx = ctx,
targetId = targetId,
position = position
)
}
override suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload {
return remote.setTableRowHeader(
ctx = ctx,
targetId = targetId,
isHeader = isHeader
)
}
override suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return remote.createTableColumn(
ctx = ctx,
targetId = targetId,
position = position
)
}
override suspend fun deleteTableColumn(ctx: Id, targetId: Id): Payload {
return remote.deleteTableColumn(
ctx = ctx,
targetId = targetId
)
}
override suspend fun deleteTableRow(ctx: Id, targetId: Id): Payload {
return remote.deleteTableRow(
ctx = ctx,
targetId = targetId
)
}
override suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return remote.duplicateTableColumn(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
}
override suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return remote.duplicateTableRow(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
}
override suspend fun sortTable(
ctx: Id,
columnId: String,
type: Block.Content.DataView.Sort.Type
): Payload {
return remote.sortTable(
ctx = ctx,
columnId = columnId,
type = type
)
}
override suspend fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload {
return remote.expandTable(
ctx = ctx,
targetId = targetId,
columns = columns,
rows = rows
)
}
}

View file

@ -325,4 +325,62 @@ interface BlockRepository {
suspend fun blockDataViewSetSource(ctx: Id, block: Id, sources: List<String>): Payload
suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>) : Payload
suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>) : Payload
suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload
suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload
suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload
suspend fun deleteTableColumn(
ctx: Id,
targetId: Id
): Payload
suspend fun deleteTableRow(
ctx: Id,
targetId: Id
): Payload
suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload
suspend fun sortTable(
ctx: Id,
columnId: String, type: Block.Content.DataView.Sort.Type
): Payload
suspend fun expandTable(
ctx: Id,
targetId: String,
columns: Int,
rows: Int
): Payload
}

View file

@ -1,5 +1,6 @@
package com.anytypeio.anytype.middleware.block
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.CBTextStyle
import com.anytypeio.anytype.core_models.Command
import com.anytypeio.anytype.core_models.DVFilter
@ -596,6 +597,127 @@ class BlockMiddleware(
}
override suspend fun clearBlockContent(ctx: Id, blockIds: List<Id>): Payload {
return middleware.clearBlockContent(ctx, blockIds)
return middleware.clearBlockContent(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun clearBlockStyle(ctx: Id, blockIds: List<Id>): Payload {
return middleware.clearBlockStyle(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun fillTableColumn(ctx: Id, blockIds: List<Id>): Payload {
return middleware.fillTableColumn(
ctx = ctx,
blockIds = blockIds
)
}
override suspend fun createTableRow(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return middleware.createTableRow(
ctx = ctx,
targetId = targetId,
position = position.toMiddlewareModel()
)
}
override suspend fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload {
return middleware.setTableRowHeader(
ctx = ctx,
targetId = targetId,
isHeader = isHeader
)
}
override suspend fun createTableColumn(
ctx: Id,
targetId: Id,
position: Position
): Payload {
return middleware.createTableColumn(
ctx = ctx,
targetId = targetId,
position = position.toMiddlewareModel()
)
}
override suspend fun deleteTableColumn(ctx: Id, targetId: Id): Payload {
return middleware.deleteTableColumn(
ctx = ctx,
targetId = targetId
)
}
override suspend fun deleteTableRow(ctx: Id, targetId: Id): Payload {
return middleware.deleteTableRow(
ctx = ctx,
targetId = targetId
)
}
override suspend fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return middleware.duplicateTableColumn(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position.toMiddlewareModel()
)
}
override suspend fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Position
): Payload {
return middleware.duplicateTableRow(
ctx = ctx,
targetId = targetId,
blockId = blockId,
position = position.toMiddlewareModel()
)
}
override suspend fun sortTable(
ctx: Id,
columnId: String,
type: Block.Content.DataView.Sort.Type
): Payload {
return middleware.sortTable(
ctx = ctx,
columnId = columnId,
type = type.toMiddlewareModel()
)
}
override suspend fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload {
return middleware.expandTable(
ctx = ctx,
targetId = targetId,
columns = columns,
rows = rows
)
}
}

View file

@ -1771,6 +1771,191 @@ class Middleware(
return response.event.toPayload()
}
@Throws(Exception::class)
fun clearBlockStyle(
ctx: Id,
blockIds: List<Id>
): Payload {
val request = Rpc.BlockText.ListClearStyle.Request(
contextId = ctx,
blockIds = blockIds
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockListClearStyle(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun fillTableColumn(
ctx: Id,
blockIds: List<Id>
): Payload {
val request = Rpc.BlockTable.ColumnListFill.Request(
contextId = ctx,
blockIds = blockIds
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableColumnListFill(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun createTableRow(
ctx: Id,
targetId: Id,
position: Block.Position
): Payload {
val request = Rpc.BlockTable.RowCreate.Request(
contextId = ctx,
targetId = targetId,
position = position
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableRowCreate(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun setTableRowHeader(
ctx: Id,
targetId: Id,
isHeader: Boolean
): Payload {
val request = Rpc.BlockTable.RowSetHeader.Request(
contextId = ctx,
targetId = targetId,
isHeader = isHeader
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableRowSetHeader(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun createTableColumn(
ctx: Id,
targetId: Id,
position: Block.Position
): Payload {
val request = Rpc.BlockTable.ColumnCreate.Request(
contextId = ctx,
targetId = targetId,
position = position
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableColumnCreate(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun deleteTableColumn(
ctx: Id,
targetId: Id
): Payload {
val request = Rpc.BlockTable.ColumnDelete.Request(
contextId = ctx,
targetId = targetId
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableColumnDelete(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun deleteTableRow(
ctx: Id,
targetId: Id
): Payload {
val request = Rpc.BlockTable.RowDelete.Request(
contextId = ctx,
targetId = targetId
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableRowDelete(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun duplicateTableColumn(
ctx: Id,
targetId: Id,
blockId: Id,
position: Block.Position
): Payload {
val request = Rpc.BlockTable.ColumnDuplicate.Request(
contextId = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableColumnDuplicate(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun duplicateTableRow(
ctx: Id,
targetId: Id,
blockId: Id,
position: Block.Position
): Payload {
val request = Rpc.BlockTable.RowDuplicate.Request(
contextId = ctx,
targetId = targetId,
blockId = blockId,
position = position
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableRowDuplicate(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun sortTable(
ctx: Id,
columnId: String,
type: Block.Content.Dataview.Sort.Type
): Payload {
val request = Rpc.BlockTable.Sort.Request(
contextId = ctx,
columnId = columnId,
type = type
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableSort(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
@Throws(Exception::class)
fun expandTable(
ctx: Id,
targetId: Id,
columns: Int,
rows: Int
): Payload {
val request = Rpc.BlockTable.Expand.Request(
contextId = ctx,
targetId = targetId,
columns = columns,
rows = rows
)
if (BuildConfig.DEBUG) logRequest(request)
val response = service.blockTableExpand(request)
if (BuildConfig.DEBUG) logResponse(response)
return response.event.toPayload()
}
private fun logRequest(any: Any) {
val message = "===> " + any::class.java.canonicalName + ":" + "\n" + any.toString()
Timber.d(message)

View file

@ -240,6 +240,10 @@ interface MiddlewareService {
fun blockListClearContent(request: Rpc.BlockText.ListClearContent.Request)
: Rpc.BlockText.ListClearContent.Response
@Throws(Exception::class)
fun blockListClearStyle(request: Rpc.BlockText.ListClearStyle.Request)
: Rpc.BlockText.ListClearStyle.Response
//endregion
//region NAVIGATION commands
@ -323,6 +327,36 @@ interface MiddlewareService {
@Throws(Exception::class)
fun blockTableRowListFill(request: Rpc.BlockTable.RowListFill.Request): Rpc.BlockTable.RowListFill.Response
@Throws(Exception::class)
fun blockTableColumnListFill(request: Rpc.BlockTable.ColumnListFill.Request): Rpc.BlockTable.ColumnListFill.Response
@Throws(Exception::class)
fun blockTableRowCreate(request: Rpc.BlockTable.RowCreate.Request): Rpc.BlockTable.RowCreate.Response
@Throws(Exception::class)
fun blockTableRowSetHeader(request: Rpc.BlockTable.RowSetHeader.Request): Rpc.BlockTable.RowSetHeader.Response
@Throws(Exception::class)
fun blockTableColumnCreate(request: Rpc.BlockTable.ColumnCreate.Request): Rpc.BlockTable.ColumnCreate.Response
@Throws(Exception::class)
fun blockTableColumnDelete(request: Rpc.BlockTable.ColumnDelete.Request): Rpc.BlockTable.ColumnDelete.Response
@Throws(Exception::class)
fun blockTableRowDelete(request: Rpc.BlockTable.RowDelete.Request): Rpc.BlockTable.RowDelete.Response
@Throws(Exception::class)
fun blockTableColumnDuplicate(request: Rpc.BlockTable.ColumnDuplicate.Request): Rpc.BlockTable.ColumnDuplicate.Response
@Throws(Exception::class)
fun blockTableRowDuplicate(request: Rpc.BlockTable.RowDuplicate.Request): Rpc.BlockTable.RowDuplicate.Response
@Throws(Exception::class)
fun blockTableSort(request: Rpc.BlockTable.Sort.Request): Rpc.BlockTable.Sort.Response
@Throws(Exception::class)
fun blockTableExpand(request: Rpc.BlockTable.Expand.Request): Rpc.BlockTable.Expand.Response
//endregion
//region DEBUG commands

View file

@ -1128,4 +1128,147 @@ class MiddlewareServiceImplementation : MiddlewareService {
return response
}
}
override fun blockListClearStyle(request: Rpc.BlockText.ListClearStyle.Request): Rpc.BlockText.ListClearStyle.Response {
val encoded = Service.blockTextListClearStyle(
Rpc.BlockText.ListClearStyle.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockText.ListClearStyle.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockText.ListClearStyle.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableColumnListFill(request: Rpc.BlockTable.ColumnListFill.Request): Rpc.BlockTable.ColumnListFill.Response {
val encoded = Service.blockTableColumnListFill(
Rpc.BlockTable.ColumnListFill.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.ColumnListFill.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.ColumnListFill.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableRowCreate(request: Rpc.BlockTable.RowCreate.Request): Rpc.BlockTable.RowCreate.Response {
val encoded = Service.blockTableRowCreate(
Rpc.BlockTable.RowCreate.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.RowCreate.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.RowCreate.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableRowSetHeader(request: Rpc.BlockTable.RowSetHeader.Request): Rpc.BlockTable.RowSetHeader.Response {
val encoded = Service.blockTableRowSetHeader(
Rpc.BlockTable.RowSetHeader.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.RowSetHeader.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.RowSetHeader.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableColumnCreate(request: Rpc.BlockTable.ColumnCreate.Request): Rpc.BlockTable.ColumnCreate.Response {
val encoded = Service.blockTableColumnCreate(
Rpc.BlockTable.ColumnCreate.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.ColumnCreate.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.ColumnCreate.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableColumnDelete(request: Rpc.BlockTable.ColumnDelete.Request): Rpc.BlockTable.ColumnDelete.Response {
val encoded = Service.blockTableColumnDelete(
Rpc.BlockTable.ColumnDelete.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.ColumnDelete.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.ColumnDelete.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableRowDelete(request: Rpc.BlockTable.RowDelete.Request): Rpc.BlockTable.RowDelete.Response {
val encoded = Service.blockTableRowDelete(
Rpc.BlockTable.RowDelete.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.RowDelete.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.RowDelete.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableColumnDuplicate(request: Rpc.BlockTable.ColumnDuplicate.Request): Rpc.BlockTable.ColumnDuplicate.Response {
val encoded = Service.blockTableColumnDuplicate(
Rpc.BlockTable.ColumnDuplicate.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.ColumnDuplicate.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.ColumnDuplicate.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableRowDuplicate(request: Rpc.BlockTable.RowDuplicate.Request): Rpc.BlockTable.RowDuplicate.Response {
val encoded = Service.blockTableRowDuplicate(
Rpc.BlockTable.RowDuplicate.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.RowDuplicate.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.RowDuplicate.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableSort(request: Rpc.BlockTable.Sort.Request): Rpc.BlockTable.Sort.Response {
val encoded = Service.blockTableSort(
Rpc.BlockTable.Sort.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.Sort.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.Sort.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
override fun blockTableExpand(request: Rpc.BlockTable.Expand.Request): Rpc.BlockTable.Expand.Response {
val encoded = Service.blockTableExpand(
Rpc.BlockTable.Expand.Request.ADAPTER.encode(request)
)
val response = Rpc.BlockTable.Expand.Response.ADAPTER.decode(encoded)
val error = response.error
if (error != null && error.code != Rpc.BlockTable.Expand.Response.Error.Code.NULL) {
throw Exception(error.description)
} else {
return response
}
}
}