Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to comment issue #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Koisell
Copy link

@Koisell Koisell commented Jul 29, 2020

We can comment issue via the update API but using direct API is
easier. This commit allows direct support to add comment to an issue.

We can comment issue via the update API but using direct API is
easier. This commit allows direct support to add comment to an issue.
@r2sd
Copy link

r2sd commented Aug 6, 2021

Would really appreciate if you could explain how to use the update API to add a comment.

Thanks!

client.updateIssue(
    "ISSUE-1",
    IssuePayload.apply(
      IssueField.apply("update", Json.obj("comment"-> Json.arr(Json.obj("add" -> Json.obj("body" -> Json.fromString("API Test"))))))
    )
  )

returns

Left(com.allantl.jira4s.v2.domain.errors.GenericError: Field 'update' cannot be set. It is not on the appropriate screen, or unknown.)

The same api works on REST with the body:

{
  "update": {
    "comment": [
      {
        "add": {
          "body": "API test"
        }
      }
    ]
  }
}

@Koisell
Copy link
Author

Koisell commented Aug 6, 2021

Like the error message explain there is no 'update' field. Fields refer to comment summery. It's explained in Jira documentation. One simple option if you want to send JSON-like call is to not specify fields.

      IssuePayload(
        Nil,
        None,
        Some(
          Json.obj(
            "comment" -> Json.arr(
              Json.obj(
                "add" -> Json.obj(
                  "body" -> "task done!")
                )
              )
            )
          )
        )
      )

@Koisell
Copy link
Author

Koisell commented Aug 6, 2021

BTW next time you have such question on Github you should make an issue. PR comments should be reserved to talk about the PR. If you think it's relevant you can then link the issue with a PR.

@r2sd
Copy link

r2sd commented Aug 6, 2021

Thanks a lot @Koisell , that worked perfect. Also, thanks for the tip on issue/PR. Will use it next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants