Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ err := client.Publish(
* ClientIDs : List of client IDs. Backward compatibility. ([]string - UUID v4 without Hyphens)
* TargetUserIDs : List of target client IDs. Backward compatibility. ([]string - UUID v4 without Hyphens)
* TargetNamespace : Target Namespace. Backward compatibility. (string)
* SourceNamespace : Source Namespace. Backward compatibility. SourceNamespace tracks the trigger namespace, distinct from the event's occurrence namespace. (string - optional)
* Privacy : Privacy. Backward compatibility. (bool)
* AdditionalFields : Additional fields. Backward compatibility. (map[string]interface{})
* Payload : Additional attribute. (map[string]interface{})
Expand Down
8 changes: 8 additions & 0 deletions v3/eventstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Event struct {
TargetNamespace string `json:"target_namespace,omitempty"`
Privacy bool `json:"privacy,omitempty"`
Topic string `json:"topic,omitempty"`
SourceNamespace string `json:"sourceNamespace,omitempty"`
AdditionalFields map[string]interface{} `json:"additional_fields,omitempty"`
Payload map[string]interface{} `json:"payload,omitempty"`

Expand Down Expand Up @@ -141,6 +142,7 @@ type PublishBuilder struct {
errorCallback func(event *Event, err error)
ctx context.Context
timeout time.Duration
sourceNamespace string
}

// NewPublish create new PublishBuilder instance
Expand Down Expand Up @@ -259,6 +261,12 @@ func (p *PublishBuilder) TargetNamespace(targetNamespace string) *PublishBuilder
return p
}

// SourceNamespace set sourceNamespace of publisher event
func (p *PublishBuilder) SourceNamespace(sourceNamespace string) *PublishBuilder {
p.sourceNamespace = sourceNamespace
return p
}

// Privacy set privacy of publisher event
func (p *PublishBuilder) Privacy(privacy bool) *PublishBuilder {
p.privacy = privacy
Expand Down
1 change: 1 addition & 0 deletions v3/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ func ConstructEvent(publishBuilder *PublishBuilder) (kafka.Message, *Event, erro
Privacy: publishBuilder.privacy,
AdditionalFields: publishBuilder.additionalFields,
Payload: publishBuilder.payload,
SourceNamespace: publishBuilder.sourceNamespace,
}

eventBytes, err := marshal(event)
Expand Down
1 change: 1 addition & 0 deletions v3/stdout.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (client *StdoutClient) Publish(publishBuilder *PublishBuilder) error {
AdditionalFields: publishBuilder.additionalFields,
Version: publishBuilder.version,
Payload: publishBuilder.payload,
SourceNamespace: publishBuilder.sourceNamespace,
}

eventByte, err := marshal(event)
Expand Down