diff --git a/projectsv1/projects_v1.go b/projectsv1/projects_v1.go index c9ba1f84..dd811240 100644 --- a/projectsv1/projects_v1.go +++ b/projectsv1/projects_v1.go @@ -375,12 +375,12 @@ func (projects *ProjectsV1) GetProjectWithContext(ctx context.Context, getProjec // UpdateProject : Update a project by id // Update a project. -func (projects *ProjectsV1) UpdateProject(updateProjectOptions *UpdateProjectOptions) (result *PullRequest, response *core.DetailedResponse, err error) { +func (projects *ProjectsV1) UpdateProject(updateProjectOptions *UpdateProjectOptions) (result *UpdateResponsePullRequest, response *core.DetailedResponse, err error) { return projects.UpdateProjectWithContext(context.Background(), updateProjectOptions) } // UpdateProjectWithContext is an alternate form of the UpdateProject method which supports a Context parameter -func (projects *ProjectsV1) UpdateProjectWithContext(ctx context.Context, updateProjectOptions *UpdateProjectOptions) (result *PullRequest, response *core.DetailedResponse, err error) { +func (projects *ProjectsV1) UpdateProjectWithContext(ctx context.Context, updateProjectOptions *UpdateProjectOptions) (result *UpdateResponsePullRequest, response *core.DetailedResponse, err error) { err = core.ValidateNotNil(updateProjectOptions, "updateProjectOptions cannot be nil") if err != nil { return @@ -442,7 +442,7 @@ func (projects *ProjectsV1) UpdateProjectWithContext(ctx context.Context, update return } if rawResponse != nil { - err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPullRequest) + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalUpdateResponsePullRequest) if err != nil { return } @@ -4084,29 +4084,6 @@ func UnmarshalProjectStatusDashboard(m map[string]json.RawMessage, result interf return } -// PullRequest : PullRequest struct -type PullRequest struct { - // The name of the branch. - Branch *string `json:"branch,omitempty"` - - URL *string `json:"url,omitempty"` -} - -// UnmarshalPullRequest unmarshals an instance of PullRequest from the specified map of raw messages. -func UnmarshalPullRequest(m map[string]json.RawMessage, result interface{}) (err error) { - obj := new(PullRequest) - err = core.UnmarshalPrimitive(m, "branch", &obj.Branch) - if err != nil { - return - } - err = core.UnmarshalPrimitive(m, "url", &obj.URL) - if err != nil { - return - } - reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) - return -} - // RegisterPullRequestOptions : The RegisterPullRequest options. type RegisterPullRequestOptions struct { // The id of the project, which uniquely identifies it. @@ -4823,6 +4800,29 @@ func (options *UpdatePullRequestConfigsOptions) SetHeaders(param map[string]stri return options } +// UpdateResponsePullRequest : UpdateResponsePullRequest struct +type UpdateResponsePullRequest struct { + // The name of the branch. + Branch *string `json:"branch,omitempty"` + + PrURL *string `json:"pr_url,omitempty"` +} + +// UnmarshalUpdateResponsePullRequest unmarshals an instance of UpdateResponsePullRequest from the specified map of raw messages. +func UnmarshalUpdateResponsePullRequest(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UpdateResponsePullRequest) + err = core.UnmarshalPrimitive(m, "branch", &obj.Branch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pr_url", &obj.PrURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + // ValidateProjectOptions : The ValidateProject options. type ValidateProjectOptions struct { // The project name. diff --git a/projectsv1/projects_v1_test.go b/projectsv1/projects_v1_test.go index 9c5468e9..4e7a4d21 100644 --- a/projectsv1/projects_v1_test.go +++ b/projectsv1/projects_v1_test.go @@ -1206,7 +1206,7 @@ var _ = Describe(`ProjectsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"branch": "Branch", "url": "URL"}`) + fmt.Fprintf(res, "%s", `{"branch": "Branch", "pr_url": "PrURL"}`) })) }) It(`Invoke UpdateProject successfully with retries`, func() { @@ -1303,7 +1303,7 @@ var _ = Describe(`ProjectsV1`, func() { // Set mock response res.Header().Set("Content-type", "application/json") res.WriteHeader(200) - fmt.Fprintf(res, "%s", `{"branch": "Branch", "url": "URL"}`) + fmt.Fprintf(res, "%s", `{"branch": "Branch", "pr_url": "PrURL"}`) })) }) It(`Invoke UpdateProject successfully`, func() {