Skip to content

Allow clearing a campaign reminder on update - #623

Open
jamescarr wants to merge 1 commit into
OpsLevel:mainfrom
jamescarr:jamescarr/campaign-reminders
Open

jamescarr wants to merge 1 commit into
OpsLevel:mainfrom
jamescarr:jamescarr/campaign-reminders

Conversation

@jamescarr

@jamescarr jamescarr commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Changes CampaignUpdateInput.Reminder from *CampaignReminderInput to *Nullable[CampaignReminderInput].

Why

campaignUpdate treats an omitted reminder as "leave the existing reminder alone", so with a plain pointer there is no way to express "remove the reminder from this campaign" — the field either carries a value or disappears from the request. Wrapping it in Nullable lets callers send an explicit null.

This matters for the Terraform provider, where removing the reminder block from a campaign resource has to actually clear the reminder rather than silently keep it.

Notes

Everything else this originally carried (the CampaignReminder object, CampaignReminderInput, and the reminder enums) shipped in v2026.9.7, so this PR is now just the nullability change.

The generator template in templates/inputObjects.tpl carries the same per-field override, alongside the existing CheckPackageVersionUpdateInput one, so the type survives the next schema regeneration.

Testing

Two new mocked tests: one sends a full reminder and asserts the response parses, the other sends NewNullOf[CampaignReminderInput]() and asserts the request body contains "reminder":null.

@jamescarr

Copy link
Copy Markdown
Contributor Author

Usage examples

Create a campaign with a weekly reminder

message := "Please complete your campaign checks."
slack := "platform-eng" // API stores this as "#platform-eng"

campaign, err := client.CreateCampaign(opslevel.CampaignCreateInput{
    Name:    "Upgrade to Rails 7",
    OwnerId: teamID,
    Reminder: &opslevel.CampaignReminderInput{
        Channels:            []opslevel.CampaignReminderChannelEnum{
            opslevel.CampaignReminderChannelEnumSlack,
            opslevel.CampaignReminderChannelEnumEmail,
        },
        Frequency:           1,
        FrequencyUnit:       opslevel.CampaignReminderFrequencyUnitEnumWeek,
        DaysOfWeek:          []opslevel.DayOfWeekEnum{opslevel.DayOfWeekEnumMonday, opslevel.DayOfWeekEnumThursday},
        TimeOfDay:           "09:30",
        Timezone:            "America/Chicago",
        Message:             &message,
        DefaultSlackChannel: &slack,
    },
})

DaysOfWeek must be omitted for day / month cadences (the API only accepts it for week).

Clear an existing reminder on update

_, err := client.UpdateCampaign(opslevel.CampaignUpdateInput{
    Id:       campaign.Id,
    Reminder: opslevel.NewNullOf[opslevel.CampaignReminderInput](), // marshals to `null`
})

Read it back

c, _ := client.GetCampaign(campaign.Id)
if c.Reminder != nil {
    fmt.Println(c.Reminder.FrequencyUnit, c.Reminder.NextOccurrence)
}

CampaignUpdateInput.Reminder is now *Nullable[CampaignReminderInput] so an
explicit null can be sent to remove an existing reminder. Sending the field
unset still leaves the current reminder untouched.

The input object generator template carries the same override so the type
survives the next schema regeneration.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jamescarr
jamescarr force-pushed the jamescarr/campaign-reminders branch from 6ca1b18 to 3dd427a Compare September 16, 2026 10:17
@jamescarr jamescarr changed the title Add campaign reminder configuration support Allow clearing a campaign reminder on update Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant