Skip to content

Commit

Permalink
checking graph apis.
Browse files Browse the repository at this point in the history
  • Loading branch information
uakihir0 committed Jan 3, 2024
1 parent 5d43097 commit c4b8d93
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import work.socialhub.kbsky.model.bsky.actor.ActorDefsProfileView
@Serializable
class GraphGetBlocksResponse {
var cursor: String? = null
var blocks: List<ActorDefsProfileView>? = null
lateinit var blocks: List<ActorDefsProfileView>
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package work.socialhub.kbsky.api.entity.bsky.graph

import kotlinx.serialization.Serializable
import work.socialhub.kbsky.model.bsky.actor.ActorDefsProfileView

@Serializable
class GraphGetFollowersResponse {
// region
var subject: ActorDefsProfileView? = null
var cursor: String? = null

// endregion
var followers: List<ActorDefsProfileView>? = null
lateinit var subject: ActorDefsProfileView
lateinit var followers: List<ActorDefsProfileView>
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import work.socialhub.kbsky.model.bsky.actor.ActorDefsProfileView

@Serializable
class GraphGetFollowsResponse {
var subject: ActorDefsProfileView? = null
var cursor: String? = null
var follows: List<ActorDefsProfileView>? = null
lateinit var subject: ActorDefsProfileView
lateinit var follows: List<ActorDefsProfileView>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import work.socialhub.kbsky.model.bsky.actor.ActorDefsProfileView
@Serializable
class GraphGetMutesResponse {
var cursor: String? = null
var mutes: List<ActorDefsProfileView>? = null
lateinit var mutes: List<ActorDefsProfileView>
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class _GraphResource(
.url(xrpc(uri, GraphMuteActor))
.header("Authorization", request.bearerToken)
.accept(MediaType.JSON)
.queries(request.toMap())
.get()
.json(request.toMappedJson())
.post()
}
}
}
Expand All @@ -146,8 +146,8 @@ class _GraphResource(
.url(xrpc(uri, GraphUnmuteActor))
.header("Authorization", request.bearerToken)
.accept(MediaType.JSON)
.queries(request.toMap())
.get()
.json(request.toMappedJson())
.post()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetBlocksTest : AbstractTest() {
GraphGetBlocksRequest(accessJwt)
)

checkNotNull(response.data.blocks)
response.data.blocks
.forEach { print(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,23 @@ import work.socialhub.kbsky.AbstractTest
import work.socialhub.kbsky.BlueskyFactory
import work.socialhub.kbsky.api.entity.bsky.graph.GraphGetFollowersRequest
import work.socialhub.kbsky.domain.Service
import work.socialhub.kbsky.domain.Service.BSKY_SOCIAL
import kotlin.test.Test

class GetFollowersTest : AbstractTest() {

@Test
fun testGetFollowers() {
val response = BlueskyFactory
.instance(Service.BSKY_SOCIAL.uri)
.instance(BSKY_SOCIAL.uri)
.graph()
.getFollowers(
GraphGetFollowersRequest(accessJwt).also {
it.actor = "uakihir0.bsky.social"
it.actor = "uakihir0.com"
}
)

checkNotNull(response.data.followers)
response.data.followers
.forEach { print(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class GetFollowsTest : AbstractTest() {
.graph()
.getFollows(
GraphGetFollowsRequest(accessJwt).also {
it.actor = "uakihir0.bsky.social"
it.actor = "uakihir0.com"
}
)

checkNotNull(response.data.follows)
response.data.follows
.forEach { print(it) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class GetMutesTest : AbstractTest() {
GraphGetMutesRequest(accessJwt)
)

checkNotNull(response.data.mutes)
response.data.mutes
.forEach(this::print)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ class MuteTest : AbstractTest() {
fun testMute() {
BlueskyFactory
.instance(BSKY_SOCIAL.uri)
.graph().muteActor(
.graph()
.muteActor(
GraphMuteActorRequest(accessJwt).also {
it.actor = "uakihir0.bsky.social"
it.actor = "bsky.app"
}
)
}
Expand All @@ -23,7 +24,8 @@ class MuteTest : AbstractTest() {
fun testMuteByDID() {
BlueskyFactory
.instance(BSKY_SOCIAL.uri)
.graph().muteActor(
.graph()
.muteActor(
GraphMuteActorRequest(accessJwt).also {
it.actor = "did:plc:oc6vwdlmk2kqyida5i74d3p5"
}
Expand Down

0 comments on commit c4b8d93

Please sign in to comment.