Created
January 17, 2018 14:02
-
-
Save ruggi/5c95c7f1dd87f050c6c97078af636c0f to your computer and use it in GitHub Desktop.
This file contains 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
bob := client.FlatFeed("user", "bob") | |
alice := client.NotificationFeed("notification", "alice") | |
activity := stream.Activity{ | |
Actor: "user:bob", | |
Verb: "tweet", | |
Object: "hanging out with @alice and @carol", | |
ForeignID: "fid:123", | |
Time: stream.Time{time.Now()}, | |
To: []string{ | |
alice.ID(), | |
"notification:carol", | |
}, | |
} | |
// alice's and carol's notification feeds will receive the activity. | |
_, err := bob.AddActivity(activity) | |
if err != nil { | |
// ... | |
} | |
// Update the "to" targets of the activity so that it's sent to david but not to | |
// carol anymore | |
err = bob.UpdateToTargets(activity, | |
stream.WithToTargetsAdd("notification:david"), | |
stream.WithToTargetsRemove("notification:carol"), | |
) | |
if err != nil { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment