Skip to content

Add campaign CRUD client methods and check management #612

@jamescarr

Description

@jamescarr

Problem

The OpsLevel GraphQL API exposes full campaign mutation support (campaignCreate, campaignUpdate, campaignDelete, campaignScheduleUpdate, campaignUnschedule, campaignEnd) plus checksCopyToCampaign for associating checks, but the Go SDK only has a ListCampaigns query. There are no client methods for creating, reading, updating, deleting, or scheduling campaigns — which blocks the Terraform provider from managing campaigns as code.

Proposed Solution

Add the following client methods and supporting types:

Client Methods

Method GraphQL Operation Description
GetCampaign(id) account.campaign(id:) Read a single campaign by ID
CreateCampaign(input) campaignCreate Create a draft campaign
UpdateCampaign(input) campaignUpdate Update campaign fields
DeleteCampaign(id) campaignDelete Delete a campaign
ScheduleCampaign(input) campaignScheduleUpdate Set start and target dates
UnscheduleCampaign(id) campaignUnschedule Revert to draft
EndCampaign(input) campaignEnd End campaign, optionally promote checks
CopyChecksToCampaign(input) checksCopyToCampaign Copy rubric checks into a campaign
ListCampaignChecks(id) account.campaign.checks List checks belonging to a campaign (paginated)

Input Types

  • CampaignCreateInput, CampaignUpdateInput, CampaignScheduleUpdateInput, CampaignEndInput, CampaignUnscheduleInput
  • CampaignReminderInput, ChecksCopyToCampaignInput

Additional Types

  • CampaignCheckNode (id + name) for the ListCampaignChecks response
  • Payload types for each mutation

All methods follow the existing SDK patterns (client.Mutate / client.Query + HandleErrors).

Context

This is needed to support opslevel_campaign as a Terraform resource (see OpsLevel/terraform-provider-opslevel for the companion PR).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions