consoleapi

package
v1.56.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAPIKeysAPI - console api keys api error type.
	ErrAPIKeysAPI = errs.Class("console api keys")
)
View Source
var ErrAnalyticsAPI = errs.Class("consoleapi analytics")

ErrAnalyticsAPI - console analytics api error type.

View Source
var (
	// ErrAuthAPI - console auth api error type.
	ErrAuthAPI = errs.Class("consoleapi auth")
)
View Source
var (
	// ErrBucketsAPI - console buckets api error type.
	ErrBucketsAPI = errs.Class("console api buckets")
)
View Source
var (
	// ErrPaymentsAPI - console payments api error type.
	ErrPaymentsAPI = errs.Class("consoleapi payments")
)
View Source
var ErrProjectsAPI = errs.Class("consoleapi projects api")
View Source
var (
	// ErrUsageLimitsAPI - console usage and limits api error type.
	ErrUsageLimitsAPI = errs.Class("console usage and limits")
)
View Source
var (
	// ErrUtils - console utils error type.
	ErrUtils = errs.Class("console api utils")
)

Functions

func ValidateEmail added in v1.53.1

func ValidateEmail(email string) bool

ValidateEmail validates email to have correct form and syntax.

Types

type APIKeys added in v1.26.2

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

APIKeys is an api controller that exposes all api keys related functionality.

func NewAPIKeys added in v1.26.2

func NewAPIKeys(log *zap.Logger, service *console.Service) *APIKeys

NewAPIKeys is a constructor for api api keys controller.

func (*APIKeys) DeleteByNameAndProjectID added in v1.26.2

func (keys *APIKeys) DeleteByNameAndProjectID(w http.ResponseWriter, r *http.Request)

DeleteByNameAndProjectID deletes specific api key by it's name and project ID.

type Analytics added in v1.27.0

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

Analytics is an api controller that exposes analytics related functionality.

func NewAnalytics added in v1.27.0

func NewAnalytics(log *zap.Logger, service *console.Service, a *analytics.Service) *Analytics

NewAnalytics is a constructor for api analytics controller.

func (*Analytics) EventTriggered added in v1.27.0

func (a *Analytics) EventTriggered(w http.ResponseWriter, r *http.Request)

EventTriggered tracks the occurrence of an arbitrary event on the client.

type Auth

type Auth struct {
	ExternalAddress           string
	LetUsKnowURL              string
	TermsAndConditionsURL     string
	ContactInfoURL            string
	PasswordRecoveryURL       string
	CancelPasswordRecoveryURL string
	ActivateAccountURL        string
	// contains filtered or unexported fields
}

Auth is an api controller that exposes all auth functionality.

func NewAuth

func NewAuth(log *zap.Logger, service *console.Service, mailService *mailservice.Service, cookieAuth *consolewebauth.CookieAuth, partners *rewards.PartnersService, analytics *analytics.Service, externalAddress string, letUsKnowURL string, termsAndConditionsURL string, contactInfoURL string) *Auth

NewAuth is a constructor for api auth controller.

func (*Auth) ChangeEmail added in v1.17.1

func (a *Auth) ChangeEmail(w http.ResponseWriter, r *http.Request)

ChangeEmail auth user, changes users email for a new one.

func (*Auth) ChangePassword

func (a *Auth) ChangePassword(w http.ResponseWriter, r *http.Request)

ChangePassword auth user, changes users password for a new one.

func (*Auth) DeleteAccount added in v0.25.0

func (a *Auth) DeleteAccount(w http.ResponseWriter, r *http.Request)

DeleteAccount authorizes user and deletes account by password.

func (*Auth) DisableUserMFA added in v1.36.1

func (a *Auth) DisableUserMFA(w http.ResponseWriter, r *http.Request)

DisableUserMFA disables multi-factor authentication for the user.

func (*Auth) EnableUserMFA added in v1.36.1

func (a *Auth) EnableUserMFA(w http.ResponseWriter, r *http.Request)

EnableUserMFA enables multi-factor authentication for the user.

func (*Auth) ForgotPassword

func (a *Auth) ForgotPassword(w http.ResponseWriter, r *http.Request)

ForgotPassword creates password-reset token and sends email to user.

func (*Auth) GenerateMFARecoveryCodes added in v1.36.1

func (a *Auth) GenerateMFARecoveryCodes(w http.ResponseWriter, r *http.Request)

GenerateMFARecoveryCodes creates a new set of MFA recovery codes for the user.

func (*Auth) GenerateMFASecretKey added in v1.36.1

func (a *Auth) GenerateMFASecretKey(w http.ResponseWriter, r *http.Request)

GenerateMFASecretKey creates a new TOTP secret key for the user.

func (*Auth) GetAccount added in v0.25.0

func (a *Auth) GetAccount(w http.ResponseWriter, r *http.Request)

GetAccount gets authorized user and take it's params.

func (*Auth) Logout added in v0.31.6

func (a *Auth) Logout(w http.ResponseWriter, r *http.Request)

Logout removes auth cookie.

func (*Auth) Register

func (a *Auth) Register(w http.ResponseWriter, r *http.Request)

Register creates new user, sends activation e-mail. If a user with the given e-mail address already exists, a password reset e-mail is sent instead.

func (*Auth) ResendEmail

func (a *Auth) ResendEmail(w http.ResponseWriter, r *http.Request)

ResendEmail generates activation token by e-mail address and sends email account activation email to user. If the account is already activated, a password reset e-mail is sent instead.

func (*Auth) ResetPassword added in v1.37.1

func (a *Auth) ResetPassword(w http.ResponseWriter, r *http.Request)

ResetPassword resets user's password using recovery token.

func (*Auth) Token

func (a *Auth) Token(w http.ResponseWriter, r *http.Request)

Token authenticates user by credentials and returns auth token.

func (*Auth) UpdateAccount added in v0.25.0

func (a *Auth) UpdateAccount(w http.ResponseWriter, r *http.Request)

UpdateAccount updates user's full name and short name.

type Buckets added in v1.18.1

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

Buckets is an api controller that exposes all buckets related functionality.

func NewBuckets added in v1.18.1

func NewBuckets(log *zap.Logger, service *console.Service) *Buckets

NewBuckets is a constructor for api buckets controller.

func (*Buckets) AllBucketNames added in v1.18.1

func (b *Buckets) AllBucketNames(w http.ResponseWriter, r *http.Request)

AllBucketNames returns all bucket names for a specific project.

type ContextChannel added in v1.46.3

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

ContextChannel is a generic, context-aware channel.

func (*ContextChannel) Get added in v1.46.3

func (c *ContextChannel) Get(ctx context.Context) (interface{}, error)

Get waits until a value is sent and returns it, or returns an error if the context has closed.

func (*ContextChannel) Send added in v1.46.3

func (c *ContextChannel) Send(ctx context.Context, val interface{}) error

Send waits until a value can be sent and sends it, or returns an error if the context has closed.

type Handler added in v1.49.3

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

Handler is an api handler that exposes all projects related functionality.

func NewProjectManagement added in v1.49.3

func NewProjectManagement(log *zap.Logger, service ProjectManagementService, router *mux.Router, auth api.Auth) *Handler

type Payments

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

Payments is an api controller that exposes all payment related functionality.

func NewPayments

func NewPayments(log *zap.Logger, service *console.Service) *Payments

NewPayments is a constructor for api payments controller.

func (*Payments) AccountBalance

func (p *Payments) AccountBalance(w http.ResponseWriter, r *http.Request)

AccountBalance returns an integer amount in cents that represents the current balance of payment account.

func (*Payments) AddCreditCard

func (p *Payments) AddCreditCard(w http.ResponseWriter, r *http.Request)

AddCreditCard is used to save new credit card and attach it to payment account.

func (*Payments) ApplyCouponCode added in v1.35.2

func (p *Payments) ApplyCouponCode(w http.ResponseWriter, r *http.Request)

ApplyCouponCode applies a coupon code to the user's account.

func (*Payments) BillingHistory added in v0.25.0

func (p *Payments) BillingHistory(w http.ResponseWriter, r *http.Request)

BillingHistory returns a list of invoices, transactions and all others billing history items for payment account.

func (*Payments) ClaimWallet added in v1.56.1

func (p *Payments) ClaimWallet(w http.ResponseWriter, r *http.Request)

ClaimWallet will claim a new wallet address. Returns with existing if it's already claimed.

func (*Payments) GetCoupon added in v1.37.1

func (p *Payments) GetCoupon(w http.ResponseWriter, r *http.Request)

GetCoupon returns the coupon applied to the user's account.

func (*Payments) GetWallet added in v1.56.1

func (p *Payments) GetWallet(w http.ResponseWriter, r *http.Request)

GetWallet returns the wallet address (with balance) already assigned to the user.

func (*Payments) ListCreditCards

func (p *Payments) ListCreditCards(w http.ResponseWriter, r *http.Request)

ListCreditCards returns a list of credit cards for a given payment account.

func (*Payments) MakeCreditCardDefault

func (p *Payments) MakeCreditCardDefault(w http.ResponseWriter, r *http.Request)

MakeCreditCardDefault makes a credit card default payment method.

func (*Payments) ProjectsCharges added in v0.26.0

func (p *Payments) ProjectsCharges(w http.ResponseWriter, r *http.Request)

ProjectsCharges returns how much money current user will be charged for each project which he owns.

func (*Payments) RemoveCreditCard

func (p *Payments) RemoveCreditCard(w http.ResponseWriter, r *http.Request)

RemoveCreditCard is used to detach a credit card from payment account.

func (*Payments) SetupAccount

func (p *Payments) SetupAccount(w http.ResponseWriter, r *http.Request)

SetupAccount creates a payment account for the user.

func (*Payments) TokenDeposit added in v0.26.0

func (p *Payments) TokenDeposit(w http.ResponseWriter, r *http.Request)

TokenDeposit creates new deposit transaction and info about address and amount of newly created tx.

func (*Payments) Transactions added in v1.56.1

func (p *Payments) Transactions(w http.ResponseWriter, r *http.Request)

Transactions returns with the list of storjscan transactions.

type ProjectManagementService added in v1.49.3

type ProjectManagementService interface {
	GenGetUsersProjects(context.Context) ([]console.Project, api.HTTPError)
	GenGetSingleBucketUsageRollup(context.Context, uuid.UUID, string, time.Time, time.Time) (*accounting.BucketUsageRollup, api.HTTPError)
	GenGetBucketUsageRollups(context.Context, uuid.UUID, time.Time, time.Time) ([]accounting.BucketUsageRollup, api.HTTPError)
	GenCreateProject(context.Context, console.ProjectInfo) (*console.Project, api.HTTPError)
	GenUpdateProject(context.Context, uuid.UUID, console.ProjectInfo) (*console.Project, api.HTTPError)
}

type UsageLimits added in v1.34.1

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

UsageLimits is an api controller that exposes all usage and limits related functionality.

func NewUsageLimits added in v1.34.1

func NewUsageLimits(log *zap.Logger, service *console.Service) *UsageLimits

NewUsageLimits is a constructor for api usage and limits controller.

func (*UsageLimits) DailyUsage added in v1.48.1

func (ul *UsageLimits) DailyUsage(w http.ResponseWriter, r *http.Request)

DailyUsage returns daily usage by project ID.

func (*UsageLimits) ProjectUsageLimits added in v1.34.1

func (ul *UsageLimits) ProjectUsageLimits(w http.ResponseWriter, r *http.Request)

ProjectUsageLimits returns usage and limits by project ID.

func (*UsageLimits) TotalUsageLimits added in v1.34.1

func (ul *UsageLimits) TotalUsageLimits(w http.ResponseWriter, r *http.Request)

TotalUsageLimits returns total usage and limits for all the projects that user owns.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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