Fix create comment method for commit

This commit is contained in:
Rashit Azizbaev
2021-01-14 12:20:07 +03:00
parent 15f2a16ca8
commit 219e8c92ad
3 changed files with 52 additions and 2 deletions

View File

@ -724,7 +724,7 @@ func (a *DefaultApiService) CreateBranch(projectKey, repositorySlug string) (*AP
@param optional (nil or map[string]interface{}) with one or more of:
@param "since" (string) For a merge commit, a parent can be provided to specify which diff the comments should be on. For a commit range, a {@code sinceId} can be provided to specify where the comments should be anchored from.
@return */
func (a *DefaultApiService) CreateComment(projectKey, repositorySlug string, commitId string, localVarOptionals map[string]interface{}) (*APIResponse, error) {
func (a *DefaultApiService) CreateComment(projectKey, repositorySlug string, commitId string, comment Comment, localVarOptionals map[string]interface{}) (*APIResponse, error) {
var (
localVarHTTPMethod = strings.ToUpper("Post")
localVarPostBody interface{}
@ -732,6 +732,12 @@ func (a *DefaultApiService) CreateComment(projectKey, repositorySlug string, com
localVarFileBytes []byte
)
var err error
localVarPostBody, err = json.Marshal(comment)
if err != nil {
return nil, err
}
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/1.0/projects/{projectKey}/repos/{repositorySlug}/commits/{commitId}/comments"
localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)