Add campaign reminder configuration support#623
Open
jamescarr wants to merge 1 commit into
Open
Conversation
Add CampaignReminderInput and wire a reminder field into CampaignCreateInput and CampaignUpdateInput so recurring campaign reminders (Slack, email, and Microsoft Teams) can be managed via the campaignCreate/campaignUpdate mutations. CampaignUpdateInput uses Nullable so a reminder can be explicitly cleared. Campaign.Reminder is now a pointer to distinguish a campaign with no reminder from one with a zero-value reminder, and the read-side CampaignReminder gains the DefaultMicrosoftTeamsChannel field. Co-authored-by: Cursor <cursoragent@cursor.com>
Open
4 tasks
Contributor
Author
Usage examplesCreate 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,
},
})
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)
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CampaignReminderInputand wires areminderfield intoCampaignCreateInputandCampaignUpdateInput, enabling recurring campaign reminders (Slack, email, Microsoft Teams) via the existingcampaignCreate/campaignUpdatemutations.CampaignUpdateInput.Reminderuses*Nullable[CampaignReminderInput]so a reminder can be explicitly cleared.Campaign.Reminderto*CampaignReminderso "no reminder" is distinguishable from a zero-value reminder, and adds the read-sideDefaultMicrosoftTeamsChannelfield.Notes
daysOfWeekis only valid for a weekly cadence; callers should omit it otherwise (the API rejects it for daily/monthly). This matches the validation enforced in the terraform-provider-opslevel consumer.defaultSlackChannelby prepending#.Test plan
go build ./...go vet ./...go test ./...(addedTestCreateCampaignWithReminderandTestUpdateCampaignClearReminder; updated mock templates for the newdefaultMicrosoftTeamsChannelselection)gofumptcleanMade with Cursor