Skip to content

Commit

Permalink
last swagger fix
Browse files Browse the repository at this point in the history
  • Loading branch information
luiof committed Aug 29, 2022
1 parent 2e0046f commit fcd7cf7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
52 changes: 26 additions & 26 deletions projectsv1/projects_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions projectsv1/projects_v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit fcd7cf7

Please sign in to comment.