Documentation
¶
Index ¶
- Constants
- Variables
- type APIError
- type Activity
- type ActivityGroup
- type AddActivitiesResponse
- type AddActivityResponse
- type AddToManyRequest
- type AggregatedFeed
- func (f *AggregatedFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
- func (f *AggregatedFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
- func (f *AggregatedFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
- func (f *AggregatedFeed) GetActivities(opts ...GetActivitiesOption) (*AggregatedFeedResponse, error)
- func (f *AggregatedFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
- func (f *AggregatedFeed) GetNextPageActivities(resp *AggregatedFeedResponse) (*AggregatedFeedResponse, error)
- func (f *AggregatedFeed) ID() string
- func (f *AggregatedFeed) RealtimeToken(readonly bool) string
- func (f *AggregatedFeed) RemoveActivityByForeignID(foreignID string) error
- func (f *AggregatedFeed) RemoveActivityByID(id string) error
- func (f *AggregatedFeed) Slug() string
- func (f *AggregatedFeed) Unfollow(target Feed, opts ...UnfollowOption) error
- func (f *AggregatedFeed) UpdateActivities(activities ...Activity) error
- func (f *AggregatedFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
- func (f *AggregatedFeed) UserID() string
- type AggregatedFeedResponse
- type Client
- func (c *Client) AddToMany(activity Activity, feeds ...Feed) error
- func (c *Client) AggregatedFeed(slug, userID string) *AggregatedFeed
- func (c *Client) FlatFeed(slug, userID string) *FlatFeed
- func (c *Client) FollowMany(relationships []FollowRelationship, opts ...FollowManyOption) error
- func (c *Client) NotificationFeed(slug, userID string) *NotificationFeed
- type ClientOption
- type Duration
- type Feed
- type FlatFeed
- func (f *FlatFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
- func (f *FlatFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
- func (f *FlatFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
- func (f *FlatFeed) GetActivities(opts ...GetActivitiesOption) (*FlatFeedResponse, error)
- func (f *FlatFeed) GetActivitiesWithRanking(ranking string, opts ...GetActivitiesOption) (*FlatFeedResponse, error)
- func (f *FlatFeed) GetFollowers(opts ...FollowersOption) (*FollowersResponse, error)
- func (f *FlatFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
- func (f *FlatFeed) GetNextPageActivities(resp *FlatFeedResponse) (*FlatFeedResponse, error)
- func (f *FlatFeed) ID() string
- func (f *FlatFeed) RealtimeToken(readonly bool) string
- func (f *FlatFeed) RemoveActivityByForeignID(foreignID string) error
- func (f *FlatFeed) RemoveActivityByID(id string) error
- func (f *FlatFeed) Slug() string
- func (f *FlatFeed) Unfollow(target Feed, opts ...UnfollowOption) error
- func (f *FlatFeed) UpdateActivities(activities ...Activity) error
- func (f *FlatFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
- func (f *FlatFeed) UserID() string
- type FlatFeedResponse
- type FollowFeedOption
- type FollowManyOption
- type FollowRelationship
- type FollowRelationshipOption
- type Follower
- type FollowersOption
- type FollowersResponse
- type FollowingOption
- type FollowingResponse
- type GetActivitiesOption
- func WithActivitiesIDGT(id string) GetActivitiesOption
- func WithActivitiesIDGTE(id string) GetActivitiesOption
- func WithActivitiesIDLT(id string) GetActivitiesOption
- func WithActivitiesIDLTE(id string) GetActivitiesOption
- func WithActivitiesLimit(limit int) GetActivitiesOption
- func WithActivitiesOffset(offset int) GetActivitiesOption
- func WithCustomParam(name, value string) GetActivitiesOption
- func WithNotificationsMarkRead(all bool, activityIDs ...string) GetActivitiesOption
- func WithNotificationsMarkSeen(all bool, activityIDs ...string) GetActivitiesOption
- type NotificationFeed
- func (f *NotificationFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
- func (f *NotificationFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
- func (f *NotificationFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
- func (f *NotificationFeed) GetActivities(opts ...GetActivitiesOption) (*NotificationFeedResponse, error)
- func (f *NotificationFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
- func (f *NotificationFeed) GetNextPageActivities(resp *NotificationFeedResponse) (*NotificationFeedResponse, error)
- func (f *NotificationFeed) ID() string
- func (f *NotificationFeed) RealtimeToken(readonly bool) string
- func (f *NotificationFeed) RemoveActivityByForeignID(foreignID string) error
- func (f *NotificationFeed) RemoveActivityByID(id string) error
- func (f *NotificationFeed) Slug() string
- func (f *NotificationFeed) Unfollow(target Feed, opts ...UnfollowOption) error
- func (f *NotificationFeed) UpdateActivities(activities ...Activity) error
- func (f *NotificationFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
- func (f *NotificationFeed) UserID() string
- type NotificationFeedResponse
- type NotificationFeedResult
- type Requester
- type Time
- type UnfollowOption
- type UpdateToTargetsOption
Constants ¶
const (
// TimeLayout is the default time parse layout for Stream API JSON time fields
TimeLayout = "2006-01-02T15:04:05.999999"
)
Variables ¶
var ( // ErrMissingNextPage is returned when trying to read the next page of a response // which has an empty "next" field. ErrMissingNextPage = fmt.Errorf("request missing next page") // ErrInvalidNextPage is returned when trying to read the next page of a response // which has an invalid "next" field. ErrInvalidNextPage = fmt.Errorf("invalid format for Next field") )
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code int `json:"code,omitempty"` Detail string `json:"detail,omitempty"` Duration Duration `json:"duration,omitempty"` Exception string `json:"exception,omitempty"` ExceptionFields map[string][]interface{} `json:"exception_fields,omitempty"` StatusCode int `json:"status_code,omitempty"` }
APIError is an error returned by Stream API when the request cannot be performed or errored server side.
func ToAPIError ¶
ToAPIError tries to cast the provided error to APIError type, returning the obtained APIError and whether the operation was successful.
type Activity ¶
type Activity struct { ID string `json:"id,omitempty"` Actor string `json:"actor,omitempty"` Verb string `json:"verb,omitempty"` Object string `json:"object,omitempty"` ForeignID string `json:"foreign_id,omitempty"` Target string `json:"target,omitempty"` Time Time `json:"time,omitempty"` Origin string `json:"origin,omitempty"` To []string `json:"to,omitempty"` Score float64 `json:"score,omitempty"` Extra map[string]interface{} `json:"-"` }
Activity is a Stream activity entity.
func (Activity) MarshalJSON ¶
MarshalJSON encodes the Activity to a valid JSON bytes slice. It's required because of the custom JSON fields and time formats.
func (*Activity) UnmarshalJSON ¶
UnmarshalJSON decodes the provided JSON payload into the Activity. It's required because of the custom JSON fields and time formats.
type ActivityGroup ¶
type ActivityGroup struct { Activities []Activity `json:"activities,omitempty"` ActivityCount int `json:"activity_count,omitempty"` ActorCount int `json:"actor_count,omitempty"` Group string `json:"group,omitempty"` ID string `json:"id,omitempty"` Verb string `json:"verb,omitempty"` }
ActivityGroup is a group of Activity obtained from aggregated feeds.
type AddActivitiesResponse ¶
type AddActivitiesResponse struct { Activities []Activity `json:"activities,omitempty"` // contains filtered or unexported fields }
AddActivitiesResponse is the API response obtained when adding activities to a feed.
type AddActivityResponse ¶
type AddActivityResponse struct { Activity // contains filtered or unexported fields }
AddActivityResponse is the API response obtained when adding a single activity to a feed.
type AddToManyRequest ¶
type AddToManyRequest struct { Activity Activity `json:"activity,omitempty"` FeedIDs []string `json:"feeds,omitempty"` }
AddToManyRequest is the API request body for adding an activity to multiple feeds at once.
type AggregatedFeed ¶
type AggregatedFeed struct {
// contains filtered or unexported fields
}
AggregatedFeed is a Stream aggregated feed, which contains activities grouped based on the grouping function defined on the dashboard.
func (*AggregatedFeed) AddActivities ¶
func (f *AggregatedFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
AddActivities adds multiple activities to the feed.
func (*AggregatedFeed) AddActivity ¶
func (f *AggregatedFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
AddActivity adds a new Activity to the feed.
func (*AggregatedFeed) Follow ¶
func (f *AggregatedFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
Follow follows the provided feed (which must be a FlatFeed), applying the provided FollowFeedOptions, if any.
func (*AggregatedFeed) GetActivities ¶
func (f *AggregatedFeed) GetActivities(opts ...GetActivitiesOption) (*AggregatedFeedResponse, error)
GetActivities requests and retrieves the activities and groups for the aggregated feed.
func (*AggregatedFeed) GetFollowing ¶
func (f *AggregatedFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
GetFollowing returns the list of the feeds following the feed, applying the provided FollowingOptions, if any.
func (*AggregatedFeed) GetNextPageActivities ¶
func (f *AggregatedFeed) GetNextPageActivities(resp *AggregatedFeedResponse) (*AggregatedFeedResponse, error)
GetNextPageActivities returns the activities for the given AggregatedFeed at the "next" page of a previous *AggregatedFeedResponse response, if any.
func (*AggregatedFeed) ID ¶
func (f *AggregatedFeed) ID() string
ID returns the feed ID, as slug:user_id.
func (*AggregatedFeed) RealtimeToken ¶
RealtimeToken returns a token that can be used client-side to listen in real-time to feed changes.
func (*AggregatedFeed) RemoveActivityByForeignID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided foreignID string argument as the foreign_id field of the activity.
func (*AggregatedFeed) RemoveActivityByID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided id string argument as the ID field of the activity.
func (*AggregatedFeed) Unfollow ¶
func (f *AggregatedFeed) Unfollow(target Feed, opts ...UnfollowOption) error
Unfollow unfollows the provided feed, applying the provided UnfollowOptions, if any.
func (*AggregatedFeed) UpdateActivities ¶
UpdateActivities updates existing activities in the feed.
func (*AggregatedFeed) UpdateToTargets ¶
func (f *AggregatedFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
UpdateToTargets updates the "to" targets for the provided activity, with the options passed as argument for replacing, adding, or removing to targets.
type AggregatedFeedResponse ¶
type AggregatedFeedResponse struct { Results []ActivityGroup `json:"results,omitempty"` // contains filtered or unexported fields }
AggregatedFeedResponse is the API response obtained when retrieving activities from an aggregated feed.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Stream API client used for retrieving feeds and performing API calls.
func NewClient ¶
func NewClient(key, secret string, opts ...ClientOption) (*Client, error)
NewClient builds a new Client with the provided API key and secret. It can be configured further by passing any number of ClientOption parameters.
func NewClientFromEnv ¶
NewClientFromEnv build a new Client using environment variables values, with possible values being STREAM_API_KEY, STREAM_API_SECRET, STREAM_API_REGION, and STREAM_API_VERSION.
func (*Client) AggregatedFeed ¶
func (c *Client) AggregatedFeed(slug, userID string) *AggregatedFeed
AggregatedFeed returns a new Aggregated Feed with the provided slug and userID.
func (*Client) FollowMany ¶
func (c *Client) FollowMany(relationships []FollowRelationship, opts ...FollowManyOption) error
FollowMany creates multiple follows at once.
func (*Client) NotificationFeed ¶
func (c *Client) NotificationFeed(slug, userID string) *NotificationFeed
NotificationFeed returns a new Notification Feed with the provided slug and userID.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function used for adding specific configuration options to a Stream client.
func WithAPIRegion ¶
func WithAPIRegion(region string) ClientOption
WithAPIRegion sets the region for a given Client.
func WithAPIVersion ¶
func WithAPIVersion(version string) ClientOption
WithAPIVersion sets the version for a given Client.
func WithHTTPRequester ¶
func WithHTTPRequester(requester Requester) ClientOption
WithHTTPRequester sets the HTTP requester for a given client, used mostly for testing.
type Duration ¶
Duration wraps time.Duration, used because of JSON marshaling and unmarshaling.
func (Duration) MarshalJSON ¶
MarshalJSON marshals the Duration to a string like "30s".
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON for Duration is required because of the incoming duration string.
type Feed ¶
type Feed interface { ID() string Slug() string UserID() string AddActivity(Activity) (*AddActivityResponse, error) AddActivities(...Activity) (*AddActivitiesResponse, error) UpdateActivities(...Activity) error RemoveActivityByID(string) error RemoveActivityByForeignID(string) error Follow(*FlatFeed, ...FollowFeedOption) error GetFollowing(...FollowingOption) (*FollowingResponse, error) Unfollow(Feed, ...UnfollowOption) error UpdateToTargets(Activity, ...UpdateToTargetsOption) error RealtimeToken(bool) string }
Feed is a generic Stream feed, exporting the generic functions common to any Stream feed.
type FlatFeed ¶
type FlatFeed struct {
// contains filtered or unexported fields
}
FlatFeed is a Stream flat feed.
func (*FlatFeed) AddActivities ¶
func (f *FlatFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
AddActivities adds multiple activities to the feed.
func (*FlatFeed) AddActivity ¶
func (f *FlatFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
AddActivity adds a new Activity to the feed.
func (*FlatFeed) Follow ¶
func (f *FlatFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
Follow follows the provided feed (which must be a FlatFeed), applying the provided FollowFeedOptions, if any.
func (*FlatFeed) GetActivities ¶
func (f *FlatFeed) GetActivities(opts ...GetActivitiesOption) (*FlatFeedResponse, error)
GetActivities returns the activities for the given FlatFeed, filtering results with the provided GetActivitiesOption parameters.
func (*FlatFeed) GetActivitiesWithRanking ¶
func (f *FlatFeed) GetActivitiesWithRanking(ranking string, opts ...GetActivitiesOption) (*FlatFeedResponse, error)
GetActivitiesWithRanking returns the activities (filtered) for the given FlatFeed, using the provided ranking method.
func (*FlatFeed) GetFollowers ¶
func (f *FlatFeed) GetFollowers(opts ...FollowersOption) (*FollowersResponse, error)
GetFollowers returns the feeds following the given FlatFeed.
func (*FlatFeed) GetFollowing ¶
func (f *FlatFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
GetFollowing returns the list of the feeds following the feed, applying the provided FollowingOptions, if any.
func (*FlatFeed) GetNextPageActivities ¶
func (f *FlatFeed) GetNextPageActivities(resp *FlatFeedResponse) (*FlatFeedResponse, error)
GetNextPageActivities returns the activities for the given FlatFeed at the "next" page of a previous *FlatFeedResponse response, if any.
func (*FlatFeed) RealtimeToken ¶
RealtimeToken returns a token that can be used client-side to listen in real-time to feed changes.
func (*FlatFeed) RemoveActivityByForeignID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided foreignID string argument as the foreign_id field of the activity.
func (*FlatFeed) RemoveActivityByID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided id string argument as the ID field of the activity.
func (*FlatFeed) Unfollow ¶
func (f *FlatFeed) Unfollow(target Feed, opts ...UnfollowOption) error
Unfollow unfollows the provided feed, applying the provided UnfollowOptions, if any.
func (*FlatFeed) UpdateActivities ¶
UpdateActivities updates existing activities in the feed.
func (*FlatFeed) UpdateToTargets ¶
func (f *FlatFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
UpdateToTargets updates the "to" targets for the provided activity, with the options passed as argument for replacing, adding, or removing to targets.
type FlatFeedResponse ¶
type FlatFeedResponse struct { Results []Activity `json:"results,omitempty"` // contains filtered or unexported fields }
FlatFeedResponse is the API response obtained when retrieving activities from a flat feed.
type FollowFeedOption ¶
type FollowFeedOption func(*followFeedOptions)
FollowFeedOption is a function used to customize FollowFeed API calls.
func WithFollowFeedActivityCopyLimit ¶
func WithFollowFeedActivityCopyLimit(activityCopyLimit int) FollowFeedOption
WithFollowFeedActivityCopyLimit sets the activity copy threshold for Follow Feed API calls.
type FollowManyOption ¶
type FollowManyOption struct {
// contains filtered or unexported fields
}
FollowManyOption is an option to customize behavior of Follow Many calls.
func WithFollowManyActivityCopyLimit ¶
func WithFollowManyActivityCopyLimit(activityCopyLimit int) FollowManyOption
WithFollowManyActivityCopyLimit sets how many activities should be copied from the target feed.
type FollowRelationship ¶
type FollowRelationship struct { Source string `json:"source,omitempty"` Target string `json:"target,omitempty"` ActivityCopyLimit *int `json:"activity_copy_limit,omitempty"` }
FollowRelationship represents a follow relationship between a source ("follower") and a target ("following"), used for FollowMany requests.
func NewFollowRelationship ¶
func NewFollowRelationship(source, target Feed, opts ...FollowRelationshipOption) FollowRelationship
NewFollowRelationship is a helper for creating a FollowRelationship from the source ("follower") and target ("following") feeds.
type FollowRelationshipOption ¶
type FollowRelationshipOption func(r *FollowRelationship)
FollowRelationshipOption customizes a FollowRelationship.
func WithFollowRelationshipActivityCopyLimit ¶
func WithFollowRelationshipActivityCopyLimit(activityCopyLimit int) FollowRelationshipOption
WithFollowRelationshipActivityCopyLimit sets the ActivityCopyLimit field for a given FollowRelationship.
type Follower ¶
type Follower struct { FeedID string `json:"feed_id,omitempty"` TargetID string `json:"target_id,omitempty"` }
Follower is the representation of a feed following another feed.
type FollowersOption ¶
type FollowersOption struct {
// contains filtered or unexported fields
}
FollowersOption is an option usable by followers feed methods.
func WithFollowersLimit ¶
func WithFollowersLimit(limit int) FollowersOption
WithFollowersLimit limits the number of followers in the response to the provided limit.
func WithFollowersOffset ¶
func WithFollowersOffset(offset int) FollowersOption
WithFollowersOffset returns followers starting from the given offset.
type FollowersResponse ¶
type FollowersResponse struct {
// contains filtered or unexported fields
}
FollowersResponse is the API response obtained when retrieving followers from a feed.
type FollowingOption ¶
type FollowingOption struct {
// contains filtered or unexported fields
}
FollowingOption is an option usable by following feed methods.
func WithFollowingFilter ¶
func WithFollowingFilter(ids ...string) FollowingOption
WithFollowingFilter adds the filter parameter to API calls, used when retrieving following feeds, allowing the check whether certain feeds are being followed.
func WithFollowingLimit ¶
func WithFollowingLimit(limit int) FollowingOption
WithFollowingLimit limits the number of followings in the response to the provided limit.
func WithFollowingOffset ¶
func WithFollowingOffset(offset int) FollowingOption
WithFollowingOffset returns followings starting from the given offset.
type FollowingResponse ¶
type FollowingResponse struct {
// contains filtered or unexported fields
}
FollowingResponse is the API response obtained when retrieving following feeds from a feed.
type GetActivitiesOption ¶
type GetActivitiesOption struct {
// contains filtered or unexported fields
}
GetActivitiesOption is an option usable by GetActivities methods for flat and aggregated feeds.
func WithActivitiesIDGT ¶
func WithActivitiesIDGT(id string) GetActivitiesOption
WithActivitiesIDGT adds the id_gt parameter to API calls, used when retrieving paginated activities from feeds, returning activities with ID greater than the provided id.
func WithActivitiesIDGTE ¶
func WithActivitiesIDGTE(id string) GetActivitiesOption
WithActivitiesIDGTE adds the id_gte parameter to API calls, used when retrieving paginated activities from feeds, returning activities with ID greater or equal than the provided id.
func WithActivitiesIDLT ¶
func WithActivitiesIDLT(id string) GetActivitiesOption
WithActivitiesIDLT adds the id_lt parameter to API calls, used when retrieving paginated activities from feeds, returning activities with ID lesser than the provided id.
func WithActivitiesIDLTE ¶
func WithActivitiesIDLTE(id string) GetActivitiesOption
WithActivitiesIDLTE adds the id_lte parameter to API calls, used when retrieving paginated activities from feeds, returning activities with ID lesser or equal than the provided id.
func WithActivitiesLimit ¶
func WithActivitiesLimit(limit int) GetActivitiesOption
WithActivitiesLimit adds the limit parameter to API calls which support it, limiting the number of results in the response to the provided limit threshold. Supported operations: retrieve activities, retrieve followers, retrieve following.
func WithActivitiesOffset ¶
func WithActivitiesOffset(offset int) GetActivitiesOption
WithActivitiesOffset adds the offset parameter to API calls which support it, getting results starting from the provided offset index. Supported operations: retrieve activities, retrieve followers, retrieve following.
func WithCustomParam ¶
func WithCustomParam(name, value string) GetActivitiesOption
WithCustomParam adds a custom parameter to the read request.
func WithNotificationsMarkRead ¶
func WithNotificationsMarkRead(all bool, activityIDs ...string) GetActivitiesOption
WithNotificationsMarkRead marks as read the given activity ids in a notification feed. If the all parameter is true, every activity in the feed is marked as read.
func WithNotificationsMarkSeen ¶
func WithNotificationsMarkSeen(all bool, activityIDs ...string) GetActivitiesOption
WithNotificationsMarkSeen marks as seen the given activity ids in a notification feed. If the all parameter is true, every activity in the feed is marked as seen.
type NotificationFeed ¶
type NotificationFeed struct {
// contains filtered or unexported fields
}
NotificationFeed is a Stream notification feed.
func (*NotificationFeed) AddActivities ¶
func (f *NotificationFeed) AddActivities(activities ...Activity) (*AddActivitiesResponse, error)
AddActivities adds multiple activities to the feed.
func (*NotificationFeed) AddActivity ¶
func (f *NotificationFeed) AddActivity(activity Activity) (*AddActivityResponse, error)
AddActivity adds a new Activity to the feed.
func (*NotificationFeed) Follow ¶
func (f *NotificationFeed) Follow(feed *FlatFeed, opts ...FollowFeedOption) error
Follow follows the provided feed (which must be a FlatFeed), applying the provided FollowFeedOptions, if any.
func (*NotificationFeed) GetActivities ¶
func (f *NotificationFeed) GetActivities(opts ...GetActivitiesOption) (*NotificationFeedResponse, error)
GetActivities returns the activities for the given NotificationFeed, filtering results with the provided GetActivitiesOption parameters.
func (*NotificationFeed) GetFollowing ¶
func (f *NotificationFeed) GetFollowing(opts ...FollowingOption) (*FollowingResponse, error)
GetFollowing returns the list of the feeds following the feed, applying the provided FollowingOptions, if any.
func (*NotificationFeed) GetNextPageActivities ¶
func (f *NotificationFeed) GetNextPageActivities(resp *NotificationFeedResponse) (*NotificationFeedResponse, error)
GetNextPageActivities returns the activities for the given NotificationFeed at the "next" page of a previous *NotificationFeedResponse response, if any.
func (*NotificationFeed) ID ¶
func (f *NotificationFeed) ID() string
ID returns the feed ID, as slug:user_id.
func (*NotificationFeed) RealtimeToken ¶
RealtimeToken returns a token that can be used client-side to listen in real-time to feed changes.
func (*NotificationFeed) RemoveActivityByForeignID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided foreignID string argument as the foreign_id field of the activity.
func (*NotificationFeed) RemoveActivityByID ¶
RemoveActivityByID removes an activity from the feed (if present), using the provided id string argument as the ID field of the activity.
func (*NotificationFeed) Slug ¶
func (f *NotificationFeed) Slug() string
Slug returns the feed's slug.
func (*NotificationFeed) Unfollow ¶
func (f *NotificationFeed) Unfollow(target Feed, opts ...UnfollowOption) error
Unfollow unfollows the provided feed, applying the provided UnfollowOptions, if any.
func (*NotificationFeed) UpdateActivities ¶
UpdateActivities updates existing activities in the feed.
func (*NotificationFeed) UpdateToTargets ¶
func (f *NotificationFeed) UpdateToTargets(activity Activity, opts ...UpdateToTargetsOption) error
UpdateToTargets updates the "to" targets for the provided activity, with the options passed as argument for replacing, adding, or removing to targets.
type NotificationFeedResponse ¶
type NotificationFeedResponse struct { Unseen int `json:"unseen"` Unread int `json:"unread"` Results []NotificationFeedResult `json:"results"` // contains filtered or unexported fields }
NotificationFeedResponse is the API response obtained when retrieving activities from a notification feed.
type NotificationFeedResult ¶
type NotificationFeedResult struct { ID string `json:"id"` Activities []Activity `json:"activities"` ActivityCount int `json:"activity_count"` ActorCount int `json:"actor_count"` Group string `json:"group"` IsRead bool `json:"is_read"` IsSeen bool `json:"is_seen"` Verb string `json:"verb"` }
NotificationFeedResult is a notification-feed specific response, containing the list of activities in the group, plus the extra fields about the group read+seen status.
type Time ¶
Time wraps time.Time, used because of custom API time format in JSON marshaling and unmarshaling.
func (Time) MarshalJSON ¶
MarshalJSON marshals Time into a string formatted with the TimeLayout format.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON for Time is required because of the incoming time string format.
type UnfollowOption ¶
type UnfollowOption struct {
// contains filtered or unexported fields
}
UnfollowOption is an option usable with the Unfollow feed method.
func WithUnfollowKeepHistory ¶
func WithUnfollowKeepHistory(keepHistory bool) UnfollowOption
WithUnfollowKeepHistory adds the keep_history parameter to API calls, used to keep history when unfollowing feeds, rather than purging it (default behavior). If the keepHistory parameter is false, nothing happens.
type UpdateToTargetsOption ¶
type UpdateToTargetsOption func(*updateToTargetsRequest)
UpdateToTargetsOption determines what operations perform during an UpdateToTargets API call.
func WithToTargetsAdd ¶
func WithToTargetsAdd(targets ...string) UpdateToTargetsOption
WithToTargetsAdd sets the add to targets, adding them to the activity's existing ones.
func WithToTargetsNew ¶
func WithToTargetsNew(targets ...string) UpdateToTargetsOption
WithToTargetsNew sets the new to targets, replacing all the existing ones. It cannot be used in combination with any other UpdateToTargetsOption.
func WithToTargetsRemove ¶
func WithToTargetsRemove(targets ...string) UpdateToTargetsOption
WithToTargetsRemove sets the remove to targets, removing them from activity's the existing ones.