feat: add segment management methods to ChatClient#114
Open
mogita wants to merge 2 commits into
Open
Conversation
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.
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.
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
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,AddSegmentTargetsrequests.go:CreateSegmentRequest,UpdateSegmentRequest,AddSegmentTargetsRequestmodels.go:CreateSegmentResponse,UpdateSegmentResponsechat_test.go: stub smoke tests for the three methodschat_misc_integration_test.go:TestChatSegmentCampaignIntegrationcovering create segment, add targets, update, then create/start/stop a campaign (skips when the app lacks the campaigns feature)CHANGELOG.md: 4.2.0 entryTesting
go test -short -race ./...passesgo vet ./...clean,gofumptcleanNote
Hold merge until GetStream/chat#14006 lands and the campaigns owner confirms the payloads are intended-public.