apis.CreateIssueAPI.scala Maven / Gradle / Ivy
package io.gitlab.mateuszjaje.jiraclient
package apis
import createmodels.{CreateJiraIssue, CreateJiraIssuePayload, IssuesPayload}
import models.{IssueKey, JiraIssueShort}
import cats.data.EitherT
trait CreateIssueAPI[F[_]] {
self: JiraRestAPI[F] =>
// @see: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-post
// @see: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/
// @see: https://community.atlassian.com/t5/Answers-Developer-Questions/How-to-create-an-issue-with-the-REST-API-and-immediatly-set-the/qaq-p/515174
def createIssue(payload: CreateJiraIssue): EitherT[F, JiraError, JiraIssueShort] = {
implicit val rId: RequestId = RequestId.newOne("create-issue")
val payloadReq = CreateJiraIssuePayload(payload)
val req = reqGen.post(s"$API/issue", MJson.write(payloadReq))
invokeRequest(req).unmarshall[JiraIssueShort]
}
def moveIssuesToEpic(epic: IssueKey, issues: Vector[IssueKey]): EitherT[F, JiraError, String] = {
implicit val rId: RequestId = RequestId.newOne("move-issues-to-epic")
val req = reqGen.post(s"$API1/epic/$epic/issue", MJson.write(IssuesPayload(issues)))
invokeRequest(req)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy