Documentation ¶
Index ¶
- Variables
- type Client
- func (f *Client) AddActivity(ctx context.Context, feedID *string, activity *stream.Activity) error
- func (f *Client) AddActivityToManyFeeds(ctx context.Context, activity *stream.Activity, feeds ...stream.Feed) error
- func (c *Client) ApplyOptions(opts ...Option)
- func (c *Client) CreateAggregateFeed(feedType FeedType, feedSlug string) (*stream.AggregatedFeed, error)
- func (c *Client) CreateFlatFeed(feedType FeedType, feedSlug string) (*stream.FlatFeed, error)
- func (c *Client) CreateNotificationFeed(feedType FeedType, feedSlug string) (*stream.NotificationFeed, error)
- func (f *Client) DeleteActivity(ctx context.Context, feedID *string, activityForeignID *string) error
- func (f *Client) FollowFeed(ctx context.Context, sourceFeedID, targetFeedID string, ...) error
- func (f *Client) GetFlatFeedFromFeedID(feedID *string) (*stream.FlatFeed, error)
- func (f *Client) GetNotificationFeedFromFeedID(feedID *string) (*stream.NotificationFeed, error)
- func (f *Client) GetNotificationTimeline(ctx context.Context, feedID *string) ([]stream.NotificationFeedResult, error)
- func (f *Client) GetTimeline(ctx context.Context, feedID *string) ([]stream.Activity, error)
- func (f *Client) SendFollowRequestNotification(ctx context.Context, notificationFeedID string, params *FollowRequestActivity) error
- func (c *Client) Validate() error
- type FeedType
- type FollowRequestActivity
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
This is defining a struct type called `Client` which will be used to create instances of the GetStream client. The struct contains fields for the GetStream API key, secret, a pointer to a `stream.Client` instance, a logger, and an instrumentation client.
func (*Client) AddActivity ¶
This is a method of the `Client` struct that adds an activity to a feed specified by `feedID`. It takes in a `context.Context` object, a pointer to a string `feedID`, and a pointer to a `stream.Activity` object. It returns an error if there is an issue with the input arguments or if there is an error adding the activity to the feed. The method first checks if the input arguments are valid, gets the flat feed from the feed ID, adds the activity to the feed, and logs the creation of the activity.
func (*Client) AddActivityToManyFeeds ¶
func (f *Client) AddActivityToManyFeeds(ctx context.Context, activity *stream.Activity, feeds ...stream.Feed) error
`func (f *Client) AddActivityToManyFeeds(ctx context.Context, activity *stream.Activity, feeds ...stream.Feed) error` is a method of the `Client` struct that adds an activity to multiple feeds specified by `feeds`. It takes in a `context.Context` object, a pointer to a `stream.Activity` object, and a variadic argument of type `stream.Feed`. It returns an error if there is an issue with the input arguments or if there is an error adding the activity to the feeds. The method first checks if the input arguments are valid, and then adds the activity to all the specified feeds using the `AddToMany` method of the `stream.Client` object.
func (*Client) ApplyOptions ¶
The function ApplyOptions takes a variadic number of Options and applies them to the Client.
func (*Client) CreateAggregateFeed ¶
func (c *Client) CreateAggregateFeed(feedType FeedType, feedSlug string) (*stream.AggregatedFeed, error)
`func (c *Client) CreateAggregateFeed(feedType, feedSlug string) (*stream.AggregatedFeed, error)` is a method of the `Client` struct that creates a new `AggregatedFeed` object in the GetStream API based on the given feed type and feed slug. It takes the feed type and feed slug as input arguments and returns a pointer to the newly created `AggregatedFeed` object and any error that occurred during the API call. The method first checks if the input arguments are valid, and then calls the `AggregatedFeed` method of the `stream.Client` instance stored in the `Client` struct, passing in the feed type and feed slug as arguments.
func (*Client) CreateFlatFeed ¶
`func (c *Client) CreateFlatFeed(feedType, feedSlug string) (*stream.FlatFeed, error)` is a method of the `Client` struct that creates a new `FlatFeed` object in the GetStream API based on the given feed type and feed slug. It takes the feed type and feed slug as input arguments and returns a pointer to the newly created `FlatFeed` object and any error that occurred during the API call. The method first checks if the input arguments are valid, and then calls the `FlatFeed` method of the `stream.Client` instance stored in the `Client` struct, passing in the feed type and feed slug as arguments.
func (*Client) CreateNotificationFeed ¶
func (c *Client) CreateNotificationFeed(feedType FeedType, feedSlug string) (*stream.NotificationFeed, error)
`func (c *Client) CreateNotificationFeed(feedType, feedSlug string) (*stream.NotificationFeed, error)` is a method of the `Client` struct that creates a new `NotificationFeed` object in the GetStream API based on the given feed type and feed slug. It takes the feed type and feed slug as input arguments and returns a pointer to the newly created `NotificationFeed` object and any error that occurred during the API call. The method first checks if the input arguments are valid, and then calls the `NotificationFeed` method of the `stream.Client` instance stored in the `Client` struct, passing in the feed type and feed slug as arguments.
func (*Client) DeleteActivity ¶
func (f *Client) DeleteActivity(ctx context.Context, feedID *string, activityForeignID *string) error
The `DeleteActivity` function is a method of the `Client` struct that deletes an activity from a feed specified by `feedID` and `activityForeignID`. It takes in a `context.Context` object, a pointer to a string `feedID`, and a pointer to a string `activityForeignID`. It returns an error if there is an issue with the input arguments or if there is an error deleting the activity from the feed. The method first checks if the input arguments are valid, gets the flat feed from the feed ID, removes the activity from the feed using the foreign ID, and logs the removal of the activity.
func (*Client) FollowFeed ¶
func (f *Client) FollowFeed(ctx context.Context, sourceFeedID, targetFeedID string, opts []stream.FollowFeedOption) error
This is a method defined on a struct type `Client`. The method is called `FollowFeed` and it takes in four arguments: a context, two strings `sourceFeedID` and `targetFeedID`, and a slice of `stream.FollowFeedOption` options. The method returns an error.
func (*Client) GetFlatFeedFromFeedID ¶
`func (f *Client) GetFlatFeedFromFeedID(feedID *string) (*stream.FlatFeed, error)` is a method of the `Client` struct that takes a pointer to a string as input and returns a pointer to a `stream.FlatFeed` object and an error. It is used to retrieve a `FlatFeed` object from the GetStream API based on a given feed ID. The method first validates the feed ID using the `validateFeedID` method, and then splits the feed ID into its constituent parts (feed type and feed slug) using the `strings.Split` function. Finally, it calls the `FlatFeed` method of the `stream.Client` instance stored in the `Client` struct, passing in the feed type and feed slug as arguments, and returns the resulting `FlatFeed` object and any error that occurred during the API call.
func (*Client) GetNotificationFeedFromFeedID ¶
`func (f *Client) GetNotificationFeedFromFeedID(feedID *string) (*stream.NotificationFeed, error)` is a method of the `Client` struct that takes a pointer to a string as input and returns a pointer to a `stream.NotificationFeed` object and an error. It is used to retrieve a `NotificationFeed` object from the GetStream API based on a given feed ID. The method first validates the feed ID using the `validateFeedID` method, and then splits the feed ID into its constituent parts (feed type and feed slug) using the `strings.Split` function. Finally, it calls the `NotificationFeed` method of the `stream.Client` instance stored in the `Client` struct, passing in the feed type and feed slug as arguments, and returns the resulting `NotificationFeed` object and any error that occurred during the API call.
func (*Client) GetNotificationTimeline ¶
func (f *Client) GetNotificationTimeline(ctx context.Context, feedID *string) ([]stream.NotificationFeedResult, error)
`func (f *Client) GetNotificationTimeline(ctx context.Context, feedID *string) ([]stream.NotificationFeedResult, error)` is a method defined on the `Client` struct that retrieves a timeline of notification activities from a notification feed identified by the `feedID` parameter. It returns a slice of `stream.NotificationFeedResult` objects and an error if there was a problem retrieving the activities. The method takes a `context.Context` object as the first parameter to allow for cancellation or timeout of the request.
func (*Client) GetTimeline ¶
This is a method defined on the `Client` struct that retrieves a timeline of activities from a flat feed identified by the `feedID` parameter. It returns a slice of `stream.Activity` objects and an error if there was a problem retrieving the activities. The method takes a `context.Context` object as the first parameter to allow for cancellation or timeout of the request.
func (*Client) SendFollowRequestNotification ¶
func (f *Client) SendFollowRequestNotification(ctx context.Context, notificationFeedID string, params *FollowRequestActivity) error
This is a method defined on a struct type `Client`. The method is named `SendFollowRequestNotification` and it takes three parameters: a context object `ctx`, a string `notificationFeedID`, and a pointer to a `FollowRequestActivity` struct `params`. The method returns an error.
type FollowRequestActivity ¶
type Option ¶
type Option func(*Client)
func WithInstrumentationClient ¶
func WithInstrumentationClient(instrumentationClient *instrumentation.Client) Option
The function WithInstrumentationClient takes a pointer to a instrumentation.Client and returns an Option.
func WithLogger ¶
The function WithLogger takes a pointer to a zap.Logger and returns an Option.
func WithSecret ¶
The function WithSecret takes a string and returns an Option.