Skip to content

feat: Add organization campaigns endpoints - #4680

Open
Tens1des wants to merge 1 commit into
google:masterfrom
Tens1des:feat/org-campaigns
Open

Tens1des wants to merge 1 commit into
google:masterfrom
Tens1des:feat/org-campaigns

Conversation

@Tens1des

@Tens1des Tens1des commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Adds the five organization campaigns endpoints, which were the only ones
script/metadata.sh unused still listed for the campaigns API:

  • ListCampaigns — GET /orgs/{org}/campaigns
  • CreateCampaign — POST /orgs/{org}/campaigns
  • GetCampaign — GET /orgs/{org}/campaigns/{campaign_number}
  • UpdateCampaign — PATCH /orgs/{org}/campaigns/{campaign_number}
  • DeleteCampaign — DELETE /orgs/{org}/campaigns/{campaign_number}

The methods live on OrganizationsService in orgs_campaigns.go, following
orgs_codesecurity_configurations.go, since every path is under /orgs/{org}/.

Request body field optionality follows the OpenAPI description and passes
script/check-schema-fields.sh with no new findings. Generated accessors and
iterators come from script/generate.sh.

the diff myself and ran script/lint.sh and the test suite locally.

Adds the five campaigns endpoints for organizations:

  ListCampaigns   (GET    /orgs/{org}/campaigns)
  CreateCampaign  (POST   /orgs/{org}/campaigns)
  GetCampaign     (GET    /orgs/{org}/campaigns/{campaign_number})
  UpdateCampaign  (PATCH  /orgs/{org}/campaigns/{campaign_number})
  DeleteCampaign  (DELETE /orgs/{org}/campaigns/{campaign_number})
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Oct 28, 2026
@codecov

codecov Bot commented Oct 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (6eccc42) to head (8e31d82).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4680   +/-   ##
=======================================
  Coverage   98.63%   98.64%           
=======================================
  Files         201      202    +1     
  Lines       18951    19010   +59     
=======================================
+ Hits        18693    18752   +59     
  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, @Tens1des!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra

Comment on lines +117 to +123
var v *CreateCampaignRequest
assertNilError(t, json.NewDecoder(r.Body).Decode(&v))

testMethod(t, r, "POST")
if !cmp.Equal(*v, input) {
t.Errorf("Request body = %+v, want %+v", *v, input)
}

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.

Suggested change
var v *CreateCampaignRequest
assertNilError(t, json.NewDecoder(r.Body).Decode(&v))
testMethod(t, r, "POST")
if !cmp.Equal(*v, input) {
t.Errorf("Request body = %+v, want %+v", *v, input)
}
testMethod(t, r, "POST")
testJSONBody(t, r, input)

Comment on lines +235 to +241
var v *UpdateCampaignRequest
assertNilError(t, json.NewDecoder(r.Body).Decode(&v))

testMethod(t, r, "PATCH")
if !cmp.Equal(*v, input) {
t.Errorf("Request body = %+v, want %+v", *v, input)
}

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.

Suggested change
var v *UpdateCampaignRequest
assertNilError(t, json.NewDecoder(r.Body).Decode(&v))
testMethod(t, r, "PATCH")
if !cmp.Equal(*v, input) {
t.Errorf("Request body = %+v, want %+v", *v, input)
}
testMethod(t, r, "PATCH")
testJSONBody(t, r, input)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants