add properties to typeResponse

This commit is contained in:
Thomas Boksberger committed 2026-04-03 15:04:11 +02:00
1 parent 4cf6073fbe
commit 99a494608f
7 files changed
+76

No files matched your search

+2
View File
@@ -17,6 +17,8 @@ Always stage newly created files that permanently belong to the project with `gi
## Architecture
**AnyTask** is a Kotlin/Compose desktop app that runs in the background and shows a task creation window via a global hotkey (Ctrl+Shift+Space).
**AnyType** is a private, offline-first digital workspace and collaboration tool that gives users full ownership of their data through local encryption and peer-to-peer sync — with no servers or gatekeepers involved. Everything in Anytype is built around Objects — the universal unit for any piece of content — each assigned a Type (e.g. Note, Task, Book) that defines its structure, and connected via Relations (typed properties like due date, assignee, or tags) that link objects together into a queryable, graph-like knowledge model.
**API** the Anytype API is documented [here](https://developers.anytype.io/docs/reference).
### Components
+15
View File
@@ -2,6 +2,21 @@
GET http://localhost:31009/v1/spaces
Authorization: Bearer {{apiKey}}
### Get Types
GET http://localhost:31009/v1/spaces/{{spaceId}}/types
Authorization: Bearer {{apiKey}}
Anytype-Version: 0.1
### Get Type
GET http://localhost:31009/v1/spaces/{{spaceId}}/types/bafyreidtsobmbfmf6gl7bfwyd3ik3zs4m7t6e7p46y4lonsz3chkgeeabi
Authorization: Bearer {{apiKey}}
Anytype-Version: 0.1
### Get Property
GET http://localhost:31009/v1/spaces/{{spaceId}}/properties/bafyreibs7xr3zphtvjt3t4bk3jhcxlllo6jskrsatnuvkrcs65k3kfuany
Authorization: Bearer {{apiKey}}
Anytype-Version: 0.1
### Create Task
POST http://localhost:31009/v1/spaces/{{spaceId}}/objects
Authorization: Bearer {{apiKey}}
@@ -2,8 +2,10 @@ package ch.ergon.anytask.api
import ch.ergon.anytask.api.dto.CreateObjectRequest
import ch.ergon.anytask.api.dto.CreateObjectResponse
import ch.ergon.anytask.api.dto.ObjectType
import ch.ergon.anytask.api.dto.Space
import ch.ergon.anytask.api.dto.SpacesResponse
import ch.ergon.anytask.api.dto.TypesResponse
import io.ktor.client.*
import io.ktor.client.call.*
import io.ktor.client.engine.cio.*
@@ -60,6 +62,15 @@ class AnyTypeApi(
response.body<SpacesResponse>().data
}
suspend fun getTypes(): Result<List<ObjectType>> =
runCatching {
val response = http.get("$baseUrl/v1/spaces/$spaceId/types") {
header("Anytype-Version", "0.1")
bearerAuth(apiKey)
}
response.body<TypesResponse>().data
}
suspend fun createTask(title: String, details: String = ""): Result<String> =
runCatching {
val response = http.post("$baseUrl/v1/spaces/$spaceId/objects") {
@@ -0,0 +1,12 @@
package ch.ergon.anytask.api.dto
import kotlinx.serialization.Serializable
@Serializable
data class Icon(
val format: String = "",
val emoji: String = "",
val file: String = "",
val name: String = "",
val color: String = "",
)
@@ -0,0 +1,16 @@
package ch.ergon.anytask.api.dto
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ObjectType(
val id: String,
val key: String = "",
val name: String,
val icon: Icon = Icon(),
val layout: String = "",
val archived: Boolean = false,
@SerialName("plural_name") val pluralName: String = "",
val properties: List<Property> = emptyList(),
)
@@ -0,0 +1,12 @@
package ch.ergon.anytask.api.dto
import kotlinx.serialization.Serializable
@Serializable
data class Property(
val id: String,
val key: String = "",
val name: String,
val format: String = "",
val `object`: String = "",
)
@@ -0,0 +1,8 @@
package ch.ergon.anytask.api.dto
import kotlinx.serialization.Serializable
@Serializable
data class TypesResponse(
val data: List<ObjectType>,
)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.