Skip to content

refactor!: Rename LockIssueOptions, PullRequestBranchUpdateOptions, and UserSuspendOptions to ...Request and pass them by value - #4612

Merged
gmlewis merged 2 commits into
google:masterfrom
JamBalaya56562:refactor/3644-options-suffix-request-types
Oct 13, 2026
Merged

gmlewis merged 2 commits into
google:masterfrom
JamBalaya56562:refactor/3644-options-suffix-request-types

Conversation

@JamBalaya56562

Copy link
Copy Markdown
Contributor

Updates #3644.

BREAKING CHANGE: LockIssueOptions, PullRequestBranchUpdateOptions, and UserSuspendOptions are renamed to LockIssueRequest, UpdatePullRequestBranchRequest, and SuspendUserRequest and are passed by value to IssuesService.Lock, PullRequestsService.UpdateBranch, and UsersService.Suspend; LockIssueRequest.LockReason is now *string.

This PR converts the three remaining single-method request body types that still use the Options suffix:

Old New Method Endpoint
*LockIssueOptions LockIssueRequest IssuesService.Lock PUT /repos/{owner}/{repo}/issues/{issue_number}/lock
*PullRequestBranchUpdateOptions UpdatePullRequestBranchRequest PullRequestsService.UpdateBranch PUT /repos/{owner}/{repo}/pulls/{pull_number}/update-branch
*UserSuspendOptions SuspendUserRequest UsersService.Suspend PUT /users/{username}/suspended (GHES)

Two commits:

  1. fix! - LockIssueOptions.LockReason becomes *string. The field is optional in the OpenAPI schema (the request body itself is optional and has no required list), and this removes its # TODO: Issues entry from the structfield allowed-tag-types list.
  2. refactor! - Rename the three types to ...Request and pass them by value. All six entries are removed from body-allowed-pointer-types and body-allowed-wrong-names. Tests that passed nil now pass XxxRequest{}, the body variables are named body, and the Lock and UpdateBranch tests now assert the request body with testJSONBody.

The fields of UpdatePullRequestBranchRequest (expected_head_sha) and SuspendUserRequest (reason) are already optional pointers and match the OpenAPI schemas, so they are unchanged. The method names already match the GitHub docs operation names ("Lock an issue", "Update a pull request branch", "Suspend a user"), so no methods are renamed.

Verified locally: go build ./..., go vet -tags integration ./test/integration/, example module build, go test ./..., generated files idempotent, custom-gcl 0 issues, and script/check-schema-fields.sh reports no new issues.

@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 12, 2026
@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (e754d2c) to head (a0501df).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4612   +/-   ##
=======================================
  Coverage   98.61%   98.61%           
=======================================
  Files         199      199           
  Lines       18693    18693           
=======================================
  Hits        18435    18435           
  Misses        258      258           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @JamBalaya56562!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

@jvm986 jvm986 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 13, 2026
@gmlewis

gmlewis commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @jvm986!
Merging.

@gmlewis
gmlewis merged commit 70b9759 into google:master Oct 13, 2026
15 checks passed
@JamBalaya56562
JamBalaya56562 deleted the refactor/3644-options-suffix-request-types branch October 13, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants