Documentation ¶
Index ¶
- Variables
- type ActivityResponse
- type Client
- func (f *Client) AddActivity(ctx context.Context, feedID *string, activity *stream.Activity) (*stream.AddActivityResponse, 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) (*stream.RemoveActivityResponse, error)
- func (f *Client) FollowFeed(ctx context.Context, sourceFeedID, targetFeedID string, ...) (*stream.BaseResponse, 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, opts []stream.GetActivitiesOption) (*stream.NotificationFeedResponse, error)
- func (f *Client) GetTimeline(ctx context.Context, feedID *string) (*stream.FlatFeedResponse, error)
- func (f *Client) GetTimelineNextPage(ctx context.Context, feedID *string, opts []stream.GetActivitiesOption) (*stream.FlatFeedResponse, error)
- func (f *Client) SendFollowRequestNotification(ctx context.Context, notificationFeedID string, params *FollowRequestActivity) (*stream.AddActivityResponse, error)
- func (c *Client) Validate() error
- type FeedType
- type FollowRequestActivity
- type IClient
- type Option
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ActivityResponse ¶ added in v1.0.5
type ActivityResponse struct { }
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 ¶
func (f *Client) AddActivity(ctx context.Context, feedID *string, activity *stream.Activity) (*stream.AddActivityResponse, error)
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) (*stream.RemoveActivityResponse, 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) (*stream.BaseResponse, 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, opts []stream.GetActivitiesOption) (*stream.NotificationFeedResponse, 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) GetTimelineNextPage ¶ added in v1.0.5
func (*Client) SendFollowRequestNotification ¶
func (f *Client) SendFollowRequestNotification(ctx context.Context, notificationFeedID string, params *FollowRequestActivity) (*stream.AddActivityResponse, 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 IClient ¶ added in v1.0.5
type IClient interface { // `GetFlatFeedFromFeedID(feedID *string) (*stream.FlatFeed, error)` is a method defined in the // `IClient` interface and implemented in the `Client` struct. It takes a pointer to a string `feedID` // as input and returns a pointer to a `stream.FlatFeed` and an error. This method is used to retrieve // a flat feed from the GetStream API based on the provided `feedID`. A flat feed is a feed that // contains all activities in chronological order, without any grouping or aggregation. The method // returns a pointer to the retrieved `stream.FlatFeed` object and an error if there was an issue // retrieving the feed. GetFlatFeedFromFeedID(feedID *string) (*stream.FlatFeed, error) // `GetNotificationFeedFromFeedID(feedID *string) (*stream.NotificationFeed, error)` is a method // defined in the `IClient` interface and implemented in the `Client` struct. It takes a pointer to a // string `feedID` as input and returns a pointer to a `stream.NotificationFeed` and an error. This // method is used to retrieve a notification feed from the GetStream API based on the provided // `feedID`. A notification feed is a feed that contains activities related to notifications, such as // when a user is mentioned or receives a direct message. The method returns a pointer to the retrieved // `stream.NotificationFeed` object and an error if there was an issue retrieving the feed. GetNotificationFeedFromFeedID(feedID *string) (*stream.NotificationFeed, error) // `CreateFlatFeed` is a method defined in the `IClient` interface and implemented in the `Client` // struct. It takes a `FeedType` and a `feedSlug` as input and returns a pointer to a `stream.FlatFeed` // and an error. This method is used to create a new flat feed on the GetStream API with the specified // `feedType` and `feedSlug`. A flat feed is a feed that contains all activities in chronological // order, without any grouping or aggregation. The method returns a pointer to the newly created // `stream.FlatFeed` object and an error if there was an issue creating the feed. CreateFlatFeed(feedType FeedType, feedSlug string) (*stream.FlatFeed, error) // `CreateAggregateFeed` is a method defined in the `IClient` interface and implemented in the `Client` // struct. It takes a `FeedType` and a `feedSlug` as input and returns a pointer to a // `stream.AggregatedFeed` and an error. This method is used to create a new aggregated feed on the // GetStream API with the specified `feedType` and `feedSlug`. An aggregated feed is a feed that groups // activities based on certain criteria, such as time or user, and presents them in a summarized // format. The method returns a pointer to the newly created `stream.AggregatedFeed` object and an // error if there was an issue creating the feed. CreateAggregateFeed(feedType FeedType, feedSlug string) (*stream.AggregatedFeed, error) // `CreateNotificationFeed` is a method defined in the `IClient` interface and implemented in the // `Client` struct. It takes a `FeedType` and a `feedSlug` as input and returns a pointer to a // `stream.NotificationFeed` and an error. This method is used to create a new notification feed on the // GetStream API with the specified `feedType` and `feedSlug`. A notification feed is a feed that // contains activities related to notifications, such as when a user is mentioned or receives a direct // message. The method returns a pointer to the newly created `stream.NotificationFeed` object and an // error if there was an issue creating the feed. CreateNotificationFeed(feedType FeedType, feedSlug string) (*stream.NotificationFeed, error) // `AddActivity` is a method defined in the `IClient` interface and implemented in the `Client` struct. // It takes a context, a pointer to a string `feedID`, and a pointer to a `stream.Activity` as input // and returns a pointer to a `stream.AddActivityResponse` and an error. This method is used to add a // new activity to the feed specified by the `feedID`. The `stream.Activity` parameter contains the // data for the new activity. The method returns a pointer to a `stream.AddActivityResponse` object and // an error if there was an issue adding the activity. AddActivity(ctx context.Context, feedID *string, activity *stream.Activity) (*stream.AddActivityResponse, error) // The `DeleteActivity` method is defined in the `IClient` interface and implemented in the `Client` // struct. It takes a context, a pointer to a string `feedID`, and a pointer to a string // `activityForeignID` as input and returns a pointer to a `stream.RemoveActivityResponse` and an // error. This method is used to remove an activity from the feed specified by the `feedID` and // `activityForeignID`. The `activityForeignID` parameter is a unique identifier for the activity that // was assigned by the client when the activity was added to the feed. The method returns a pointer to // a `stream.RemoveActivityResponse` object and an error if there was an issue removing the activity. DeleteActivity(ctx context.Context, feedID *string, activityForeignID *string) (*stream.RemoveActivityResponse, error) // `AddActivityToManyFeeds` is a method defined in the `IClient` interface and implemented in the // `Client` struct. It takes a context, a pointer to a `stream.Activity`, and a variable number of // `stream.Feed` objects as input and returns an error. This method is used to add a new activity to // multiple feeds at once. The `stream.Activity` parameter contains the data for the new activity, and // the `stream.Feed` parameters specify the feeds to which the activity should be added. The method // returns an error if there was an issue adding the activity to any of the specified feeds. AddActivityToManyFeeds(ctx context.Context, activity *stream.Activity, feeds ...stream.Feed) error // `FollowFeed` is a method defined in the `IClient` interface and implemented in the `Client` struct. // It takes a context, a source feed ID, a target feed ID, and an optional list of // `stream.FollowFeedOption` objects as input. This method is used to follow a target feed from a // source feed. The `sourceFeedID` parameter specifies the ID of the feed that will follow the target // feed, and the `targetFeedID` parameter specifies the ID of the feed that will be followed. The // `opts` parameter is an optional list of `stream.FollowFeedOption` objects that can be used to // specify additional options for the follow operation, such as whether to copy existing activities // from the target feed to the source feed. The method returns a pointer to a `stream.BaseResponse` // object and an error if there was an issue following the target feed. FollowFeed(ctx context.Context, sourceFeedID, targetFeedID string, opts []stream.FollowFeedOption) (*stream.BaseResponse, error) // `SendFollowRequestNotification` is a method defined in the `IClient` interface and implemented in // the `Client` struct. It takes a context, a string `notificationFeedID`, and a pointer to a // `FollowRequestActivity` object as input and returns a pointer to a `stream.AddActivityResponse` // object and an error. This method is used to send a follow request notification to the specified // `notificationFeedID`. The `FollowRequestActivity` parameter contains the data for the follow request // activity. The method returns a pointer to a `stream.AddActivityResponse` object and an error if // there was an issue sending the notification. SendFollowRequestNotification(ctx context.Context, notificationFeedID string, params *FollowRequestActivity) (*stream.AddActivityResponse, error) // `GetTimeline` is a method defined in the `IClient` interface and implemented in the `Client` struct. // It takes a context and a pointer to a string `feedID` as input and returns a pointer to a // `stream.FlatFeedResponse` and an error. This method is used to retrieve a timeline feed from the // GetStream API based on the provided `feedID`. A timeline feed is a feed that contains activities // from the user's followers in reverse chronological order. The method returns a pointer to the // retrieved `stream.FlatFeedResponse` object and an error if there was an issue retrieving the feed. GetTimeline(ctx context.Context, feedID *string) (*stream.FlatFeedResponse, error) // `GetNotificationTimeline` is a method defined in the `IClient` interface and implemented in the // `Client` struct. It takes a context and a pointer to a string `feedID` as input and returns a // pointer to a `stream.NotificationFeedResponse` and an error. This method is used to retrieve a // notification timeline feed from the GetStream API based on the provided `feedID`. A notification // timeline feed is a feed that contains activities related to notifications, such as when a user is // mentioned or receives a direct message, from the user's followers in reverse chronological order. // The method returns a pointer to the retrieved `stream.NotificationFeedResponse` object and an error // if there was an issue retrieving the feed. GetNotificationTimeline(ctx context.Context, feedID *string, opts []stream.GetActivitiesOption) (*stream.NotificationFeedResponse, error) // The above code is defining a method called `GetTimelineWithOptions` in the Go programming language. // This method takes in a context object, a pointer to a string representing a feed ID, and an array of // options for getting activities. It returns a `FlatFeedResponse` object and an error. This method is // likely used to retrieve a timeline of activities from a feed with the specified ID and options. GetTimelineNextPage(ctx context.Context, feedID *string, opts []stream.GetActivitiesOption) (*stream.FlatFeedResponse, error) }
`type IClient interface` is defining an interface called `IClient` which specifies a set of methods that a type must implement in order to be considered a valid implementation of the interface. In this case, the `IClient` interface specifies a set of methods that the `Client` struct must implement in order to be considered a valid implementation of the interface. This allows other parts of the code to interact with the `Client` struct through the `IClient` interface, which can make the code more modular and easier to test.
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.