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

gitbucket.core.api.ApiComment.scala Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
package gitbucket.core.api

import gitbucket.core.model.IssueComment
import gitbucket.core.util.RepositoryName

import java.util.Date


/**
 * https://developer.github.com/v3/issues/comments/
 */
case class ApiComment(
  id: Int,
  user: ApiUser,
  body: String,
  created_at: Date,
  updated_at: Date)(repositoryName: RepositoryName, issueId: Int, isPullRequest: Boolean){
  val html_url = ApiPath(s"/${repositoryName.fullName}/${if(isPullRequest){ "pull" }else{ "issues" }}/${issueId}#comment-${id}")
}

object ApiComment{
  def apply(comment: IssueComment, repositoryName: RepositoryName, issueId: Int, user: ApiUser, isPullRequest: Boolean): ApiComment =
    ApiComment(
      id = comment.commentId,
      user = user,
      body = comment.content,
      created_at = comment.registeredDate,
      updated_at = comment.updatedDate)(repositoryName, issueId, isPullRequest)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy