Skip to content

feat: add segment management methods to ChatClient#114

Open
mogita wants to merge 2 commits into
mainfrom
feat/cha-3483-segment-methods
Open

feat: add segment management methods to ChatClient#114
mogita wants to merge 2 commits into
mainfrom
feat/cha-3483-segment-methods

Conversation

@mogita

@mogita mogita commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the segment management methods to ChatClient: CreateSegment, UpdateSegment, AddSegmentTargets. These are the endpoints needed to build and edit the segment a campaign targets. The campaign methods were already present, but without segment create/update/add-targets the workflow could not be completed through the SDK and customers fell back to raw REST (reported by rewardstyle).

Depends on GetStream/chat#14006, which exposes the three endpoints in the OpenAPI spec (they were Ignore: true). The methods and types here match what regenerating from that spec produces; applied surgically to avoid unrelated regen drift.

Changes

  • chat.go: CreateSegment, UpdateSegment, AddSegmentTargets
  • requests.go: CreateSegmentRequest, UpdateSegmentRequest, AddSegmentTargetsRequest
  • models.go: CreateSegmentResponse, UpdateSegmentResponse
  • chat_test.go: stub smoke tests for the three methods
  • chat_misc_integration_test.go: TestChatSegmentCampaignIntegration covering create segment, add targets, update, then create/start/stop a campaign (skips when the app lacks the campaigns feature)
  • CHANGELOG.md: 4.2.0 entry

Testing

  • go test -short -race ./... passes
  • go vet ./... clean, gofumpt clean

Note

Hold merge until GetStream/chat#14006 lands and the campaigns owner confirms the payloads are intended-public.

Add CreateSegment, UpdateSegment and AddSegmentTargets, the segment
endpoints needed to build and edit the segment a campaign targets.
Without them the campaign workflow could not be completed through the
SDK. Includes generated-style smoke tests and a live integration test
covering create segment, add targets, update, then run a campaign.
@mogita mogita had a problem deploying to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Failure
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 16:57 — with GitHub Actions Inactive
@mogita mogita marked this pull request as ready for review June 12, 2026 17:57
@mogita mogita requested a review from tbarbugli as a code owner June 12, 2026 17:57
CreateCampaign requires channel_template when create_channels is true,
and a campaign cannot be stopped once completed. Provide a channel
template and schedule the campaign for the future so it stays in the
scheduled (stoppable) state before stopping.
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Inactive
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Inactive
@mogita mogita deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Active
@mogita mogita temporarily deployed to feeds-enabled-shard June 12, 2026 18:06 — with GitHub Actions Inactive
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