referrals

package
v0.31.10 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUsedEmail is an error class for reporting already used emails.
	ErrUsedEmail = errs.Class("email used error")
)
View Source
var ErrValidation = errs.Class("validation error")

ErrValidation validation related error class

Functions

This section is empty.

Types

type Config

type Config struct {
	ReferralManagerURL storj.NodeURL
}

Config is for referrals service.

type CreateUser

type CreateUser struct {
	FullName      string `json:"fullName"`
	ShortName     string `json:"shortName"`
	Email         string `json:"email"`
	Password      string `json:"password"`
	ReferralToken string `json:"referralToken"`
}

CreateUser contains information that's necessary for creating a new user through referral program

func (*CreateUser) IsValid

func (user *CreateUser) IsValid() error

IsValid checks CreateUser validity and returns error describing whats wrong.

type Service

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

Service allows communicating with the Referral Manager

architecture: Service

func NewService

func NewService(log *zap.Logger, signer signing.Signer, config Config, dialer rpc.Dialer, db console.Users, passwordCost int) *Service

NewService returns a service for handling referrals information.

func (*Service) CreateUser

func (service *Service) CreateUser(ctx context.Context, user CreateUser) (_ *console.User, err error)

CreateUser validates user's registration information and creates a new user.

func (*Service) GetTokens

func (service *Service) GetTokens(ctx context.Context, userID *uuid.UUID) (tokens []uuid.UUID, err error)

GetTokens returns tokens based on user ID.

Jump to

Keyboard shortcuts

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