Skip to content

Commit

Permalink
Merge pull request #12 from Glaymor/thread-post
Browse files Browse the repository at this point in the history
Add method to create thread post
  • Loading branch information
little-inferno authored Apr 16, 2024
2 parents 0e33991 + 979097a commit 61928bf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions modules/core/src/main/scala/muffin/api/ApiClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,24 @@ class ApiClient[F[_]: Concurrent, To[_], From[_]](http: HttpClient[F, To, From],
Map("Authorization" -> s"Bearer ${cfg.auth}")
)

def postToThread(
channelId: ChannelId,
rootPostId: MessageId,
message: Option[String] = None,
props: Props = Props.empty
): F[Post] =
http.request(
cfg.baseUrl + "/posts",
Method.Post,
jsonRaw
.field("channel_id", channelId)
.field("message", message)
.field("props", props)
.field("root_id", rootPostId)
.build,
Map("Authorization" -> s"Bearer ${cfg.auth}")
)

def channel(userIds: List[UserId]): F[ChannelInfo] =
if (userIds.size == 2)
http.request[List[UserId], ChannelInfo](
Expand Down

0 comments on commit 61928bf

Please sign in to comment.