Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertUUIDToWord(uuid string) string
- func ValidateFeedID(feedID string) (string, error)
- func ValidateFeedSlug(feedSlug string) (string, error)
- func ValidateUserID(userID string) (string, error)
- type Activity
- type AggregatedFeed
- func (f *AggregatedFeed) Activities(input *GetAggregatedFeedInput) (*GetAggregatedFeedOutput, error)
- func (f *AggregatedFeed) AddActivities(activities []*Activity) ([]*Activity, error)
- func (f *AggregatedFeed) AddActivity(activity *Activity) (*Activity, error)
- func (f *AggregatedFeed) FeedID() FeedID
- func (f *AggregatedFeed) FeedIDWithoutColon() string
- func (f *AggregatedFeed) FollowFeedWithCopyLimit(target *FlatFeed, copyLimit int) error
- func (f *AggregatedFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *AggregatedFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *AggregatedFeed) GenerateToken(signer *Signer) string
- func (f *AggregatedFeed) RemoveActivity(input *Activity) error
- func (f *AggregatedFeed) RemoveActivityByForeignID(input *Activity) error
- func (f *AggregatedFeed) SignFeed(signer *Signer)
- func (f *AggregatedFeed) Signature() string
- func (f *AggregatedFeed) Token() string
- func (f *AggregatedFeed) Unfollow(target *FlatFeed) error
- func (f *AggregatedFeed) UnfollowKeepingHistory(target *FlatFeed) error
- type Client
- func (c *Client) AbsoluteURL(path string) (*url.URL, error)
- func (c *Client) AddActivityToMany(activity Activity, feeds []string) error
- func (c *Client) AggregatedFeed(feedSlug string, userID string) (*AggregatedFeed, error)
- func (c *Client) FlatFeed(feedSlug string, userID string) (*FlatFeed, error)
- func (c *Client) NotificationFeed(feedSlug string, userID string) (*NotificationFeed, error)
- func (c *Client) PrepFollowAggregatedFeed(targetFeed *FlatFeed, sourceFeed *AggregatedFeed) *PostFlatFeedFollowingManyInput
- func (c *Client) PrepFollowFlatFeed(targetFeed *FlatFeed, sourceFeed *FlatFeed) *PostFlatFeedFollowingManyInput
- func (c *Client) PrepFollowNotificationFeed(targetFeed *FlatFeed, sourceFeed *NotificationFeed) *PostFlatFeedFollowingManyInput
- type Config
- func (c *Config) SetAPIKey(apiKey string) string
- func (c *Config) SetAPISecret(apiSecret string) string
- func (c *Config) SetAppID(appID string) string
- func (c *Config) SetBaseURL(baseURL *url.URL) *url.URL
- func (c *Config) SetLocation(location string) string
- func (c *Config) SetTimeout(timeout int64) time.Duration
- func (c *Config) SetToken(token string) string
- func (c *Config) SetVersion(version string) string
- type Error
- type Feed
- type FeedID
- type FlatFeed
- func (f *FlatFeed) Activities(input *GetFlatFeedInput) (*GetFlatFeedOutput, error)
- func (f *FlatFeed) AddActivities(activities []*Activity) ([]*Activity, error)
- func (f *FlatFeed) AddActivity(activity *Activity) (*Activity, error)
- func (f *FlatFeed) FeedID() FeedID
- func (f *FlatFeed) FeedIDWithoutColon() string
- func (f *FlatFeed) FollowFeedWithCopyLimit(target *FlatFeed, copyLimit int) error
- func (f *FlatFeed) FollowManyFeeds(sourceFeeds []PostFlatFeedFollowingManyInput, copyLimit int) error
- func (f *FlatFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *FlatFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *FlatFeed) GenerateToken(signer *Signer) string
- func (f *FlatFeed) RemoveActivity(input *Activity) error
- func (f *FlatFeed) RemoveActivityByForeignID(input *Activity) error
- func (f *FlatFeed) SignFeed(signer *Signer)
- func (f *FlatFeed) Signature() string
- func (f *FlatFeed) Token() string
- func (f *FlatFeed) Unfollow(target *FlatFeed) error
- func (f *FlatFeed) UnfollowKeepingHistory(target *FlatFeed) error
- func (f *FlatFeed) UpdateActivities(activities []*Activity) error
- func (f *FlatFeed) UpdateActivity(activity *Activity) error
- type GeneralFeed
- func (f *GeneralFeed) FeedID() FeedID
- func (f *GeneralFeed) FeedIDWithoutColon() string
- func (f *GeneralFeed) GenerateToken(signer *Signer) string
- func (f *GeneralFeed) SignFeed(signer *Signer)
- func (f *GeneralFeed) Signature() string
- func (f *GeneralFeed) Token() string
- func (f *GeneralFeed) Unfollow(client *Client, target *FlatFeed) error
- func (f *GeneralFeed) UnfollowAggregated(client *Client, target *AggregatedFeed) error
- func (f *GeneralFeed) UnfollowNotification(client *Client, target *NotificationFeed) error
- type GetAggregatedFeedInput
- type GetAggregatedFeedOutput
- type GetFlatFeedInput
- type GetFlatFeedOutput
- type GetNotificationFeedInput
- type GetNotificationFeedOutput
- type NotificationFeed
- func (f *NotificationFeed) Activities(input *GetNotificationFeedInput) (*GetNotificationFeedOutput, error)
- func (f *NotificationFeed) AddActivities(activities []*Activity) ([]*Activity, error)
- func (f *NotificationFeed) AddActivity(activity *Activity) (*Activity, error)
- func (f *NotificationFeed) FeedID() FeedID
- func (f *NotificationFeed) FeedIDWithoutColon() string
- func (f *NotificationFeed) FollowFeedWithCopyLimit(target *FlatFeed, copyLimit int) error
- func (f *NotificationFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *NotificationFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
- func (f *NotificationFeed) GenerateToken(signer *Signer) string
- func (f *NotificationFeed) MarkActivitiesAsRead(activities []*Activity) error
- func (f *NotificationFeed) MarkActivitiesAsSeenWithLimit(limit int) error
- func (f *NotificationFeed) RemoveActivity(input *Activity) error
- func (f *NotificationFeed) RemoveActivityByForeignID(input *Activity) error
- func (f *NotificationFeed) SignFeed(signer *Signer)
- func (f *NotificationFeed) Signature() string
- func (f *NotificationFeed) Token() string
- func (f *NotificationFeed) Unfollow(target *FlatFeed) error
- func (f *NotificationFeed) UnfollowKeepingHistory(target *FlatFeed) error
- type PostActivityToManyInput
- type PostFlatFeedFollowingManyInput
- type ScopeAction
- type ScopeContext
- type Signer
- func (s Signer) GenerateFeedScopeToken(context ScopeContext, action ScopeAction, feedIDWithoutColon string) (string, error)
- func (s Signer) GenerateToken(message string) string
- func (s Signer) GenerateUserScopeToken(context ScopeContext, action ScopeAction, userID string) (string, error)
- func (s Signer) SignFeed(feedID string) string
- func (s Signer) UrlSafe(src string) string
Constants ¶
const VERSION = "v0.9.0"
Variables ¶
var GETSTREAM_TRANSPORT = &http.Transport{ MaxIdleConns: 5, MaxIdleConnsPerHost: 5, IdleConnTimeout: 60, DisableKeepAlives: false, }
Functions ¶
func ConvertUUIDToWord ¶
ConvertUUIDToWord replaces - with _ It is used by go-getstream to convert UUID to a string that matches the word regex You can use it to convert UUID's to match go-getstream internals.
func ValidateFeedID ¶
func ValidateFeedSlug ¶
func ValidateUserID ¶
Types ¶
type Activity ¶
type Activity struct { ID string Actor FeedID Verb string Object FeedID Target FeedID Origin FeedID TimeStamp *time.Time ForeignID string Data *json.RawMessage MetaData map[string]string To []Feed }
Activity is a getstream Activity Use it to post activities to Feeds It is also the response from Fetch and List Requests
func (Activity) MarshalJSON ¶
MarshalJSON is the custom marshal function for Activities It will be used by json.Marshal()
func (*Activity) UnmarshalJSON ¶
UnmarshalJSON is the custom unmarshal function for Activities It will be used by json.Unmarshal()
type AggregatedFeed ¶
type AggregatedFeed struct { Client *Client FeedSlug string UserID string // contains filtered or unexported fields }
AggregatedFeed is a getstream AggregatedFeed Use it to for CRUD on AggregatedFeed Groups
func (*AggregatedFeed) Activities ¶
func (f *AggregatedFeed) Activities(input *GetAggregatedFeedInput) (*GetAggregatedFeedOutput, error)
Activities returns a list of Activities for a NotificationFeedGroup
func (*AggregatedFeed) AddActivities ¶
func (f *AggregatedFeed) AddActivities(activities []*Activity) ([]*Activity, error)
AddActivities is used to add multiple Activities to a NotificationFeed
func (*AggregatedFeed) AddActivity ¶
func (f *AggregatedFeed) AddActivity(activity *Activity) (*Activity, error)
AddActivity is used to add an Activity to a AggregatedFeed
func (*AggregatedFeed) FeedID ¶
func (f *AggregatedFeed) FeedID() FeedID
FeedID is the combo if the FeedSlug and UserID : "FeedSlug:UserID"
func (*AggregatedFeed) FeedIDWithoutColon ¶
func (f *AggregatedFeed) FeedIDWithoutColon() string
func (*AggregatedFeed) FollowFeedWithCopyLimit ¶
func (f *AggregatedFeed) FollowFeedWithCopyLimit(target *FlatFeed, copyLimit int) error
FollowFeedWithCopyLimit sets a Feed to follow another target Feed CopyLimit is the maximum number of Activities to Copy from History
func (*AggregatedFeed) FollowersWithLimitAndSkip ¶
func (f *AggregatedFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowersWithLimitAndSkip returns a list of GeneralFeed following the current AggregatedFeed
func (*AggregatedFeed) FollowingWithLimitAndSkip ¶
func (f *AggregatedFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowingWithLimitAndSkip returns a list of GeneralFeed followed by the current FlatFeed
func (*AggregatedFeed) GenerateToken ¶
func (f *AggregatedFeed) GenerateToken(signer *Signer) string
GenerateToken returns a new Token for a Feed without setting it to the Feed
func (*AggregatedFeed) RemoveActivity ¶
func (f *AggregatedFeed) RemoveActivity(input *Activity) error
RemoveActivity removes an Activity from a NotificationFeedGroup
func (*AggregatedFeed) RemoveActivityByForeignID ¶
func (f *AggregatedFeed) RemoveActivityByForeignID(input *Activity) error
RemoveActivityByForeignID removes an Activity from a NotificationFeedGroup by ForeignID
func (*AggregatedFeed) SignFeed ¶
func (f *AggregatedFeed) SignFeed(signer *Signer)
SignFeed sets the token on a Feed
func (*AggregatedFeed) Signature ¶
func (f *AggregatedFeed) Signature() string
Signature is used to sign Requests : "FeedSlugUserID Token"
func (*AggregatedFeed) Token ¶
func (f *AggregatedFeed) Token() string
Token returns the token of a Feed
func (*AggregatedFeed) Unfollow ¶
func (f *AggregatedFeed) Unfollow(target *FlatFeed) error
Unfollow is used to Unfollow a target Feed
func (*AggregatedFeed) UnfollowKeepingHistory ¶
func (f *AggregatedFeed) UnfollowKeepingHistory(target *FlatFeed) error
UnfollowKeepingHistory is used to Unfollow a target Feed while keeping the History this means that Activities already visibile will remain
type Client ¶
type Client struct { HTTP *http.Client BaseURL *url.URL // https://api.getstream.io/api/ Config *Config Signer *Signer }
Client is used to connect to getstream.io
func New ¶
*
- New returns a GetStream client. *
- Params:
- cfg, pointer to a Config structure which takes the API credentials, Location, etc
- Returns:
- Client struct
func (*Client) AbsoluteURL ¶
absoluteUrl create a url.URL instance and sets query params (bad!!!)
func (*Client) AddActivityToMany ¶
func (*Client) AggregatedFeed ¶
func (c *Client) AggregatedFeed(feedSlug string, userID string) (*AggregatedFeed, error)
AggregatedFeed returns a getstream feed Slug is the AggregatedFeed Group name id is the Specific AggregatedFeed inside a AggregatedFeed Group to get the feed for Bob you would pass something like "user" as slug and "bob" as the id
func (*Client) FlatFeed ¶
FlatFeed returns a getstream feed Slug is the FlatFeed Group name id is the Specific FlatFeed inside a FlatFeed Group to get the feed for Bob you would pass something like "user" as slug and "bob" as the id
func (*Client) NotificationFeed ¶
func (c *Client) NotificationFeed(feedSlug string, userID string) (*NotificationFeed, error)
NotificationFeed returns a getstream feed Slug is the NotificationFeed Group name id is the Specific NotificationFeed inside a NotificationFeed Group to get the feed for Bob you would pass something like "user" as slug and "bob" as the id
func (*Client) PrepFollowAggregatedFeed ¶
func (c *Client) PrepFollowAggregatedFeed(targetFeed *FlatFeed, sourceFeed *AggregatedFeed) *PostFlatFeedFollowingManyInput
func (*Client) PrepFollowFlatFeed ¶
func (c *Client) PrepFollowFlatFeed(targetFeed *FlatFeed, sourceFeed *FlatFeed) *PostFlatFeedFollowingManyInput
* PrepFollowFlatFeed - prepares JSON needed for one feed to follow another
Params: targetFeed, FlatFeed which wants to follow another sourceFeed, FlatFeed which is to be followed
Returns: []byte, array of bytes of JSON suitable for API consumption
func (*Client) PrepFollowNotificationFeed ¶
func (c *Client) PrepFollowNotificationFeed(targetFeed *FlatFeed, sourceFeed *NotificationFeed) *PostFlatFeedFollowingManyInput
type Config ¶
type Config struct { APIKey string APISecret string AppID string Location string TimeoutInt int64 TimeoutDuration time.Duration Version string Token string BaseURL *url.URL }
Config structure for configuration data
func (*Config) SetAPIKey ¶
SetAPIKey sets the API key for your GetStream.io account You can find/generate this value on GetStream.io when visiting your application's page
func (*Config) SetAPISecret ¶
SetAPISecret sets the API secret for your GetStream.io account You can find/generate this value on GetStream.io when visiting your application's page
func (*Config) SetAppID ¶
SetAppID sets the app id (aka site id) for your GetStream.io application current site_id/app_id values are integers, but parsing as a string will allow for greater flexibility in the future.
func (*Config) SetBaseURL ¶
SetBaseURL sets the core url of the GetStream API to use
func (*Config) SetLocation ¶
SetLocation sets the region where your application runs Acceptable values are: "us-east"
func (*Config) SetTimeout ¶
SetTimeout sets the timeout, in seconds, for request timers timeout param needs to be a time.Duration, ultimately, but we'll convert it here from an int64.
func (*Config) SetVersion ¶
SetVersion sets the version of the GetStream API to use Currently, the only acceptable value is "v1.0"
type Error ¶
type Error struct { Code int `json:"code"` StatusCode int `json:"status_code"` Detail string `json:"detail"` RawDuration string `json:"duration"` Exception string `json:"exception"` }
Error is a getstream error
type Feed ¶
type Feed interface { Signature() string FeedID() FeedID FeedIDWithoutColon() string Token() string SignFeed(signer *Signer) GenerateToken(signer *Signer) string }
Feed is the interface bundling all Feed Types It exposes methods needed for all Types
type FlatFeed ¶
type FlatFeed struct { Client *Client FeedSlug string UserID string // contains filtered or unexported fields }
FlatFeed is a getstream FlatFeed Use it to for CRUD on FlatFeed Groups
func (*FlatFeed) Activities ¶
func (f *FlatFeed) Activities(input *GetFlatFeedInput) (*GetFlatFeedOutput, error)
Activities returns a list of Activities for a FlatFeedGroup
func (*FlatFeed) AddActivities ¶
AddActivities is used to add multiple Activities to a FlatFeed
func (*FlatFeed) AddActivity ¶
AddActivity is used to add an Activity to a FlatFeed
func (*FlatFeed) FeedIDWithoutColon ¶
func (*FlatFeed) FollowFeedWithCopyLimit ¶
FollowFeedWithCopyLimit sets a Feed to follow another target Feed CopyLimit is the maximum number of Activities to Copy from History
func (*FlatFeed) FollowManyFeeds ¶
func (f *FlatFeed) FollowManyFeeds(sourceFeeds []PostFlatFeedFollowingManyInput, copyLimit int) error
FollowFeedsWithCopyLimit sets a Feed to follow one or more other target Feeds This method only exists within FlatFeed because only flat feeds can follow other feeds
Params: sourceFeeds, a list of feeds this feed can follow copyLimit, optional number of items to copy from history, defaults to 100
Returns: error, if any
func (*FlatFeed) FollowersWithLimitAndSkip ¶
func (f *FlatFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowersWithLimitAndSkip returns a list of GeneralFeed following the current FlatFeed
func (*FlatFeed) FollowingWithLimitAndSkip ¶
func (f *FlatFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowingWithLimitAndSkip returns a list of GeneralFeed followed by the current FlatFeed TODO: need to support filters
func (*FlatFeed) GenerateToken ¶
GenerateToken returns a new Token for a Feed without setting it to the Feed
func (*FlatFeed) RemoveActivity ¶
RemoveActivity removes an Activity from a FlatFeedGroup
func (*FlatFeed) RemoveActivityByForeignID ¶
RemoveActivityByForeignID removes an Activity from a FlatFeedGroup by ForeignID
func (*FlatFeed) UnfollowKeepingHistory ¶
UnfollowKeepingHistory is used to Unfollow a target Feed while keeping the History this means that Activities already visibile will remain
func (*FlatFeed) UpdateActivities ¶
func (*FlatFeed) UpdateActivity ¶
type GeneralFeed ¶
type GeneralFeed struct { Client *Client FeedSlug string UserID string // contains filtered or unexported fields }
GeneralFeed is a container for Feeds returned from request The specific Type will be unknown so no Actions are associated with a GeneralFeed
func (*GeneralFeed) FeedID ¶
func (f *GeneralFeed) FeedID() FeedID
FeedID is the combo if the FeedSlug and UserID : "FeedSlug:UserID"
func (*GeneralFeed) FeedIDWithoutColon ¶
func (f *GeneralFeed) FeedIDWithoutColon() string
func (*GeneralFeed) GenerateToken ¶
func (f *GeneralFeed) GenerateToken(signer *Signer) string
GenerateToken returns a new Token for a Feed without setting it to the Feed
func (*GeneralFeed) SignFeed ¶
func (f *GeneralFeed) SignFeed(signer *Signer)
SignFeed sets the token on a Feed
func (*GeneralFeed) Signature ¶
func (f *GeneralFeed) Signature() string
Signature is used to sign Requests : "FeedSlugUserID Token"
func (*GeneralFeed) Unfollow ¶
func (f *GeneralFeed) Unfollow(client *Client, target *FlatFeed) error
Unfollow is used to Unfollow a target Feed
func (*GeneralFeed) UnfollowAggregated ¶
func (f *GeneralFeed) UnfollowAggregated(client *Client, target *AggregatedFeed) error
UnfollowAggregated is used to Unfollow a target Aggregated Feed
func (*GeneralFeed) UnfollowNotification ¶
func (f *GeneralFeed) UnfollowNotification(client *Client, target *NotificationFeed) error
UnfollowNotification is used to Unfollow a target Notification Feed
type GetAggregatedFeedInput ¶
type GetAggregatedFeedInput struct { Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` IDGTE string `json:"id_gte,omitempty"` IDGT string `json:"id_gt,omitempty"` IDLTE string `json:"id_lte,omitempty"` IDLT string `json:"id_lt,omitempty"` Ranking string `json:"ranking,omitempty"` }
GetAggregatedFeedInput is used to Get a list of Activities from a AggregatedFeed
type GetAggregatedFeedOutput ¶
type GetAggregatedFeedOutput struct { Duration string Next string Results []*struct { Activities []*Activity ActivityCount int ActorCount int CreatedAt string Group string ID string UpdatedAt string Verb string } }
GetAggregatedFeedOutput is the response from a AggregatedFeed Activities Get Request
type GetFlatFeedInput ¶
type GetFlatFeedInput struct { Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` IDGTE string `json:"id_gte,omitempty"` IDGT string `json:"id_gt,omitempty"` IDLTE string `json:"id_lte,omitempty"` IDLT string `json:"id_lt,omitempty"` Ranking string `json:"ranking,omitempty"` }
GetFlatFeedInput is used to Get a list of Activities from a FlatFeed
type GetFlatFeedOutput ¶
type GetFlatFeedOutput struct { Duration string `json:"duration"` Next string `json:"next"` Activities []*Activity `json:"results"` }
GetFlatFeedOutput is the response from a FlatFeed Activities Get Request
type GetNotificationFeedInput ¶
type GetNotificationFeedInput struct { Limit int `json:"limit,omitempty"` Offset int `json:"offset,omitempty"` IDGTE string `json:"id_gte,omitempty"` IDGT string `json:"id_gt,omitempty"` IDLTE string `json:"id_lte,omitempty"` IDLT string `json:"id_lt,omitempty"` Ranking string `json:"ranking,omitempty"` }
GetNotificationFeedInput is used to Get a list of Activities from a NotificationFeed
type GetNotificationFeedOutput ¶
type GetNotificationFeedOutput struct { Duration string Next string Results []*struct { Activities []*Activity ActivityCount int ActorCount int CreatedAt string Group string ID string IsRead bool IsSeen bool UpdatedAt string Verb string } Unread int Unseen int }
GetNotificationFeedOutput is the response from a NotificationFeed Activities Get Request
type NotificationFeed ¶
type NotificationFeed struct { Client *Client FeedSlug string UserID string // contains filtered or unexported fields }
NotificationFeed is a getstream NotificationFeed Use it to for CRUD on NotificationFeed Groups
func (*NotificationFeed) Activities ¶
func (f *NotificationFeed) Activities(input *GetNotificationFeedInput) (*GetNotificationFeedOutput, error)
Activities returns a list of Activities for a NotificationFeedGroup
func (*NotificationFeed) AddActivities ¶
func (f *NotificationFeed) AddActivities(activities []*Activity) ([]*Activity, error)
AddActivities is used to add multiple Activities to a NotificationFeed
func (*NotificationFeed) AddActivity ¶
func (f *NotificationFeed) AddActivity(activity *Activity) (*Activity, error)
AddActivity is used to add an Activity to a NotificationFeed
func (*NotificationFeed) FeedID ¶
func (f *NotificationFeed) FeedID() FeedID
FeedID is the combo if the FeedSlug and UserID : "FeedSlug:UserID"
func (*NotificationFeed) FeedIDWithoutColon ¶
func (f *NotificationFeed) FeedIDWithoutColon() string
func (*NotificationFeed) FollowFeedWithCopyLimit ¶
func (f *NotificationFeed) FollowFeedWithCopyLimit(target *FlatFeed, copyLimit int) error
FollowFeedWithCopyLimit sets a Feed to follow another target Feed CopyLimit is the maximum number of Activities to Copy from History
func (*NotificationFeed) FollowersWithLimitAndSkip ¶
func (f *NotificationFeed) FollowersWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowersWithLimitAndSkip returns a list of GeneralFeed following the current FlatFeed
func (*NotificationFeed) FollowingWithLimitAndSkip ¶
func (f *NotificationFeed) FollowingWithLimitAndSkip(limit int, skip int) ([]*GeneralFeed, error)
FollowingWithLimitAndSkip returns a list of GeneralFeed followed by the current FlatFeed
func (*NotificationFeed) GenerateToken ¶
func (f *NotificationFeed) GenerateToken(signer *Signer) string
GenerateToken returns a new Token for a Feed without setting it to the Feed
func (*NotificationFeed) MarkActivitiesAsRead ¶
func (f *NotificationFeed) MarkActivitiesAsRead(activities []*Activity) error
MarkActivitiesAsRead marks activities as read for this feed
func (*NotificationFeed) MarkActivitiesAsSeenWithLimit ¶
func (f *NotificationFeed) MarkActivitiesAsSeenWithLimit(limit int) error
MarkActivitiesAsSeenWithLimit marks activities as seen for this feed
func (*NotificationFeed) RemoveActivity ¶
func (f *NotificationFeed) RemoveActivity(input *Activity) error
RemoveActivity removes an Activity from a NotificationFeedGroup
func (*NotificationFeed) RemoveActivityByForeignID ¶
func (f *NotificationFeed) RemoveActivityByForeignID(input *Activity) error
RemoveActivityByForeignID removes an Activity from a NotificationFeedGroup by ForeignID
func (*NotificationFeed) SignFeed ¶
func (f *NotificationFeed) SignFeed(signer *Signer)
SignFeed sets the token on a Feed
func (*NotificationFeed) Signature ¶
func (f *NotificationFeed) Signature() string
Signature is used to sign Requests : "FeedSlugUserID Token"
func (*NotificationFeed) Token ¶
func (f *NotificationFeed) Token() string
Token returns the token of a Feed
func (*NotificationFeed) Unfollow ¶
func (f *NotificationFeed) Unfollow(target *FlatFeed) error
Unfollow is used to Unfollow a target Feed
func (*NotificationFeed) UnfollowKeepingHistory ¶
func (f *NotificationFeed) UnfollowKeepingHistory(target *FlatFeed) error
UnfollowKeepingHistory is used to Unfollow a target Feed while keeping the History this means that Activities already visibile will remain
type PostActivityToManyInput ¶
type ScopeAction ¶
type ScopeAction uint32
ScopeAction defines the Actions allowed by a scope token
const ( // ScopeActionRead : GET, OPTIONS, HEAD ScopeActionRead ScopeAction = 1 // ScopeActionWrite : POST, PUT, PATCH ScopeActionWrite ScopeAction = 2 // ScopeActionDelete : DELETE ScopeActionDelete ScopeAction = 4 // ScopeActionAll : The JWT has permission to all HTTP verbs ScopeActionAll ScopeAction = 8 )
func (ScopeAction) Value ¶
func (a ScopeAction) Value() string
Value returns a string representation
type ScopeContext ¶
type ScopeContext uint32
ScopeContext defines the resources accessible by a scope token
const ( // ScopeContextActivities : Activities Endpoint ScopeContextActivities ScopeContext = 1 // ScopeContextFeed : Feed Endpoint ScopeContextFeed ScopeContext = 2 // ScopeContextFollower : Following + Followers Endpoint ScopeContextFollower ScopeContext = 4 // ScopeContextAll : Allow access to any resource ScopeContextAll ScopeContext = 8 )
func (ScopeContext) Value ¶
func (a ScopeContext) Value() string
Value returns a string representation
type Signer ¶
type Signer struct {
Secret string
}
Signer is responsible for generating Tokens
func (Signer) GenerateFeedScopeToken ¶
func (s Signer) GenerateFeedScopeToken(context ScopeContext, action ScopeAction, feedIDWithoutColon string) (string, error)
GenerateFeedScopeToken returns a jwt
func (Signer) GenerateToken ¶
generateToken will use the Secret of the signer and the message passed as an argument to generate a Token
func (Signer) GenerateUserScopeToken ¶
func (s Signer) GenerateUserScopeToken(context ScopeContext, action ScopeAction, userID string) (string, error)
GenerateUserScopeToken returns a jwt