Documentation ¶
Index ¶
- Variables
- func Wrap(middleware Middleware, handler Handler) http.HandlerFunc
- type Error
- type Handler
- func AppCreate(fn core.AppCreateFunc) Handler
- func AppList(fn core.AppListFunc) Handler
- func AppRetrieve(fn core.AppFetchWithCountsFunc) Handler
- func CommentCreate(fn core.CommentCreateFunc) Handler
- func CommentDelete(fn core.CommentDeleteFunc) Handler
- func CommentList(fn core.CommentListFunc) Handler
- func CommentRetrieve(fn core.CommentRetrieveFunc) Handler
- func CommentUpdate(fn core.CommentUpdateFunc) Handler
- func ConnectionByState(fn core.ConnectionByStateFunc) Handler
- func ConnectionDelete(fn core.ConnectionDeleteFunc) Handler
- func ConnectionFollowers(fn core.ConnectionFollowersFunc) Handler
- func ConnectionFollowersMe(fn core.ConnectionFollowersFunc) Handler
- func ConnectionFollowings(fn core.ConnectionFollowingsFunc) Handler
- func ConnectionFollowingsMe(fn core.ConnectionFollowingsFunc) Handler
- func ConnectionFriends(fn core.ConnectionFriendsFunc) Handler
- func ConnectionFriendsMe(fn core.ConnectionFriendsFunc) Handler
- func ConnectionSocial(fn core.ConnectionCreateSocialFunc) Handler
- func ConnectionUpdate(fn core.ConnectionUpdateFunc) Handler
- func CounterGetAll(fn core.CounterGetAllFunc) Handler
- func CounterSet(fn core.CounterSetFunc) Handler
- func DeviceDelete(fn core.DeviceDeleteFunc) Handler
- func DeviceUpdate(fn core.DeviceUpdateFunc) Handler
- func FeedEvents(fn core.FeedEventsFunc) Handler
- func FeedNews(fn core.FeedNewsFunc) Handler
- func FeedNotificationsSelf(fn core.FeedNotificationsSelfFunc) Handler
- func FeedPosts(fn core.FeedPostsFunc) Handler
- func Health(pg *sqlx.DB, rClient *redis.Pool) Handler
- func InviteCreate(fn core.InviteCreateFunc) Handler
- func LikeCreate(fn core.LikeCreateFunc) Handler
- func LikeDelete(fn core.LikeDeleteFunc) Handler
- func LikesMe(fn core.LikesUserFunc) Handler
- func LikesPost(fn core.LikeListFunc) Handler
- func LikesUser(fn core.LikesUserFunc) Handler
- func MemberLogin(authConf *oauth2.Config) Handler
- func MemberRetrieveMe(authConf *oauth2.Config) Handler
- func PlatformCreate(fn core.PlatformCreateFunc) Handler
- func PostCreate(fn core.PostCreateFunc) Handler
- func PostDelete(fn core.PostDeleteFunc) Handler
- func PostList(fn core.PostListUserFunc) Handler
- func PostListAll(fn core.PostListAllFunc) Handler
- func PostListMe(fn core.PostListUserFunc) Handler
- func PostRetrieve(fn core.PostRetrieveFunc) Handler
- func PostUpdate(fn core.PostUpdateFunc) Handler
- func ReactionCreate(fn core.ReactionCreateFunc) Handler
- func ReactionDelete(fn core.ReactionDeleteFunc) Handler
- func ReactionListPost(fn core.ReactionListPostFunc) Handler
- func ReactionListPostByType(fn core.ReactionListPostFunc) Handler
- func RuleActivate(fn core.RuleActivateFunc) Handler
- func RuleDeactivate(fn core.RuleDeactivateFunc) Handler
- func RuleDelete(fn core.RuleDeleteFunc) Handler
- func RuleList(fn core.RuleListFunc) Handler
- func RuleRetrieve(fn core.RuleFetchFunc) Handler
- func UserCreate(createFn core.UserCreateFunc, createWithInviteFn core.UserCreateWithInviteFunc) Handler
- func UserDelete(fn core.UserDeleteFunc) Handler
- func UserFetchConsole(fn core.UserFetchConsoleFunc) Handler
- func UserLogin(fn core.UserLoginFunc) Handler
- func UserLogout(fn core.UserLogoutFunc) Handler
- func UserRetrieve(fn core.UserRetrieveFunc) Handler
- func UserRetrieveMe(fn core.UserRetrieveFunc) Handler
- func UserSearch(fn core.UserSearchFunc) Handler
- func UserSearchConsole(fn core.UserSearchConsoleFunc) Handler
- func UserSearchEmails(fn core.UserListByEmailsFunc) Handler
- func UserSearchPlatform(fn core.UserListByPlatformIDsFunc) Handler
- func UserUpdate(fn core.UserUpdateFunc) Handler
- func UserUpdateConsole(fn core.UserUpdateConsoleFunc) Handler
- type Middleware
- func CORS() Middleware
- func Chain(ms ...Middleware) Middleware
- func CtxApp(apps app.Service) Middleware
- func CtxDeviceID() Middleware
- func CtxPrepare(version string) Middleware
- func CtxUser(sessions session.Service, users user.Service) Middleware
- func DebugHeaders(rev, host string) Middleware
- func Gzip() Middleware
- func HasUserAgent() Middleware
- func Instrument(component string) Middleware
- func Log(logger log.Logger) Middleware
- func RateLimit(limits limiter.Limiter) Middleware
- func SecureHeaders() Middleware
- func ValidateContent() Middleware
Constants ¶
This section is empty.
Variables ¶
var ( ErrBadRequest = errors.New("bad request") ErrLimitExceeded = errors.New("limit") )
Errors used for protocol control flow.
Functions ¶
func Wrap ¶
func Wrap( middleware Middleware, handler Handler, ) http.HandlerFunc
Wrap takes a Middleware and Handler and returns an http.HandlerFunc.
Types ¶
type Handler ¶
Handler is the gateway specific http.HandlerFunc expecting a context.Context.
func AppRetrieve ¶
func AppRetrieve(fn core.AppFetchWithCountsFunc) Handler
AppRetrieve returns the app for the requested id.
func CommentCreate ¶
func CommentCreate(fn core.CommentCreateFunc) Handler
CommentCreate creates a new Comment on behalf of the current user.
func CommentDelete ¶
func CommentDelete(fn core.CommentDeleteFunc) Handler
CommentDelete flags the comment as deleted.
func CommentList ¶
func CommentList(fn core.CommentListFunc) Handler
CommentList returns all comments for the given a Post.
func CommentRetrieve ¶
func CommentRetrieve(fn core.CommentRetrieveFunc) Handler
CommentRetrieve return the comment for the requested id.
func CommentUpdate ¶
func CommentUpdate(fn core.CommentUpdateFunc) Handler
CommentUpdate replaces the value for a comment with the new values.
func ConnectionByState ¶
func ConnectionByState(fn core.ConnectionByStateFunc) Handler
ConnectionByState returns all connections for a user for a certain state.
func ConnectionDelete ¶
func ConnectionDelete(fn core.ConnectionDeleteFunc) Handler
ConnectionDelete flags the given connection as disabled.
func ConnectionFollowers ¶
func ConnectionFollowers(fn core.ConnectionFollowersFunc) Handler
ConnectionFollowers returns the list of users who follow the user with the id.
func ConnectionFollowersMe ¶
func ConnectionFollowersMe(fn core.ConnectionFollowersFunc) Handler
ConnectionFollowersMe returns the list of users who follow the user with the id.
func ConnectionFollowings ¶
func ConnectionFollowings(fn core.ConnectionFollowingsFunc) Handler
ConnectionFollowings returns the list of users the current user is following.
func ConnectionFollowingsMe ¶
func ConnectionFollowingsMe(fn core.ConnectionFollowingsFunc) Handler
ConnectionFollowingsMe returns the list of users the current user is following.
func ConnectionFriends ¶
func ConnectionFriends(fn core.ConnectionFriendsFunc) Handler
ConnectionFriends returns the list of users the current user is friends with.
func ConnectionFriendsMe ¶
func ConnectionFriendsMe(fn core.ConnectionFriendsFunc) Handler
ConnectionFriendsMe returns the list of users the current user is friends with.
func ConnectionSocial ¶
func ConnectionSocial(fn core.ConnectionCreateSocialFunc) Handler
ConnectionSocial takes a list of connection ids and creates connections for the given user.
func ConnectionUpdate ¶
func ConnectionUpdate(fn core.ConnectionUpdateFunc) Handler
ConnectionUpdate stores a new connection or updates the state of an exisitng Connection.
func CounterGetAll ¶
func CounterGetAll(fn core.CounterGetAllFunc) Handler
CounterGetAll returns the sum of all counter for a coutner name.
func CounterSet ¶
func CounterSet(fn core.CounterSetFunc) Handler
CounterSet sets the counter for the current user and the given counter name to the new value.
func DeviceDelete ¶
func DeviceDelete(fn core.DeviceDeleteFunc) Handler
DeviceDelete removes a user's device.
func DeviceUpdate ¶
func DeviceUpdate(fn core.DeviceUpdateFunc) Handler
DeviceUpdate stores the platform and token for a user's device.
func FeedEvents ¶
func FeedEvents(fn core.FeedEventsFunc) Handler
FeedEvents returns the events of the current user driven by the social and interest graph.
func FeedNews ¶
func FeedNews(fn core.FeedNewsFunc) Handler
FeedNews returns the superset aggregration of events and posts driven by the social and interest graph of the current user.
func FeedNotificationsSelf ¶
func FeedNotificationsSelf(fn core.FeedNotificationsSelfFunc) Handler
FeedNotificationsSelf returns the events which target the origin user and their content.
func FeedPosts ¶
func FeedPosts(fn core.FeedPostsFunc) Handler
FeedPosts returns the posts of the current user driven by the social and interest graph.
func InviteCreate ¶
func InviteCreate(fn core.InviteCreateFunc) Handler
InviteCreate stores the key and value for a users invite.
func LikeCreate ¶
func LikeCreate(fn core.LikeCreateFunc) Handler
LikeCreate emits new like event for the post by the current user.
func LikeDelete ¶
func LikeDelete(fn core.LikeDeleteFunc) Handler
LikeDelete removes an existing like event for the currentuser on the post.
func LikesMe ¶
func LikesMe(fn core.LikesUserFunc) Handler
LikesMe returns all Likes for the current user.
func LikesPost ¶
func LikesPost(fn core.LikeListFunc) Handler
LikesPost returns all Likes for a post.
func LikesUser ¶
func LikesUser(fn core.LikesUserFunc) Handler
LikesUser returns all Likes for the given user.
func MemberLogin ¶
MemberLogin authenticates the member via OAuth.
func MemberRetrieveMe ¶
MemberRetrieveMe returns the current member.
func PlatformCreate ¶
func PlatformCreate(fn core.PlatformCreateFunc) Handler
PlatformCreate stores the provided platform.
func PostDelete ¶
func PostDelete(fn core.PostDeleteFunc) Handler
PostDelete flags the Post as deleted.
func PostList ¶
func PostList(fn core.PostListUserFunc) Handler
PostList returns all posts for a user as visible by the current user.
func PostListAll ¶
func PostListAll(fn core.PostListAllFunc) Handler
PostListAll returns all publicly visible posts.
func PostListMe ¶
func PostListMe(fn core.PostListUserFunc) Handler
PostListMe returns all posts of the current user.
func PostRetrieve ¶
func PostRetrieve(fn core.PostRetrieveFunc) Handler
PostRetrieve returns the requested Post.
func PostUpdate ¶
func PostUpdate(fn core.PostUpdateFunc) Handler
PostUpdate reaplces a post with new values.
func ReactionCreate ¶
func ReactionCreate(fn core.ReactionCreateFunc) Handler
ReactionCreate creates a Reaction on the Post.
func ReactionDelete ¶
func ReactionDelete(fn core.ReactionDeleteFunc) Handler
ReactionDelete removes an existing Reaction for the currentUser on the Post.
func ReactionListPost ¶
func ReactionListPost(fn core.ReactionListPostFunc) Handler
ReactionListPost returns all reactions for a Post.
func ReactionListPostByType ¶
func ReactionListPostByType(fn core.ReactionListPostFunc) Handler
ReactionListPostByType returns all reactions for a Post.
func RuleActivate ¶
func RuleActivate(fn core.RuleActivateFunc) Handler
func RuleDeactivate ¶
func RuleDeactivate(fn core.RuleDeactivateFunc) Handler
func RuleDelete ¶
func RuleDelete(fn core.RuleDeleteFunc) Handler
func RuleRetrieve ¶
func RuleRetrieve(fn core.RuleFetchFunc) Handler
RuleRetrieve returns a single rule by id.
func UserCreate ¶
func UserCreate( createFn core.UserCreateFunc, createWithInviteFn core.UserCreateWithInviteFunc, ) Handler
UserCreate stores the provided user and returns it with a valid session.
func UserDelete ¶
func UserDelete(fn core.UserDeleteFunc) Handler
UserDelete disbales the current user.
func UserFetchConsole ¶
func UserFetchConsole(fn core.UserFetchConsoleFunc) Handler
func UserLogin ¶
func UserLogin(fn core.UserLoginFunc) Handler
UserLogin finds the user by email or username and creates a Session.
func UserLogout ¶
func UserLogout(fn core.UserLogoutFunc) Handler
UserLogout finds the session of the user and destroys it.
func UserRetrieve ¶
func UserRetrieve(fn core.UserRetrieveFunc) Handler
UserRetrieve returns the user for the requested id.
func UserRetrieveMe ¶
func UserRetrieveMe(fn core.UserRetrieveFunc) Handler
UserRetrieveMe returns the current user.
func UserSearch ¶
func UserSearch(fn core.UserSearchFunc) Handler
UserSearch returns all users for the given search query.
func UserSearchConsole ¶
func UserSearchConsole(fn core.UserSearchConsoleFunc) Handler
UserSearchConsole returns users matching the query.
func UserSearchEmails ¶
func UserSearchEmails(fn core.UserListByEmailsFunc) Handler
UserSearchEmails returns all Users for the emails of the payload.
func UserSearchPlatform ¶
func UserSearchPlatform(fn core.UserListByPlatformIDsFunc) Handler
UserSearchPlatform returns all users for the given ids and platform.
func UserUpdate ¶
func UserUpdate(fn core.UserUpdateFunc) Handler
UserUpdate stores the new attributes given.
func UserUpdateConsole ¶
func UserUpdateConsole(fn core.UserUpdateConsoleFunc) Handler
type Middleware ¶
Middleware can be used to chain Handlers with different responsibilities.
func Chain ¶
func Chain(ms ...Middleware) Middleware
Chain takes a varidatic number of Middlewares and returns a combined Middleware.
func CtxApp ¶
func CtxApp(apps app.Service) Middleware
CtxApp extracts the App from the Authentication header.
func CtxDeviceID ¶
func CtxDeviceID() Middleware
CtxDeviceID extracts the unique identification for a device.
func CtxPrepare ¶
func CtxPrepare(version string) Middleware
CtxPrepare adds a baseline of information to the Context currently: * api version * route name
func CtxUser ¶
func CtxUser(sessions session.Service, users user.Service) Middleware
CtxUser extracts the user from the Authentication header and adds it to the Context.
func DebugHeaders ¶
func DebugHeaders(rev, host string) Middleware
DebugHeaders adds extra information encoded in a custom header namespace for potential tracing and debugging post-mortem.
func Gzip ¶
func Gzip() Middleware
Gzip ensures proper encoding of the response if the client accepts it.
func Instrument ¶
func Instrument( component string, ) Middleware
Instrument observes key aspects of a request/response and exposes Prometheus metrics.
func RateLimit ¶
func RateLimit(limits limiter.Limiter) Middleware
RateLimit enforces request limits per application.
func SecureHeaders ¶
func SecureHeaders() Middleware
SecureHeaders adds a list of commonly recgonised best-pratice security headers. Source: https://www.owasp.org/index.php/List_of_useful_HTTP_headers
func ValidateContent ¶
func ValidateContent() Middleware
ValidateContent checks if content-length and content-type are set for requests with paylaod and adhere to our required limits and values.