mirror of
https://github.com/gfleury/go-bitbucket-v1.git
synced 2025-04-05 09:18:07 -05:00
Merge pull request #27 from gfleury/add-GetPullRequestResponse
Adding GetPullRequestResponse and fixing Create (PullRequest)
This commit is contained in:
commit
2efe893fff
@ -125,7 +125,7 @@ type PullRequestRef struct {
|
|||||||
|
|
||||||
type PullRequest struct {
|
type PullRequest struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
Version int32 `json:"version"`
|
Version int32 `json:"version"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
@ -299,6 +299,13 @@ func GetSSHKeysResponse(r *APIResponse) ([]SSHKey, error) {
|
|||||||
return m, err
|
return m, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetPullRequestResponse cast PullRequest into structure
|
||||||
|
func GetPullRequestResponse(r *APIResponse) (PullRequest, error) {
|
||||||
|
var m PullRequest
|
||||||
|
err := mapstructure.Decode(r.Values["values"], &m)
|
||||||
|
return m, err
|
||||||
|
}
|
||||||
|
|
||||||
// NewAPIResponse create new APIResponse from http.Response
|
// NewAPIResponse create new APIResponse from http.Response
|
||||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
package bitbucketv1
|
package bitbucketv1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -611,18 +612,13 @@ func (a *DefaultApiService) Create(projectKey, repositorySlug string, localVarOp
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if localVarTempParam, localVarOk := localVarOptionals["from"].(string); localVarOk {
|
localVarPostBody, err := json.Marshal(localVarOptionals)
|
||||||
localVarQueryParams.Add("from", parameterToString(localVarTempParam, ""))
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
if localVarTempParam, localVarOk := localVarOptionals["to"].(string); localVarOk {
|
|
||||||
localVarQueryParams.Add("to", parameterToString(localVarTempParam, ""))
|
|
||||||
}
|
|
||||||
if localVarTempParam, localVarOk := localVarOptionals["fromRepo"].(string); localVarOk {
|
|
||||||
localVarQueryParams.Add("fromRepo", parameterToString(localVarTempParam, ""))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHTTPContentTypes := []string{}
|
localVarHTTPContentTypes := []string{"application/json"}
|
||||||
|
|
||||||
// set Content-Type header
|
// set Content-Type header
|
||||||
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user