Skip to content

Instantly share code, notes, and snippets.

@ruggi
ruggi / docker-compose.yml
Created November 12, 2021 10:38
minIO quick and dirty docker-compose setup
version: "3.4"
services:
# ...
minio:
image: minio/minio
container_name: minio
volumes:
- minio-data:/data

Keybase proof

I hereby claim:

  • I am ruggi on github.
  • I am reifcode (https://keybase.io/reifcode) on keybase.
  • I have a public key whose fingerprint is 0180 B188 5C2A C28D C51E C7AA A9BF CE2F 7765 E532

To claim this, I am signing this object:

flat.GetActivities(
stream.WithActivitiesOffset(2),
stream.WithActivitiesLimit(10),
)
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(),
resp, err := feed.GetFollowing(
stream.WithFollowingFilter("aabbccddee", "ccddeeffgg"),
stream.WithFollowingLimit(5),
stream.WithFollowingOffset(100),
)
if err != nil {
// ...
}
// WithFollowingFilter adds the filter parameter to API calls, used when retrieving
// following feeds, allowing the check whether certain feeds are being followed.
func WithFollowingFilter(ids ...string) FollowingOption {
return FollowingOption{makeRequestOption("filter", strings.Join(ids, ","))}
}
// WithFollowingLimit limits the number of followings in the response to the provided limit.
func WithFollowingLimit(limit int) FollowingOption {
return FollowingOption{withLimit(limit)}
}
// Follow a feed
f1, f2 := stream.FlatFeed("user", "123"), stream.FlatFeed("user", "456")
err := f1.Follow(f2)
if err != nil {
// ...
}
// Adding an activity to f2 will make it appear on f1
act := stream.Activity{Actor: "bob", Verb: "like", Object: "music"}
err = f2.AddActivity(act)
// Remove by ID
err := feed.RemoveActivityByID("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")
if err != nil {
// ...
}
// Remove by foreign ID
err := feed.RemoveActivityByForeignID("fid:123")
if err != nil {
// ...
activity := stream.Activity{
Actor: "bob",
Verb: "like",
Object: "music",
}
resp, err := feed.AddActivity(activity)
if err != nil {
// ...
}
log.Println("activity addedd succesfully in", resp.Duration)
resp, err := rankedFeed.GetActivitiesWithRanking("popularity") // you can also add optional read options
if err != nil {
// ...
}
for i, activity := range resp.Results {
log.Println(i+1, activity.ForeignID, activity.Score)
}