Skip to content

Commit

Permalink
Support for Slack API conversations.mark. Scala 2.13.3/2.12.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Jul 18, 2020
1 parent 6fd25c2 commit d2859e5
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import sbt.Package.ManifestAttributes

name := "slack-morphism-root"

ThisBuild / version := "1.3.6"
ThisBuild / version := "1.3.7"

ThisBuild / description := "Open Type-Safe Reactive Client with Blocks Templating for Slack"

Expand All @@ -20,7 +20,7 @@ ThisBuild / licenses := Seq(
( "Apache License v2.0", url( "http://www.apache.org/licenses/LICENSE-2.0.html" ) )
)

ThisBuild / crossScalaVersions := Seq( "2.13.2", "2.12.11" )
ThisBuild / crossScalaVersions := Seq( "2.13.3", "2.12.12" )

ThisBuild / scalaVersion := (ThisBuild / crossScalaVersions).value.head

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.latestbit.slack.morphism.client.ratectrl._
import org.latestbit.slack.morphism.client.reqresp.conversations._
import org.latestbit.slack.morphism.messages.SlackMessage
import org.latestbit.slack.morphism.client.streaming.SlackApiResponseScroller
import org.latestbit.slack.morphism.common.{ SlackBasicChannelInfo, SlackChannelInfo, SlackChannelProfile }
import org.latestbit.slack.morphism.common._
import org.latestbit.slack.morphism.codecs.implicits._

/**
Expand Down Expand Up @@ -453,8 +453,8 @@ trait SlackApiConversationsClient[F[_]] extends SlackApiHttpProtocolSupport[F] {
}

/**
* https://api.slack.com/methods/conversations.unarchive
*/
* https://api.slack.com/methods/conversations.unarchive
*/
def unarchive( req: SlackApiConversationsUnarchiveRequest )(
implicit slackApiToken: SlackApiToken,
backendType: SlackApiClientBackend.BackendType[F]
Expand All @@ -470,6 +470,24 @@ trait SlackApiConversationsClient[F[_]] extends SlackApiHttpProtocolSupport[F] {
)
}

/**
* https://api.slack.com/methods/conversations.mark
*/
def unarchive( req: SlackApiConversationsMarkRequest )(
implicit slackApiToken: SlackApiToken,
backendType: SlackApiClientBackend.BackendType[F]
): F[Either[SlackApiClientError, SlackApiConversationsMarkResponse]] = {

http.post[
SlackApiConversationsMarkRequest,
SlackApiConversationsMarkResponse
](
"conversations.unarchive",
req,
methodRateControl = Some( SlackApiMethodRateControlParams( tier = Some( SlackApiRateControlParams.TIER_3 ) ) )
)
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2019 Abdulla Abdurakhmanov ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package org.latestbit.slack.morphism.client.reqresp.conversations

/**
* Request of https://api.slack.com/methods/conversations.mark
*/
case class SlackApiConversationsMarkRequest( channel: String, ts: String )

/**
* Response of https://api.slack.com/methods/conversations.mark
*/
case class SlackApiConversationsMarkResponse()
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,18 @@ package object codecs {
implicit val decoderSlackApiConversationsUnarchiveResponse: Decoder[SlackApiConversationsUnarchiveResponse] =
deriveDecoder[SlackApiConversationsUnarchiveResponse]

implicit val encoderSlackApiConversationsMarkRequest: Encoder.AsObject[SlackApiConversationsMarkRequest] =
deriveEncoder[SlackApiConversationsMarkRequest]

implicit val decoderSlackApiConversationsMarkRequest: Decoder[SlackApiConversationsMarkRequest] =
deriveDecoder[SlackApiConversationsMarkRequest]

implicit val encoderSlackApiConversationsMarkResponse: Encoder.AsObject[SlackApiConversationsMarkResponse] =
deriveEncoder[SlackApiConversationsMarkResponse]

implicit val decoderSlackApiConversationsMarkResponse: Decoder[SlackApiConversationsMarkResponse] =
deriveDecoder[SlackApiConversationsMarkResponse]

implicit val encoderSlackApiDndEndDndRequest: Encoder.AsObject[SlackApiDndEndDndRequest] =
deriveEncoder[SlackApiDndEndDndRequest]

Expand Down Expand Up @@ -2001,6 +2013,7 @@ package object codecs {

implicit val decoderSlackApiViewsUpdateResponse: Decoder[SlackApiViewsUpdateResponse] =
deriveDecoder[SlackApiViewsUpdateResponse]

}

object implicits extends CirceCodecs {}
Expand Down

0 comments on commit d2859e5

Please sign in to comment.