rpc

package
v0.0.0-...-4fdfd55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 45 Imported by: 0

README

package rpc

The rpc package provides access to the API of Engine across a network in the form of a method set.

Rationale

The graph database is designed with a distributed system architecture in mind. Even though a single instance will suffice for the first thousand user or more there should be a clear path for distributing it across machines. With Remote Procedure Calls (RPC) methods can be invoked transparently without necessarily knowing whether the method is going to be called locally or remotely. Most of the logic goes through Node which gives reason to distribute computation by distributing Node instances over different machines.

The set of methods is defined as part of the RPC interface. Additionally, the RPC interface is also the way for the clients, consumer-facing and internal tools, to communicate with the backend. This includes operations executed directly on the graph as well as operations affecting the pure domain model, i.e. user and session management, card creation, etc.

Structure

  • protocol implements the transport layer
  • client provides an exported client implementation
  • server provides the HTTP & WebSocket logic to host all the endpoints

Outlook

The RPC interface is currently flat without any hierarchy. One advantage of RPC is to offer a structured way of accessing an API by utilizing different objects with different states. Currently, RPCs which require a user take a nodeID parameter in order to fetch the corresponding user object. Instead, the set of methods should be subdivided into different sets, e.g. user methods, admin methods, etc.

Documentation

Index

Constants

View Source
const (
	Auth                      = "auth"
	Logout                    = "logout"
	Signup                    = "signup"
	ResetPassword             = "resetPassword"
	ValidateInviteCode        = "validateInviteCode"
	AddToWaitlist             = "addToWaitlist"
	GetThread                 = "getThread"
	GetCards                  = "getCards"
	GetCard                   = "get"
	ReactToCard               = "reactToCard"
	VoteOnCard                = "voteOnCard"
	PostCard                  = "postCard"
	NewInvite                 = "newInvite"
	RegisterDevice            = "registerDevice"
	UnregisterDevice          = "unregisterDevice"
	UpdateSettings            = "updateSettings"
	GetUser                   = "getUser"
	ValidateUsername          = "validateUsername"
	GetNotifications          = "getNotifications"
	UpdateNotifications       = "updateNotifications"
	GetAnonymousHandle        = "getAnonymousHandle"
	DeleteCard                = "deleteCard"
	FollowUser                = "followUser"
	UnfollowUser              = "unfollowUser"
	GetFollowingUsers         = "getFollowing"
	GetPostsForUser           = "getPostsForUser"
	GetTags                   = "getTags"
	GetFeaturesForUser        = "getFeatures"
	PreviewContent            = "previewContent"
	UploadImage               = "uploadImage"
	GetTaggableUsers          = "taggableUsers"
	ConnectUsers              = "connectUsers"
	NewUser                   = "newUser"
	GetUsers                  = "getUsers"
	ModifyCardScore           = "modifyCardScore"
	GetInvites                = "getInvites"
	GetOnboardingData         = "getOnboardingData"
	GetMyNetwork              = "getMyNetwork"
	UnsubscribeFromCard       = "unsubscribeFromCard"
	SubscribeToCard           = "subscribeToCard"
	GroupInvites              = "groupInvites"
	ReportCard                = "reportCard"
	BlockUser                 = "blockUser"
	GetChannels               = "getChannels"
	GetCardsForChannel        = "getCardsForChannel"
	UpdateChannelSubscription = "updateChannelSubscription"
	JoinChannel               = "joinChannel"
	LeaveChannel              = "leaveChannel"
	MuteChannel               = "muteChannel"
	UnmuteChannel             = "unmuteChannel"
	MuteUser                  = "muteUser"
	UnmuteUser                = "unmuteUser"
	MuteThread                = "muteThread"
	UnmuteThread              = "unmuteThread"
	CreateChannel             = "createChannel"
	GetPopularCards           = "getPopularCards"
	GetActionCosts            = "getActionCosts"
	UseInviteCode             = "useInviteCode"
	RequestValidation         = "requestValidation"
	ConfirmValidation         = "confirmValidation"
	ValidateChannelName       = "validateChannelName"
	GetChannel                = "getChannel"
	CanAffordAnonymousPost    = "canAffordAnonymousPost"
	GetLeaderboard            = "getLeaderboard"
	SubmitFeedback            = "submitFeedback"
	TipCard                   = "tipCard"
)

Variables

View Source
var (
	// ErrUsernameTaken is used when a username is validated but it is already in
	// use by another user.
	ErrUsernameTaken = errors.New("username has already been taken")
	// ErrUsernameTaken is used when a username is validated but it is already in
	// use by another user.
	ErrChannelExists = errors.New("a channel with that name already exists")
	// ErrUserAlready exists is used when an attempt is made to create a user
	ErrUserAlreadyExists = errors.New("user already exists")
	// ErrNoImageData is used when no base64 data for upload image was provided
	ErrNoImageData = errors.New("no image data received")
	// ErrWrongPassword is used when the password did not match. The detail of this
	// error should be hidden from the client.
	ErrWrongPassword = errors.New("the username or password did not match")
	// ErrUserBlocked is used when an blocked user tries to authenticate
	ErrUserBlocked = errors.New("this account is currently inactive, please contact support")
	// ErrUserBlocked is used when an blocked user tries to authenticate
	ErrUserAlreadyRedeemedCode = errors.New("you have already redeemed an invite code")
)
View Source
var AddToWaitlistParamsExample1 = AddToWaitlistParams{
	AccessToken: "EAAblUoKuqcIBAFIx4QNgx48hoUr5ONWdvv8Lr2GbgvBHzAVt9JJZBv1Oaos37koMDwZCHg9vJ2CGDXOz5Ukk9l0vCjs0uRXm3RQFlKcrNUkTi8HNaQvSie4Vdrwe3RZCHcaR2ET5CaMCjt3kiCiLOZB8EkhwrIe4wUfePaoi2ZBPculDSWWozKsV62MAuEjJBaVjlE7nofVC070fNpZBxrCuZBNpwZAzKaFsQZAZA6M7v328ggNDWpoCoj",
}
View Source
var AddToWaitlistResponseExample1 = AddToWaitlistResponse{
	AccessToken:          "EAAblUoKuqcIBAL9RCiu07m1XJ1EpPFMZA6bySc0WMY9lJpxcNmMPwWVirkVZBWl1GUQ9WP2b6SmtnE3MgHQ1EjogMFGXoZBo37jONoY0aIiNjOoKQfMORtohJ1LofZCfgXK4WUfjg6DFQgYk0z0ZAP8OhhXT2l33FcTHONbxcfUe6Htc8sQUM",
	AccessTokenExpiresAt: 5184000,
}
View Source
var AuthParamsExample1 = AuthParams{
	Username: "chad",
	Password: "secret",
}

Logging a user with username and password in.

View Source
var AuthParamsExample2 = AuthParams{
	AccessToken: "EAAblUoKuqcIBAFIx4QNgx48hoUr5ONWdvv8Lr2GbgvBHzAVt9JJZBv1Oaos37koMDwZCHg9vJ2CGDXOz5Ukk9l0vCjs0uRXm3RQFlKcrNUkTi8HNaQvSie4Vdrwe3RZCHcaR2ET5CaMCjt3kiCiLOZB8EkhwrIe4wUfePaoi2ZBPculDSWWozKsV62MAuEjJBaVjlE7nofVC070fNpZBxrCuZBNpwZAzKaFsQZAZA6M7v328ggNDWpoCoj",
}

Logging a user in with access token.

View Source
var AuthResponseExample1 = AuthResponse{
	User: &model.ExportedUser{
		ID:               "bb100fc4-29b6-4e2f-b19c-549687b27125",
		DisplayName:      "Chad Unicorn",
		FirstName:        "Chad",
		LastName:         "Unicorn",
		ProfileImagePath: "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/57f1c2fe-32a1-4b86-ab79-cc3c3e1425ef.jpeg",
		CoverImagePath:   "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/covers/4bc4db4e-6a0f-49b8-94c0-213c00ca7d47.jpeg",
		Email:            "chad@october.news",
		AllowEmail:       false,
		Username:         "konrad",
		Admin:            false,
	},
	Session: &model.Session{
		ID:     "aa5706e4-baf8-4011-aad0-6d8d55730b8b",
		UserID: "bb100fc4-29b6-4e2f-b19c-549687b27125",
	},
}
View Source
var AuthResponseExample2 = AuthResponse{
	User: &model.ExportedUser{
		ID:               "bb100fc4-29b6-4e2f-b19c-549687b27125",
		DisplayName:      "Chad Unicorn",
		FirstName:        "Chad",
		LastName:         "Unicorn",
		ProfileImagePath: "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/57f1c2fe-32a1-4b86-ab79-cc3c3e1425ef.jpeg",
		CoverImagePath:   "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/covers/4bc4db4e-6a0f-49b8-94c0-213c00ca7d47.jpeg",
		Email:            "chad@october.news",
		AllowEmail:       false,
		Username:         "konrad",
		Admin:            false,
	},
	Session: &model.Session{
		ID:     "aa5706e4-baf8-4011-aad0-6d8d55730b8b",
		UserID: "bb100fc4-29b6-4e2f-b19c-549687b27125",
	},
}
View Source
var DeleteCardParamsExample1 = DeleteCardParams{
	CardID: "cb9f18a2-2ee5-42b5-97e6-d7f0ec5c2726",
}
View Source
var DeleteCardResponseExample1 = DeleteCardResponse{}
View Source
var FollowUserParamsExample1 = FollowUserParams{
	UserID: "52ebb15b-ca7a-4682-b72c-4222aeae2e5c",
}
View Source
var FollowUserResponseExample1 = FollowUserResponse{}
View Source
var GetFollowingUsersParamsExample1 = GetFollowingUsersParams{}
View Source
var GetFollowingUsersResponseExample1 = GetFollowingUsersResponse([]*model.ExportedUser{
	&model.ExportedUser{
		Username:         "chad",
		DisplayName:      "Chad Unicorn",
		ProfileImagePath: "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/57f1c2fe-32a1-4b86-ab79-cc3c3e1425ef.jpeg",
	}, &model.ExportedUser{
		Username:         "richard",
		DisplayName:      "Richard Hendricks",
		ProfileImagePath: "https://s3-us-west-2.amazonaws.com/assets.october.news/profiles/db32869f-3ca5-4d97-b164-38375e8f83c8.png",
	},
})
View Source
var LogoutParamsExample1 = LogoutParams{}
View Source
var LogoutResponseExample1 = LogoutResponse{}
View Source
var ResetPasswordParamsExample1 = ResetPasswordParams{
	Email: "chad@october.news",
}
View Source
var ResetPasswordResponseExample1 = ResetPasswordResponse{}
View Source
var UnfollowUserParamsExample1 = UnfollowUserParams{
	UserID: "52ebb15b-ca7a-4682-b72c-4222aeae2e5c",
}
View Source
var UnfollowUserResponseExample1 = UnfollowUserResponse{}
View Source
var ValidateUsernameParamsExample1 = ValidateUsernameParams{
	Username: "chad",
}
View Source
var ValidateUsernameResponseExample1 = ValidateUsernameResponse{}

Functions

func CardResponse

func CardResponse(store dataStore, card *model.Card, viewerID globalid.ID) (*model.CardResponse, error)

func ChooseCardsFromPool

func ChooseCardsFromPool(cardRanks []*model.PopularRankEntry) ([]globalid.ID, []globalid.ID, error)

returns cards to put on feed, cards to return back to the pool, and err

func ConfidenceFromRankEntry

func ConfidenceFromRankEntry(entry *model.PopularRankEntry) model.ConfidenceData

func ErrCouldNotRetrieveUser

func ErrCouldNotRetrieveUser(cause error) error

ErrCouldNotRetrieveUser is used when a database lookup for the given user has failed.

func ErrForbidden

func ErrForbidden() error

ErrForbidden is used when a user is authenticated but not authorized to perform this action.

func ErrInvalidInviteToken

func ErrInvalidInviteToken() error

ErrInvalidInviteToken is used when the given invite token does not exist.

func ErrInvalidToken

func ErrInvalidToken() error

ErrInvalidToken is used when an invalid reset password token has been passed.

func ErrNodeNotFound

func ErrNodeNotFound(id globalid.ID) error

ErrNodeNotFound is used when a user ID has been passed for which no node with the same node ID exists.

func ErrResetTokenExpired

func ErrResetTokenExpired() error

ErrResetTokenExpired is used when the invite token has expired.

func GetMoreCards

func GetMoreCards(store dataStore, userID globalid.ID) ([]globalid.ID, error)

func NewAccessToken

func NewAccessToken(token string) *accessToken

NewAccessToken returns a new instance of Token.

func NewOAuth2

func NewOAuth2(clientID, clientSecret string) *oauth2

NewOAuth2 returns a new instance of oauth2.

Types

type AccessToken

type AccessToken interface {
	Token() string
	ExpiresAt() int64
	FacebookUser() (*FacebookUser, error)
}

AccessToken encapsulates requests to Facebook which require an access token.

type AddToWaitlistParams

type AddToWaitlistParams struct {
	// Email identifies the user entering the waitlist.
	Email string `json:"email,omitempty"`
	// Name adds a human description to the waitlist entry, ideally first and
	// last name.
	Name string `json:"name,omitempty"`
	// AccessToken uses Facebook account details to sign up to the waitlist.
	AccessToken string `json:"accessToken,omitempty"`
}

func (AddToWaitlistParams) Sanitize

func (p AddToWaitlistParams) Sanitize() interface{}

func (AddToWaitlistParams) Validate

func (p AddToWaitlistParams) Validate() error

type AddToWaitlistRequest

type AddToWaitlistRequest struct {
	Params  AddToWaitlistParams
	Session *model.Session
}

type AddToWaitlistResponse

type AddToWaitlistResponse struct {
	// AccessToken is the extended token of the access token used in the
	// request.
	AccessToken string `json:"accessToken"`
	// AccessTokenExpiresAt is the number of seconds until this access token
	// expires.
	AccessTokenExpiresAt int64 `json:"accessTokenExpiresAt"`
}

type AuthParams

type AuthParams struct {
	// Username is used for logging the user in.
	Username string `json:"username,omitempty"`
	// Password is used for logging the user in.
	Password string `json:"password,omitempty"`
	// Email is used for signin up a new user.
	Email string `json:"email,omitempty"`

	// AccessToken is used for signing in or signing up with Facebook OAuth.
	AccessToken string `json:"accessToken,omitempty"`
	// ResetToken is used for signing in after requesting to reset the password.
	ResetToken string `json:"resetToken,omitempty"`
	// InviteToken is mandatory for signing up.
	InviteToken string `json:"inviteToken,omitempty"`

	// FirstName is used for signing up.
	FirstName string `json:"firstName,omitempty"`
	// LastName is used for signing up.
	LastName string `json:"lastName,omitempty"`
	// ProfileImageData is the profile image for a new user encoded as Base64 string.
	ProfileImageData *string `json:"profilePicture,omitempty"`
	// CoverImageData is the cover image for a new user encoded as Base64 string.
	CoverImageData *string `json:"coverPicture,omitempty"`
	// Signup is used to identify that this is a signup
	IsSignup bool `json:"isSignup"`
}

func (AuthParams) Sanitize

func (p AuthParams) Sanitize() interface{}

func (AuthParams) Validate

func (p AuthParams) Validate() error

type AuthRequest

type AuthRequest struct {
	Params  AuthParams
	Session *model.Session
}

type AuthResponse

type AuthResponse struct {
	// User is the user now authenticated with this connection.
	User *model.ExportedUser `json:"user"`
	// Session identifies the session of this connecetion. The session ID can
	// be used to authenticate immediately on connection establishment.
	Session *model.Session `json:"session"`
}

type BlockUserParams

type BlockUserParams struct {
	UserID    globalid.ID `json:"userID"`
	AliasID   globalid.ID `json:"aliasID"`
	ForThread globalid.ID `json:"forThread"`
}

func (BlockUserParams) Sanitize

func (p BlockUserParams) Sanitize() interface{}

func (BlockUserParams) Validate

func (p BlockUserParams) Validate() error

type BlockUserRequest

type BlockUserRequest struct {
	Params  BlockUserParams
	Session *model.Session
}

type BlockUserResponse

type BlockUserResponse struct{}

type CanAffordAnonymousPostParams

type CanAffordAnonymousPostParams struct {
	ThreadRootID globalid.ID `json:"threadRootID"`
}

func (CanAffordAnonymousPostParams) Sanitize

func (p CanAffordAnonymousPostParams) Sanitize() interface{}

func (CanAffordAnonymousPostParams) Validate

func (p CanAffordAnonymousPostParams) Validate() error

type CanAffordAnonymousPostRequest

type CanAffordAnonymousPostRequest struct {
	Params  CanAffordAnonymousPostParams
	Session *model.Session
}

type CanAffordAnonymousPostResponse

type CanAffordAnonymousPostResponse struct{}

type CardData

type CardData struct {
	// contains filtered or unexported fields
}

type Config

type Config struct {
	Environment    string
	AdminPanelHost string
	WebEndpoint    string
	APIKey         string
	NatsEndpoint   string

	EmbedlyToken string
	DiffbotToken string

	ImageHost              string
	ProfileImagesPath      string
	CoverImagesPath        string
	CardImagesPath         string
	OriginalCardImagesPath string
	CardContentImagesPath  string
	AssetsPath             string
	PublicImagesPath       string
	BackgroundImagesPath   string

	AccessKeyID     string
	AccessKeySecret string
	S3Upload        bool
	S3Region        string
	S3Bucket        string

	FacebookAppID     string
	FacebookAppSecret string

	PushNotificationDelay int64
	SystemIconPath        string

	ResurfaceActivityThreshold int
	DisableUnverifiedUsers     bool
	AuthyAPIKey                string
	AutoVerify                 bool

	// Tokens
	UnitsPerCoin int64
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

Validate returns an error if the config is invalid.

type ConfirmValidationParams

type ConfirmValidationParams struct {
	CountryCode string `json:"countryCode"`
	PhoneNumber string `json:"phoneNumber"`
	Code        string `json:"code"`
}

func (ConfirmValidationParams) Sanitize

func (p ConfirmValidationParams) Sanitize() interface{}

func (ConfirmValidationParams) Validate

func (p ConfirmValidationParams) Validate() error

type ConfirmValidationRequest

type ConfirmValidationRequest struct {
	Params  ConfirmValidationParams
	Session *model.Session
}

type ConfirmValidationResponse

type ConfirmValidationResponse struct{}

type ConnectUsersParams

type ConnectUsersParams struct {
	Users []string `json:"users"`
}

func (ConnectUsersParams) Sanitize

func (p ConnectUsersParams) Sanitize() interface{}

func (ConnectUsersParams) Validate

func (p ConnectUsersParams) Validate() error

type ConnectUsersRequest

type ConnectUsersRequest struct {
	Params  ConnectUsersParams
	Session *model.Session
}

type ConnectUsersResponse

type ConnectUsersResponse struct{}

type CreateChannelParams

type CreateChannelParams struct {
	// UserID is the ID of the user to be followed.
	Name        string `json:"name"`
	Description string `json:"description"`
}

func (CreateChannelParams) Sanitize

func (p CreateChannelParams) Sanitize() interface{}

func (CreateChannelParams) Validate

func (p CreateChannelParams) Validate() error

type CreateChannelRequest

type CreateChannelRequest struct {
	Params  CreateChannelParams
	Session *model.Session
}

type CreateChannelResponse

type CreateChannelResponse struct {
	Channel    *model.Channel      `json:"channel"`
	NewBalance *model.CoinBalances `json:"newBalances"`
}

type DeleteCardParams

type DeleteCardParams struct {
	// CardID is the ID of the card to be deleted.
	CardID globalid.ID `json:"cardID"`
}

func (DeleteCardParams) Sanitize

func (p DeleteCardParams) Sanitize() interface{}

func (DeleteCardParams) Validate

func (p DeleteCardParams) Validate() error

type DeleteCardRequest

type DeleteCardRequest struct {
	Params  DeleteCardParams
	Session *model.Session
}

type DeleteCardResponse

type DeleteCardResponse struct{}

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error wraps internal errors in order to hide implementation detail.

func (*Error) Error

func (e *Error) Error() string

Erorr implements the error interface for Error.

type FacebookUser

type FacebookUser struct {
	ID               string `json:"id"`
	Email            string `json:"email"`
	FirstName        string `json:"first_name"`
	LastName         string `json:"last_name"`
	ProfileImagePath string
}

FacebookUser contains profile information related to a user's Facebook profile.

func (*FacebookUser) Name

func (f *FacebookUser) Name() string

type FollowUserParams

type FollowUserParams struct {
	// UserID is the ID of the user to be followed.
	UserID globalid.ID `json:"userID"`
}

func (FollowUserParams) Sanitize

func (p FollowUserParams) Sanitize() interface{}

func (FollowUserParams) Validate

func (p FollowUserParams) Validate() error

type FollowUserRequest

type FollowUserRequest struct {
	Params  FollowUserParams
	Session *model.Session
}

type FollowUserResponse

type FollowUserResponse struct{}

type GetActionCostsParams

type GetActionCostsParams struct{}

func (GetActionCostsParams) Sanitize

func (p GetActionCostsParams) Sanitize() interface{}

func (GetActionCostsParams) Validate

func (p GetActionCostsParams) Validate() error

type GetActionCostsRequest

type GetActionCostsRequest struct {
	Params  GetActionCostsParams
	Session *model.Session
}

type GetActionCostsResponse

type GetActionCostsResponse struct {
	LikeCost          int64 `json:"likeCost"`
	AnonLikeCost      int64 `json:"anonLikeCost"`
	DislikeCost       int64 `json:"dislikeCost"`
	PostCost          int64 `json:"postCost"`
	AnonPostCost      int64 `json:"anonPostCost"`
	CommentCost       int64 `json:"commentCost"`
	AnonCommentCost   int64 `json:"anonCommentCost"`
	CreateChannelCost int64 `json:"createChannelCost"`
	ThreadAliasCost   int64 `json:"threadAliasCost"`
	PostAliasCost     int64 `json:"postAliasCost"`
	UnitsPerCoin      int64 `json:"unitsPerCoin"`
}

type GetAnonymousHandleParams

type GetAnonymousHandleParams struct {
	ThreadRootID globalid.ID `json:"forThread"`
}

func (GetAnonymousHandleParams) Sanitize

func (p GetAnonymousHandleParams) Sanitize() interface{}

func (GetAnonymousHandleParams) Validate

func (p GetAnonymousHandleParams) Validate() error

type GetAnonymousHandleRequest

type GetAnonymousHandleRequest struct {
	Params  GetAnonymousHandleParams
	Session *model.Session
}

type GetAnonymousHandleResponse

type GetAnonymousHandleResponse struct {
	Alias    *model.AnonymousAlias `json:"alias"`
	LastUsed bool                  `json:"wasLastUsed"`
}

type GetCardParams

type GetCardParams struct {
	// CardID identifies the card to be retrieved.
	CardID globalid.ID `json:"cardID"`
}

func (GetCardParams) Sanitize

func (p GetCardParams) Sanitize() interface{}

func (GetCardParams) Validate

func (p GetCardParams) Validate() error

type GetCardRequest

type GetCardRequest struct {
	Params  GetCardParams
	Session *model.Session
}

type GetCardResponse

type GetCardResponse model.CardResponse

type GetCardsForChannelParams

type GetCardsForChannelParams struct {
	ChannelID   globalid.ID `json:"channelID"`
	ChannelName string      `json:"channelName"`
	PageSize    int         `json:"pageSize"`
	PageNumber  int         `json:"pageNumber"`
}

func (GetCardsForChannelParams) Sanitize

func (p GetCardsForChannelParams) Sanitize() interface{}

func (GetCardsForChannelParams) Validate

func (p GetCardsForChannelParams) Validate() error

type GetCardsForChannelRequest

type GetCardsForChannelRequest struct {
	Params  GetCardsForChannelParams
	Session *model.Session
}

type GetCardsForChannelResponse

type GetCardsForChannelResponse struct {
	Cards               []*model.CardResponse `json:"cards"`
	NextPage            bool                  `json:"hasNextPage"`
	Channel             *model.Channel        `json:"channel"`
	SubscribedToChannel bool                  `json:"subscribed"`
}

type GetCardsParams

type GetCardsParams struct {
	// PerPage specifies the number of cards returned per request.
	PerPage int `json:"pageSize"`
	// Page for pagination; the page to retrieve.
	Page int `json:"pageNumber"`
	// Optional search
	SearchString string `json:"searchString"`
}

func (GetCardsParams) Sanitize

func (p GetCardsParams) Sanitize() interface{}

func (GetCardsParams) Validate

func (p GetCardsParams) Validate() error

type GetCardsRequest

type GetCardsRequest struct {
	Params  GetCardsParams
	Session *model.Session
}

type GetCardsResponse

type GetCardsResponse struct {
	NewCardCount int                   `json:"newCardCount,omitempty"`
	Cards        []*model.CardResponse `json:"cards"`
	NextPage     bool                  `json:"hasNextPage"`
}

type GetChannelParams

type GetChannelParams struct {
	Name string      `json:"channelName,omitempty"`
	ID   globalid.ID `json:"channelID,omitempty"`
}

func (GetChannelParams) Sanitize

func (p GetChannelParams) Sanitize() interface{}

func (GetChannelParams) Validate

func (p GetChannelParams) Validate() error

type GetChannelRequest

type GetChannelRequest struct {
	Params  GetChannelParams
	Session *model.Session
}

type GetChannelResponse

type GetChannelResponse UserChannel

type GetChannelsParams

type GetChannelsParams struct {
	OnlySubscribed bool `json:"onlySubscribed"`
	OnlyPostable   bool `json:"onlyPostable"`
	HideEmpty      bool `json:"hideEmpty"`
}

func (GetChannelsParams) Sanitize

func (p GetChannelsParams) Sanitize() interface{}

func (GetChannelsParams) Validate

func (p GetChannelsParams) Validate() error

type GetChannelsRequest

type GetChannelsRequest struct {
	Params  GetChannelsParams
	Session *model.Session
}

type GetChannelsResponse

type GetChannelsResponse []*UserChannel

type GetFeaturesForUserParams

type GetFeaturesForUserParams struct {
}

func (GetFeaturesForUserParams) Sanitize

func (p GetFeaturesForUserParams) Sanitize() interface{}

func (GetFeaturesForUserParams) Validate

func (p GetFeaturesForUserParams) Validate() error

type GetFeaturesForUserRequest

type GetFeaturesForUserRequest struct {
	Params  GetFeaturesForUserParams
	Session *model.Session
}

type GetFeaturesForUserResponse

type GetFeaturesForUserResponse []string

type GetFollowingUsersParams

type GetFollowingUsersParams struct{}

func (GetFollowingUsersParams) Sanitize

func (p GetFollowingUsersParams) Sanitize() interface{}

func (GetFollowingUsersParams) Validate

func (p GetFollowingUsersParams) Validate() error

type GetFollowingUsersRequest

type GetFollowingUsersRequest struct {
	Params  GetFollowingUsersParams
	Session *model.Session
}

type GetFollowingUsersResponse

type GetFollowingUsersResponse []*model.ExportedUser

type GetInvitesParams

type GetInvitesParams struct{}

func (GetInvitesParams) Sanitize

func (p GetInvitesParams) Sanitize() interface{}

func (GetInvitesParams) Validate

func (p GetInvitesParams) Validate() error

type GetInvitesRequest

type GetInvitesRequest struct {
	Params  GetInvitesParams
	Session *model.Session
}

type GetInvitesResponse

type GetInvitesResponse struct {
	Invites []*model.Invite `json:"invites"`
}

type GetLeaderboardParams

type GetLeaderboardParams struct {
	PageSize   int `json:"pageSize"`
	PageNumber int `json:"pageNumber"`
}

func (GetLeaderboardParams) Sanitize

func (p GetLeaderboardParams) Sanitize() interface{}

func (GetLeaderboardParams) Validate

func (p GetLeaderboardParams) Validate() error

type GetLeaderboardRequest

type GetLeaderboardRequest struct {
	Params  GetLeaderboardParams
	Session *model.Session
}

type GetLeaderboardResponse

type GetLeaderboardResponse struct {
	Users    []*LeaderboardUser `json:"users"`
	NextPage bool               `json:"hasNextPage"`
}

type GetMyNetworkParams

type GetMyNetworkParams struct {
	PageSize   int    `json:"pageSize"`
	PageNumber int    `json:"pageNumber"`
	Search     string `json:"search"`
}

func (GetMyNetworkParams) Sanitize

func (p GetMyNetworkParams) Sanitize() interface{}

func (GetMyNetworkParams) Validate

func (p GetMyNetworkParams) Validate() error

type GetMyNetworkRequest

type GetMyNetworkRequest struct {
	Params  GetMyNetworkParams
	Session *model.Session
}

type GetMyNetworkResponse

type GetMyNetworkResponse struct {
	Users       []MyNetworkUser `json:"users"`
	LastUpdated int64           `json:"lastUpdated"`
	NextPage    bool            `json:"nextPage"`
}

type GetNotificationsParams

type GetNotificationsParams struct {
	PageSize   int `json:"pageSize"`
	PageNumber int `json:"pageNumber"`
}

func (GetNotificationsParams) Sanitize

func (p GetNotificationsParams) Sanitize() interface{}

func (GetNotificationsParams) Validate

func (p GetNotificationsParams) Validate() error

type GetNotificationsRequest

type GetNotificationsRequest struct {
	Params  GetNotificationsParams
	Session *model.Session
}

type GetNotificationsResponse

type GetNotificationsResponse struct {
	Notifications []*model.ExportedNotification `json:"notifications"`
	NextPage      bool                          `json:"nextPage"`
	UnseenCount   int                           `json:"unseenCount"`
}

type GetOnboardingDataParams

type GetOnboardingDataParams struct{}

func (GetOnboardingDataParams) Sanitize

func (p GetOnboardingDataParams) Sanitize() interface{}

func (GetOnboardingDataParams) Validate

func (p GetOnboardingDataParams) Validate() error

type GetOnboardingDataRequest

type GetOnboardingDataRequest struct {
	Params  GetOnboardingDataParams
	Session *model.Session
}

type GetOnboardingDataResponse

type GetOnboardingDataResponse struct {
	NetworkProfilePictures []string            `json:"networkProfilePictures"`
	InvitingUser           *model.ExportedUser `json:"invitingUser,omitempty"`
}

type GetPopularCardsParams

type GetPopularCardsParams struct {
	// PerPage specifies the number of cards returned per request.
	PerPage int `json:"pageSize"`
	// Page for pagination; the page to retrieve.
	Page int `json:"pageNumber"`
}

func (GetPopularCardsParams) Sanitize

func (p GetPopularCardsParams) Sanitize() interface{}

func (GetPopularCardsParams) Validate

func (p GetPopularCardsParams) Validate() error

type GetPopularCardsRequest

type GetPopularCardsRequest struct {
	Params  GetPopularCardsParams
	Session *model.Session
}

type GetPopularCardsResponse

type GetPopularCardsResponse model.CardsResponse

type GetPostsForUserParams

type GetPostsForUserParams struct {
	// Username of the user's posts fo fetch.
	Username string `json:"username"`
	// UserID of the user's posts to fetch.
	UserID globalid.ID `json:"userID"`
	// PageSize specifies the number of cards to be returned per request.
	PageSize int `json:"pageSize"`
	// PageNumber specifies further pages to retrieve.
	PageNumber int `json:"pageNumber"`
}

func (GetPostsForUserParams) Sanitize

func (p GetPostsForUserParams) Sanitize() interface{}

func (GetPostsForUserParams) Validate

func (p GetPostsForUserParams) Validate() error

type GetPostsForUserRequest

type GetPostsForUserRequest struct {
	Params  GetPostsForUserParams
	Session *model.Session
}

type GetPostsForUserResponse

type GetPostsForUserResponse struct {
	// Cards are the posts made by the requested user.
	Cards []*model.CardResponse `json:"cards"`
	// NextPage returns true if there is another page to fetch.
	NextPage bool `json:"hasNextPage"`
}

type GetTaggableUsersParams

type GetTaggableUsersParams struct {
	CardID globalid.ID `json:"cardID"`
}

func (GetTaggableUsersParams) Sanitize

func (p GetTaggableUsersParams) Sanitize() interface{}

func (GetTaggableUsersParams) Validate

func (p GetTaggableUsersParams) Validate() error

type GetTaggableUsersRequest

type GetTaggableUsersRequest struct {
	Session *model.Session
	Params  GetTaggableUsersParams
}

type GetTaggableUsersResponse

type GetTaggableUsersResponse []model.TaggableUser

type GetTagsParams

type GetTagsParams struct{}

func (GetTagsParams) Sanitize

func (p GetTagsParams) Sanitize() interface{}

func (GetTagsParams) Validate

func (p GetTagsParams) Validate() error

type GetTagsRequest

type GetTagsRequest struct {
	Params  GetTagsParams
	Session *model.Session
}

type GetTagsResponse

type GetTagsResponse struct{}

type GetThreadParams

type GetThreadParams struct {
	// CardID identifies the root card of the thread.
	CardID globalid.ID `json:"cardID"`
	Nested bool        `json:"nested"`
}

func (GetThreadParams) Sanitize

func (p GetThreadParams) Sanitize() interface{}

func (GetThreadParams) Validate

func (p GetThreadParams) Validate() error

type GetThreadRequest

type GetThreadRequest struct {
	Params  GetThreadParams
	Session *model.Session
}

type GetThreadResponse

type GetThreadResponse []*model.CardResponse

type GetUserParams

type GetUserParams struct {
	Username string      `json:"username"`
	UserID   globalid.ID `json:"userID,omitempty"`
}

func (GetUserParams) Sanitize

func (p GetUserParams) Sanitize() interface{}

func (GetUserParams) Validate

func (p GetUserParams) Validate() error

type GetUserRequest

type GetUserRequest struct {
	Params  GetUserParams
	Session *model.Session
}

type GetUserResponse

type GetUserResponse model.ExportedUser

type GetUsersParams

type GetUsersParams struct{}

func (GetUsersParams) Sanitize

func (p GetUsersParams) Sanitize() interface{}

func (GetUsersParams) Validate

func (p GetUsersParams) Validate() error

type GetUsersRequest

type GetUsersRequest struct {
	Params  GetUsersParams
	Session *model.Session
}

type GetUsersResponse

type GetUsersResponse []*model.User

type GroupInvitesParams

type GroupInvitesParams struct {
	InviteTokens []string `json:"tokens"`
}

func (GroupInvitesParams) Sanitize

func (p GroupInvitesParams) Sanitize() interface{}

func (GroupInvitesParams) Validate

func (p GroupInvitesParams) Validate() error

type GroupInvitesRequest

type GroupInvitesRequest struct {
	Params  GroupInvitesParams
	Session *model.Session
}

type GroupInvitesResponse

type GroupInvitesResponse struct{}

type ImageProcessor

type ImageProcessor struct {
	// contains filtered or unexported fields
}

ImageProcessor ties together methods for downloading and processing images.

func NewImageProcessor

func NewImageProcessor(c *Config, l log.Logger) (*ImageProcessor, error)

NewImageProcessor returns a new instance of ImageProcessor and an error if it was not able to ensure all the image directories have been created.

func (*ImageProcessor) BlendImage

func (ip *ImageProcessor) BlendImage(src, gradient string) (string, error)

func (*ImageProcessor) DownloadCardImage

func (ip *ImageProcessor) DownloadCardImage(url string) (string, string, error)

func (*ImageProcessor) DownloadProfileImage

func (ip *ImageProcessor) DownloadProfileImage(url string) (string, string, error)

func (*ImageProcessor) GenerateDefaultProfileImage

func (ip *ImageProcessor) GenerateDefaultProfileImage() (string, string, error)

func (*ImageProcessor) GradientImage

func (ip *ImageProcessor) GradientImage(gradient string) (string, string, error)

GradientImage creates a background image just out of the gradient by converting the existing gradient to a jpeg. Returns an error on unknown gradients.

func (*ImageProcessor) SaveBase64CardContentImage

func (ip *ImageProcessor) SaveBase64CardContentImage(data string) (string, string, error)

func (*ImageProcessor) SaveBase64CardImage

func (ip *ImageProcessor) SaveBase64CardImage(data string) (string, string, error)

func (*ImageProcessor) SaveBase64CoverImage

func (ip *ImageProcessor) SaveBase64CoverImage(data string) (string, string, error)

func (*ImageProcessor) SaveBase64ProfileImage

func (ip *ImageProcessor) SaveBase64ProfileImage(data string) (string, string, error)

type JoinChannelParams

type JoinChannelParams struct {
	ChannelID globalid.ID `json:"channelID"`
}

func (JoinChannelParams) Sanitize

func (p JoinChannelParams) Sanitize() interface{}

func (JoinChannelParams) Validate

func (p JoinChannelParams) Validate() error

type JoinChannelRequest

type JoinChannelRequest struct {
	Params  JoinChannelParams
	Session *model.Session
}

type JoinChannelResponse

type JoinChannelResponse struct{}

type LeaderboardUser

type LeaderboardUser struct {
	User        *model.ExportedUser `json:"user"`
	Rank        int                 `json:"rank"`
	CoinsEarned int                 `json:"coinsEarned"`
}

type LeaveChannelParams

type LeaveChannelParams struct {
	ChannelID globalid.ID `json:"channelID"`
}

func (LeaveChannelParams) Sanitize

func (p LeaveChannelParams) Sanitize() interface{}

func (LeaveChannelParams) Validate

func (p LeaveChannelParams) Validate() error

type LeaveChannelRequest

type LeaveChannelRequest struct {
	Params  LeaveChannelParams
	Session *model.Session
}

type LeaveChannelResponse

type LeaveChannelResponse struct{}

type LogoutParams

type LogoutParams struct{}

func (LogoutParams) Sanitize

func (p LogoutParams) Sanitize() interface{}

func (LogoutParams) Validate

func (p LogoutParams) Validate() error

type LogoutRequest

type LogoutRequest struct {
	Params  LogoutParams
	Session *model.Session
}

type LogoutResponse

type LogoutResponse struct{}

type ModifyCardScoreParams

type ModifyCardScoreParams struct {
	CardID   globalid.ID `json:"cardID"`
	Strength float64     `json:"strength"`
}

func (ModifyCardScoreParams) Sanitize

func (p ModifyCardScoreParams) Sanitize() interface{}

func (ModifyCardScoreParams) Validate

func (p ModifyCardScoreParams) Validate() error

type ModifyCardScoreRequest

type ModifyCardScoreRequest struct {
	Params  ModifyCardScoreParams
	Session *model.Session
}

type ModifyCardScoreResponse

type ModifyCardScoreResponse struct{}

type MuteChannelParams

type MuteChannelParams struct {
	ChannelID globalid.ID `json:"channelID"`
}

func (MuteChannelParams) Sanitize

func (p MuteChannelParams) Sanitize() interface{}

func (MuteChannelParams) Validate

func (p MuteChannelParams) Validate() error

type MuteChannelRequest

type MuteChannelRequest struct {
	Params  MuteChannelParams
	Session *model.Session
}

type MuteChannelResponse

type MuteChannelResponse struct{}

type MuteThreadParams

type MuteThreadParams struct {
	// UserID is the ID of the user to be followed.
	CardID globalid.ID `json:"cardID"`
}

func (MuteThreadParams) Sanitize

func (p MuteThreadParams) Sanitize() interface{}

func (MuteThreadParams) Validate

func (p MuteThreadParams) Validate() error

type MuteThreadRequest

type MuteThreadRequest struct {
	Params  MuteThreadParams
	Session *model.Session
}

type MuteThreadResponse

type MuteThreadResponse struct{}

type MuteUserParams

type MuteUserParams struct {
	// UserID is the ID of the user to be followed.
	UserID globalid.ID `json:"userID"`
}

func (MuteUserParams) Sanitize

func (p MuteUserParams) Sanitize() interface{}

func (MuteUserParams) Validate

func (p MuteUserParams) Validate() error

type MuteUserRequest

type MuteUserRequest struct {
	Params  MuteUserParams
	Session *model.Session
}

type MuteUserResponse

type MuteUserResponse struct{}

type MyNetworkUser

type MyNetworkUser struct {
	User      *model.ExportedUser `json:"user"`
	Rank      int                 `json:"rank"`
	MovedUp   bool                `json:"movedUp"`
	Following bool                `json:"following"`
}

type NewInviteParams

type NewInviteParams struct {
	// Invites specifies the number of invites the generated token will be
	// valid for.
	Invites int `json:"invites"`
}

func (NewInviteParams) Sanitize

func (p NewInviteParams) Sanitize() interface{}

func (NewInviteParams) Validate

func (p NewInviteParams) Validate() error

type NewInviteRequest

type NewInviteRequest struct {
	Params  NewInviteParams
	Session *model.Session
}

type NewInviteResponse

type NewInviteResponse model.Invite

type NewUserParams

type NewUserParams struct {
	Username           string `json:"username"`
	Password           string `json:"password"`
	Email              string `json:"email"`
	DisplayName        string `json:"displayName"`
	FirstName          string `json:"firstName"`
	LastName           string `json:"lastName"`
	Token              string `json:"token"`
	ProfilePicturePath string `json:"profilePicturePath"`
	CoverPicturePath   string `json:"coverPicturePath"`
	Firstname          string `json:"firstname"`
	Lastname           string `json:"lastname"`
}

func (NewUserParams) Sanitize

func (p NewUserParams) Sanitize() interface{}

func (NewUserParams) Validate

func (p NewUserParams) Validate() error

type NewUserRequest

type NewUserRequest struct {
	Params  NewUserParams
	Session *model.Session
}

type NewUserResponse

type NewUserResponse struct {
	ID globalid.ID `json:"id"`
}

type OAuth2

type OAuth2 interface {
	ExtendToken(ctx context.Context, token string) (AccessToken, error)
}

OAuth2 handles all the OAuth2 related actions.

type PostCardParams

type PostCardParams struct {
	// AuthorID can be used by admins to overwrite the user ID of the card.
	AuthorID globalid.ID `json:"authorID"`
	// Anonymous is set to true in order to publish a card anonymously.
	Anonymous bool `json:"anonymous"`
	// ReplyCardID is set if this card is a reply to another card.
	ReplyCardID globalid.ID `json:"replyCardID,omitempty"`
	// ReplyCardID is set if this card is a reply to another card.
	ChannelID globalid.ID `json:"channelID,omitempty"`
	// URL associates the card with a link.
	URL string `json:"url"`
	// Content is the card content written in Slate Markdown syntax.
	Content string `json:"content"`
	// BackgroundImage is a Base64 encoded background image to be displayed behind the card.
	BackgroundImage string `json:"bgImage"`
	// BackgroundImageURL points to an image to be displayed behind the card.
	BackgroundImageURL string `json:"bgImageURL"`
	// BackgroundColor specifies a color to be used as a background image.
	BackgroundColor string `json:"bgColor"`
}

func (PostCardParams) Sanitize

func (p PostCardParams) Sanitize() interface{}

func (PostCardParams) Validate

func (p PostCardParams) Validate() error

type PostCardRequest

type PostCardRequest struct {
	Params  PostCardParams
	Session *model.Session
}

type PostCardResponse

type PostCardResponse struct {
	Card        *model.CardView     `json:"card"`
	Author      *model.Author       `json:"author"`
	Channel     *model.Channel      `json:"channel,omitempty"`
	NewBalances *model.CoinBalances `json:"newBalances,omitempty"`
}

type PreviewContentParams

type PreviewContentParams struct {
	URL string `json:"url"`
}

func (PreviewContentParams) Sanitize

func (p PreviewContentParams) Sanitize() interface{}

func (PreviewContentParams) Validate

func (p PreviewContentParams) Validate() error

type PreviewContentRequest

type PreviewContentRequest struct {
	Params  PreviewContentParams
	Session *model.Session
}

type PreviewContentResponse

type PreviewContentResponse struct {
	Title     string   `json:"title"`
	Summary   string   `json:"summary"`
	Type      string   `json:"type"`
	ImageURLs []string `json:"imageURLs"`
}

type RPC

type RPC interface {
	// Clients
	Auth(ctx context.Context, req AuthRequest) (*AuthResponse, error)
	ResetPassword(ctx context.Context, req ResetPasswordRequest) (*ResetPasswordResponse, error)
	ValidateInviteCode(ctx context.Context, req ValidateInviteCodeRequest) (*ValidateInviteCodeResponse, error)
	AddToWaitlist(ctx context.Context, req AddToWaitlistRequest) (*AddToWaitlistResponse, error)
	// Authenticated Client RPCs
	Logout(ctx context.Context, req LogoutRequest) (*LogoutResponse, error)
	GetThread(ctx context.Context, req GetThreadRequest) (*GetThreadResponse, error)
	GetCards(ctx context.Context, req GetCardsRequest) (*GetCardsResponse, error)
	GetCard(ctx context.Context, req GetCardRequest) (*GetCardResponse, error)
	ReactToCard(ctx context.Context, req ReactToCardRequest) (*ReactToCardResponse, error)
	VoteOnCard(ctx context.Context, req VoteOnCardRequest) (*VoteOnCardResponse, error)
	PostCard(ctx context.Context, req PostCardRequest) (*PostCardResponse, error)
	NewInvite(ctx context.Context, req NewInviteRequest) (*NewInviteResponse, error)
	RegisterDevice(ctx context.Context, req RegisterDeviceRequest) (*RegisterDeviceResponse, error)
	UnregisterDevice(ctx context.Context, req UnregisterDeviceRequest) (*UnregisterDeviceResponse, error)
	UpdateSettings(ctx context.Context, req UpdateSettingsRequest) (*UpdateSettingsResponse, error)
	GetUser(ctx context.Context, req GetUserRequest) (*GetUserResponse, error)
	ValidateUsername(ctx context.Context, req ValidateUsernameRequest) (*ValidateUsernameResponse, error)
	GetNotifications(ctx context.Context, req GetNotificationsRequest) (*GetNotificationsResponse, error)
	UpdateNotifications(ctx context.Context, req UpdateNotificationsRequest) (*UpdateNotificationsResponse, error)
	GetAnonymousHandle(ctx context.Context, Params GetAnonymousHandleRequest) (*GetAnonymousHandleResponse, error)
	DeleteCard(ctx context.Context, req DeleteCardRequest) (*DeleteCardResponse, error)
	FollowUser(ctx context.Context, req FollowUserRequest) (*FollowUserResponse, error)
	UnfollowUser(ctx context.Context, req UnfollowUserRequest) (*UnfollowUserResponse, error)
	GetFollowingUsers(ctx context.Context, req GetFollowingUsersRequest) (*GetFollowingUsersResponse, error)
	GetPostsForUser(ctx context.Context, req GetPostsForUserRequest) (*GetPostsForUserResponse, error)
	GetTags(ctx context.Context, req GetTagsRequest) (*GetTagsResponse, error)
	GetFeaturesForUser(ctx context.Context, req GetFeaturesForUserRequest) (*GetFeaturesForUserResponse, error)
	PreviewContent(ctx context.Context, req PreviewContentRequest) (*PreviewContentResponse, error)
	UploadImage(ctx context.Context, req UploadImageRequest) (*UploadImageResponse, error)
	GetTaggableUsers(ctx context.Context, req GetTaggableUsersRequest) (*GetTaggableUsersResponse, error)
	ModifyCardScore(ctx context.Context, req ModifyCardScoreRequest) (*ModifyCardScoreResponse, error)
	GetInvites(ctx context.Context, req GetInvitesRequest) (*GetInvitesResponse, error)
	GetOnboardingData(ctx context.Context, req GetOnboardingDataRequest) (*GetOnboardingDataResponse, error)
	GetMyNetwork(ctx context.Context, req GetMyNetworkRequest) (*GetMyNetworkResponse, error)
	UnsubscribeFromCard(ctx context.Context, req UnsubscribeFromCardRequest) (*UnsubscribeFromCardResponse, error)
	SubscribeToCard(ctx context.Context, req SubscribeToCardRequest) (*SubscribeToCardResponse, error)
	GroupInvites(ctx context.Context, req GroupInvitesRequest) (*GroupInvitesResponse, error)
	ReportCard(ctx context.Context, req ReportCardRequest) (*ReportCardResponse, error)
	BlockUser(ctx context.Context, req BlockUserRequest) (*BlockUserResponse, error)
	GetCardsForChannel(ctx context.Context, req GetCardsForChannelRequest) (*GetCardsForChannelResponse, error)
	UpdateChannelSubscription(ctx context.Context, req UpdateChannelSubscriptionRequest) (*UpdateChannelSubscriptionResponse, error)
	GetChannels(ctx context.Context, req GetChannelsRequest) (*GetChannelsResponse, error)
	JoinChannel(ctx context.Context, req JoinChannelRequest) (*JoinChannelResponse, error)
	LeaveChannel(ctx context.Context, req LeaveChannelRequest) (*LeaveChannelResponse, error)
	MuteChannel(ctx context.Context, req MuteChannelRequest) (*MuteChannelResponse, error)
	UnmuteChannel(ctx context.Context, req UnmuteChannelRequest) (*UnmuteChannelResponse, error)
	MuteUser(ctx context.Context, req MuteUserRequest) (*MuteUserResponse, error)
	UnmuteUser(ctx context.Context, req UnmuteUserRequest) (*UnmuteUserResponse, error)
	MuteThread(ctx context.Context, req MuteThreadRequest) (*MuteThreadResponse, error)
	UnmuteThread(ctx context.Context, req UnmuteThreadRequest) (*UnmuteThreadResponse, error)
	CreateChannel(ctx context.Context, req CreateChannelRequest) (*CreateChannelResponse, error)
	GetPopularCards(ctx context.Context, req GetPopularCardsRequest) (*GetPopularCardsResponse, error)
	GetActionCosts(ctx context.Context, req GetActionCostsRequest) (*GetActionCostsResponse, error)
	UseInviteCode(ctx context.Context, req UseInviteCodeRequest) (*UseInviteCodeResponse, error)
	RequestValidation(ctx context.Context, req RequestValidationRequest) (*RequestValidationResponse, error)
	ConfirmValidation(ctx context.Context, req ConfirmValidationRequest) (*ConfirmValidationResponse, error)
	ValidateChannelName(ctx context.Context, req ValidateChannelNameRequest) (*ValidateChannelNameResponse, error)
	GetChannel(ctx context.Context, req GetChannelRequest) (*GetChannelResponse, error)
	CanAffordAnonymousPost(ctx context.Context, req CanAffordAnonymousPostRequest) (*CanAffordAnonymousPostResponse, error)
	GetLeaderboard(ctx context.Context, req GetLeaderboardRequest) (*GetLeaderboardResponse, error)
	SubmitFeedback(ctx context.Context, req SubmitFeedbackRequest) (*SubmitFeedbackResponse, error)
	TipCard(ctx context.Context, req TipCardRequest) (*TipCardResponse, error)

	// Benchmarking
	ConnectUsers(ctx context.Context, req ConnectUsersRequest) (*ConnectUsersResponse, error)
	NewUser(ctx context.Context, req NewUserRequest) (*NewUserResponse, error)
	GetUsers(ctx context.Context, req GetUsersRequest) (*GetUsersResponse, error)
}

RPC is the set of API calls for communicating with the backend, specifically with the graph and creation, modification and deletion of domain model entities.

func NewInstrumentingMiddleware

func NewInstrumentingMiddleware(r RPC, client *statsd.Client, log log.Logger) RPC

NewInstrumentingMiddleware returns a new instance of instrumentingMiddleware.

func NewLoggingMiddleware

func NewLoggingMiddleware(r RPC, log log.Logger) RPC

func NewRPC

func NewRPC(s dataStore, wq workerQueue, oa2 OAuth2, ip imageProcessor, c *Config, l log.Logger, mt *emailsender.MailTemplates, n *worker.Notifier, p pusher, settings *model.Settings, notifications notifications, i indexer, cm *coinmanager.CoinManager, r responses) RPC

NewRPC returns a new instance of the server-side implementation of RPC.

func NewRecordingMiddleware

func NewRecordingMiddleware(r RPC, recorder *activityrecorder.ActivityRecorder, log log.Logger) RPC

type ReactToCardParams

type ReactToCardParams struct {
	// CardID specifies the card to react to.
	CardID globalid.ID `json:"cardID"`
	// Anonymous determines if the reaction should be anonymous.
	Type model.UserReactionType `json:"type"`
	// Anonymous determines if the reaction should be anonymous.
	Anonymous bool `json:"anonymous"`
	// Undo if set to true it will delete the reaction again.
	Undo bool `json:"undo"`

	//OLD PARAMS
	Strength float64 `json:"strength"`
	// Reaction must be any of: boost, bury, seen
	Reaction model.ReactionType `json:"reaction"`
	// something horrible to deal with the bullshit fE does
	FromLegacy bool `json:"fromLegacy"`
}

func (ReactToCardParams) Sanitize

func (p ReactToCardParams) Sanitize() interface{}

func (ReactToCardParams) Validate

func (p ReactToCardParams) Validate() error

type ReactToCardRequest

type ReactToCardRequest struct {
	Params  ReactToCardParams
	Session *model.Session
}

type ReactToCardResponse

type ReactToCardResponse struct {
	// AnonymousAlias is set when this was an anonymous reaction.
	AnonymousAlias *model.AnonymousAlias `json:"anonymousAlias"`
	NewBalances    *model.CoinBalances   `json:"newBalances"`
}

type RegisterDeviceParams

type RegisterDeviceParams struct {
	// Token is generated by Firebase and identifies the device.
	Token string `json:"token"`
	// Platform to identify the mobile operating system, either iOS or Android.
	Platform string `json:"platform"`
}

func (RegisterDeviceParams) Sanitize

func (p RegisterDeviceParams) Sanitize() interface{}

func (RegisterDeviceParams) Validate

func (p RegisterDeviceParams) Validate() error

type RegisterDeviceRequest

type RegisterDeviceRequest struct {
	Params  RegisterDeviceParams
	Session *model.Session
}

type RegisterDeviceResponse

type RegisterDeviceResponse struct{}

type ReportCardParams

type ReportCardParams struct {
	CardID globalid.ID `json:"cardID"`
}

func (ReportCardParams) Sanitize

func (p ReportCardParams) Sanitize() interface{}

func (ReportCardParams) Validate

func (p ReportCardParams) Validate() error

type ReportCardRequest

type ReportCardRequest struct {
	Params  ReportCardParams
	Session *model.Session
}

type ReportCardResponse

type ReportCardResponse struct{}

type RequestValidationParams

type RequestValidationParams struct {
	CountryCode string `json:"countryCode"`
	PhoneNumber string `json:"phoneNumber"`
}

func (RequestValidationParams) Sanitize

func (p RequestValidationParams) Sanitize() interface{}

func (RequestValidationParams) Validate

func (p RequestValidationParams) Validate() error

type RequestValidationRequest

type RequestValidationRequest struct {
	Params  RequestValidationParams
	Session *model.Session
}

type RequestValidationResponse

type RequestValidationResponse struct{}

type ResetPasswordParams

type ResetPasswordParams struct {
	// Email is used to identify the user's account.
	Email string `json:"email"`
}

func (ResetPasswordParams) Sanitize

func (p ResetPasswordParams) Sanitize() interface{}

func (ResetPasswordParams) Validate

func (p ResetPasswordParams) Validate() error

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Params  ResetPasswordParams
	Session *model.Session
}

type ResetPasswordResponse

type ResetPasswordResponse struct{}

type Responses

type Responses struct {
	// contains filtered or unexported fields
}

Responses is responsible for building complex responses. For instance card responses require several queries to build the output needed for the clients.

func NewResponses

func NewResponses(store dataStore) *Responses

func (*Responses) CardResponse

func (r *Responses) CardResponse(card *model.Card, viewerID globalid.ID, data *CardData) (*model.CardResponse, error)

func (*Responses) CardResponses

func (r *Responses) CardResponses() ([]*model.CardResponse, error)

func (*Responses) FeedCardResponses

func (r *Responses) FeedCardResponses(cards []*model.Card, viewerID globalid.ID) ([]*model.CardResponse, error)

type SubmitFeedbackParams

type SubmitFeedbackParams struct {
	Body string `json:"body"`
}

func (SubmitFeedbackParams) Sanitize

func (p SubmitFeedbackParams) Sanitize() interface{}

func (SubmitFeedbackParams) Validate

func (p SubmitFeedbackParams) Validate() error

type SubmitFeedbackRequest

type SubmitFeedbackRequest struct {
	Params  SubmitFeedbackParams
	Session *model.Session
}

type SubmitFeedbackResponse

type SubmitFeedbackResponse struct{}

type SubscribeToCardParams

type SubscribeToCardParams struct {
	CardID globalid.ID `json:"cardID"`
}

func (SubscribeToCardParams) Sanitize

func (p SubscribeToCardParams) Sanitize() interface{}

func (SubscribeToCardParams) Validate

func (p SubscribeToCardParams) Validate() error

type SubscribeToCardRequest

type SubscribeToCardRequest struct {
	Params  SubscribeToCardParams
	Session *model.Session
}

type SubscribeToCardResponse

type SubscribeToCardResponse model.CardResponse

type TipCardParams

type TipCardParams struct {
	CardID    globalid.ID `json:"cardID"`
	Amount    int         `json:"amount"`
	Anonymous bool        `json:"anonymous"`
}

func (TipCardParams) Sanitize

func (p TipCardParams) Sanitize() interface{}

func (TipCardParams) Validate

func (p TipCardParams) Validate() error

type TipCardRequest

type TipCardRequest struct {
	Params  TipCardParams
	Session *model.Session
}

type TipCardResponse

type TipCardResponse struct {
	NewBalance *model.CoinBalances `json:"newBalances"`
}

type UnfollowUserParams

type UnfollowUserParams struct {
	// UserID is the ID of the user to be unfollowed.
	UserID globalid.ID `json:"userID"`
}

func (UnfollowUserParams) Sanitize

func (p UnfollowUserParams) Sanitize() interface{}

func (UnfollowUserParams) Validate

func (p UnfollowUserParams) Validate() error

type UnfollowUserRequest

type UnfollowUserRequest struct {
	Params  UnfollowUserParams
	Session *model.Session
}

type UnfollowUserResponse

type UnfollowUserResponse struct{}

type UnmuteChannelParams

type UnmuteChannelParams struct {
	ChannelID globalid.ID `json:"channelID"`
}

func (UnmuteChannelParams) Sanitize

func (p UnmuteChannelParams) Sanitize() interface{}

func (UnmuteChannelParams) Validate

func (p UnmuteChannelParams) Validate() error

type UnmuteChannelRequest

type UnmuteChannelRequest struct {
	Params  UnmuteChannelParams
	Session *model.Session
}

type UnmuteChannelResponse

type UnmuteChannelResponse struct{}

type UnmuteThreadParams

type UnmuteThreadParams struct {
	// UserID is the ID of the user to be followed.
	CardID globalid.ID `json:"cardID"`
}

func (UnmuteThreadParams) Sanitize

func (p UnmuteThreadParams) Sanitize() interface{}

func (UnmuteThreadParams) Validate

func (p UnmuteThreadParams) Validate() error

type UnmuteThreadRequest

type UnmuteThreadRequest struct {
	Params  UnmuteThreadParams
	Session *model.Session
}

type UnmuteThreadResponse

type UnmuteThreadResponse struct{}

type UnmuteUserParams

type UnmuteUserParams struct {
	// UserID is the ID of the user to be followed.
	UserID globalid.ID `json:"userID"`
}

func (UnmuteUserParams) Sanitize

func (p UnmuteUserParams) Sanitize() interface{}

func (UnmuteUserParams) Validate

func (p UnmuteUserParams) Validate() error

type UnmuteUserRequest

type UnmuteUserRequest struct {
	Params  UnmuteUserParams
	Session *model.Session
}

type UnmuteUserResponse

type UnmuteUserResponse struct{}

type UnregisterDeviceParams

type UnregisterDeviceParams struct {
	// Token is generated by Firebase and identifies the device.
	Token string `json:"token"`
}

func (UnregisterDeviceParams) Sanitize

func (p UnregisterDeviceParams) Sanitize() interface{}

func (UnregisterDeviceParams) Validate

func (p UnregisterDeviceParams) Validate() error

type UnregisterDeviceRequest

type UnregisterDeviceRequest struct {
	Params  UnregisterDeviceParams
	Session *model.Session
}

type UnregisterDeviceResponse

type UnregisterDeviceResponse struct{}

type UnsubscribeFromCardParams

type UnsubscribeFromCardParams struct {
	CardID globalid.ID `json:"cardID"`
}

func (UnsubscribeFromCardParams) Sanitize

func (p UnsubscribeFromCardParams) Sanitize() interface{}

func (UnsubscribeFromCardParams) Validate

func (p UnsubscribeFromCardParams) Validate() error

type UnsubscribeFromCardRequest

type UnsubscribeFromCardRequest struct {
	Params  UnsubscribeFromCardParams
	Session *model.Session
}

type UnsubscribeFromCardResponse

type UnsubscribeFromCardResponse model.CardResponse

type UpdateChannelSubscriptionParams

type UpdateChannelSubscriptionParams struct {
	ChannelID  globalid.ID `json:"channelID"`
	Subscribed bool        `json:"subscribed"`
}

func (UpdateChannelSubscriptionParams) Sanitize

func (p UpdateChannelSubscriptionParams) Sanitize() interface{}

func (UpdateChannelSubscriptionParams) Validate

type UpdateChannelSubscriptionRequest

type UpdateChannelSubscriptionRequest struct {
	Params  UpdateChannelSubscriptionParams
	Session *model.Session
}

type UpdateChannelSubscriptionResponse

type UpdateChannelSubscriptionResponse struct{}

type UpdateNotificationsParams

type UpdateNotificationsParams struct {
	IDs    []globalid.ID `json:"ids"`
	Seen   bool          `json:"seen"`
	Opened bool          `json:"opened"`
}

func (UpdateNotificationsParams) Sanitize

func (p UpdateNotificationsParams) Sanitize() interface{}

func (UpdateNotificationsParams) Validate

func (p UpdateNotificationsParams) Validate() error

type UpdateNotificationsRequest

type UpdateNotificationsRequest struct {
	Params  UpdateNotificationsParams
	Session *model.Session
}

type UpdateNotificationsResponse

type UpdateNotificationsResponse struct{}

type UpdateSettingsParams

type UpdateSettingsParams struct {
	// Username for changing the user's username.
	Username *string `json:"username"`
	// Password for changing the user's password.
	Password *string `json:"password"`
	// Email for changing the user's email.
	Email *string `json:"email"`
	// AllowEmailNotifications specifies whether the user wants to receive
	// email notifications.
	AllowEmailNotifications *bool `json:"allowEmail"`
	// Bio is a short description of the user.
	Bio *string `json:"bio"`
	// Display is how the user is displayed everywhere.
	DisplayName *string `json:"displayName"`
	// FirstName for changing the user's first name.
	FirstName *string `json:"firstName"`
	// LastName for changing the user's last name.
	LastName *string `json:"lastName"`
	// RemoveProfileImage is set to true if the profile image should be deleted
	// altogether.
	RemoveProfileImage *bool `json:"removeProfileImage"`
	// RemoveCoverImage is set to true if the cover image should be deleted
	// altogether.
	RemoveCoverImage *bool `json:"removeCoverImage"`
	// ImageData updates the user's profile picture by providing a Base64 encoded image.
	ImageData *string `json:"imageData"`
	// CoverImageData updates the user's cover picture by providing a Base64
	// encoded image.
	CoverImageData *string `json:"coverImageData"`
}

func (UpdateSettingsParams) Sanitize

func (p UpdateSettingsParams) Sanitize() interface{}

func (UpdateSettingsParams) Validate

func (p UpdateSettingsParams) Validate() error

type UpdateSettingsRequest

type UpdateSettingsRequest struct {
	Params  UpdateSettingsParams
	Session *model.Session
}

type UpdateSettingsResponse

type UpdateSettingsResponse model.ExportedUser

type UploadImageParams

type UploadImageParams struct {
	CardImageData        string `json:"cardImageData"`
	CardImageColor       string `json:"cardImageColor"`
	CardContentImageData string `json:"cardContentImageData"`
	ProfileImageData     string `json:"profileImageData"`
	CoverImageData       string `json:"coverImageData"`
}

func (UploadImageParams) Sanitize

func (p UploadImageParams) Sanitize() interface{}

func (UploadImageParams) Validate

func (p UploadImageParams) Validate() error

type UploadImageRequest

type UploadImageRequest struct {
	Params  UploadImageParams
	Session *model.Session
}

type UploadImageResponse

type UploadImageResponse string

type UseInviteCodeParams

type UseInviteCodeParams struct {
	Token string `json:"token"`
}

func (UseInviteCodeParams) Sanitize

func (p UseInviteCodeParams) Sanitize() interface{}

func (UseInviteCodeParams) Validate

func (p UseInviteCodeParams) Validate() error

type UseInviteCodeRequest

type UseInviteCodeRequest struct {
	Params  UseInviteCodeParams
	Session *model.Session
}

type UseInviteCodeResponse

type UseInviteCodeResponse struct {
	NewBalance *model.CoinBalances `json:"newBalances"`
}

type UserChannel

type UserChannel struct {
	Channel     *model.Channel `json:"channel"`
	MemberCount int            `json:"memberCount"`
	Subscribed  bool           `json:"subscribed"`
}

type ValidateChannelNameParams

type ValidateChannelNameParams struct {
	// Username is the username to be checked.
	Name string `json:"channelName"`
}

func (ValidateChannelNameParams) Sanitize

func (p ValidateChannelNameParams) Sanitize() interface{}

func (ValidateChannelNameParams) Validate

func (p ValidateChannelNameParams) Validate() error

type ValidateChannelNameRequest

type ValidateChannelNameRequest struct {
	Params  ValidateChannelNameParams
	Session *model.Session
}

type ValidateChannelNameResponse

type ValidateChannelNameResponse struct{}

type ValidateInviteCodeParams

type ValidateInviteCodeParams struct {
	// Token is the invite code.
	Token string `json:"token"`
}

func (ValidateInviteCodeParams) Sanitize

func (p ValidateInviteCodeParams) Sanitize() interface{}

func (ValidateInviteCodeParams) Validate

func (p ValidateInviteCodeParams) Validate() error

type ValidateInviteCodeRequest

type ValidateInviteCodeRequest struct {
	Params  ValidateInviteCodeParams
	Session *model.Session
}

type ValidateInviteCodeResponse

type ValidateInviteCodeResponse struct{}

type ValidateUsernameParams

type ValidateUsernameParams struct {
	// Username is the username to be checked.
	Username string `json:"username"`
}

func (ValidateUsernameParams) Sanitize

func (p ValidateUsernameParams) Sanitize() interface{}

func (ValidateUsernameParams) Validate

func (p ValidateUsernameParams) Validate() error

type ValidateUsernameRequest

type ValidateUsernameRequest struct {
	Params  ValidateUsernameParams
	Session *model.Session
}

type ValidateUsernameResponse

type ValidateUsernameResponse struct{}

type VoteOnCardParams

type VoteOnCardParams struct {
	// CardID specifies the card to react to.
	CardID globalid.ID `json:"cardID"`
	// Up/down
	Type model.VoteType `json:"type"`
	// Undo if set to true it will delete the reaction again.
	Undo bool `json:"undo"`
}

func (VoteOnCardParams) Sanitize

func (p VoteOnCardParams) Sanitize() interface{}

func (VoteOnCardParams) Validate

func (p VoteOnCardParams) Validate() error

type VoteOnCardRequest

type VoteOnCardRequest struct {
	Params  VoteOnCardParams
	Session *model.Session
}

type VoteOnCardResponse

type VoteOnCardResponse struct {
	NewBalances *model.CoinBalances `json:"newBalances"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL