All Downloads are FREE. Search and download functionalities are using the official Maven repository.

euszjaje.jira4s-core_3.2.4.0.source-code.jiraissueupdatemodels.scala Maven / Gradle / Ivy

There is a newer version: 2.4.1
Show newest version
package io.gitlab.mateuszjaje.jiraclient

import io.circe.Encoder
import io.circe.generic.semiauto.deriveEncoder

case class JiraFieldUpdate(action: String, value: String)

object JiraFieldUpdate {

  implicit val JiraFieldUpdateEncoder: Encoder[JiraFieldUpdate] =
    Encoder.encodeMap[String, String].contramap[JiraFieldUpdate](x => Map(x.action -> x.value))

  def add(value: String) = JiraFieldUpdate("add", value)

  def remove(value: String) = JiraFieldUpdate("remove", value)
}

case class UpdateJiraIssue(field: String, changes: List[JiraFieldUpdate])

object UpdateJiraIssue {
  implicit val UpdateJiraIssueEncoder: Encoder[UpdateJiraIssue] =
    Encoder.encodeMap[String, List[JiraFieldUpdate]].contramap[UpdateJiraIssue](x => Map(x.field -> x.changes))
}

case class ModifyJiraIssuePayload(update: UpdateJiraIssue)

object ModifyJiraIssuePayload {
  implicit val UpdateJiraIssueEncoder: Encoder[ModifyJiraIssuePayload] = deriveEncoder
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy