user

package
v0.0.0-...-69a499a Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "user"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [9]string{"getAuths", "deactivate", "getUser", "validate-email", "update-user", "resend-verify-email", "update-phone", "resend-otp", "verify-phone"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeInternalServerError

func MakeInternalServerError(err error) *goa.ServiceError

MakeInternalServerError builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func NewDeactivateEndpoint

func NewDeactivateEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewDeactivateEndpoint returns an endpoint function that calls the method "deactivate" of service "user".

func NewGetAuthsEndpoint

func NewGetAuthsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetAuthsEndpoint returns an endpoint function that calls the method "getAuths" of service "user".

func NewGetUserEndpoint

func NewGetUserEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewGetUserEndpoint returns an endpoint function that calls the method "getUser" of service "user".

func NewResendOtpEndpoint

func NewResendOtpEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewResendOtpEndpoint returns an endpoint function that calls the method "resend-otp" of service "user".

func NewResendVerifyEmailEndpoint

func NewResendVerifyEmailEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewResendVerifyEmailEndpoint returns an endpoint function that calls the method "resend-verify-email" of service "user".

func NewUpdatePhoneEndpoint

func NewUpdatePhoneEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewUpdatePhoneEndpoint returns an endpoint function that calls the method "update-phone" of service "user".

func NewUpdateUserEndpoint

func NewUpdateUserEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewUpdateUserEndpoint returns an endpoint function that calls the method "update-user" of service "user".

func NewValidateEmailEndpoint

func NewValidateEmailEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewValidateEmailEndpoint returns an endpoint function that calls the method "validate-email" of service "user".

func NewVerifyPhoneEndpoint

func NewVerifyPhoneEndpoint(s Service, authJWTFn security.AuthJWTFunc, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewVerifyPhoneEndpoint returns an endpoint function that calls the method "verify-phone" of service "user".

func NewViewedAuthStatusMedia

func NewViewedAuthStatusMedia(res *AuthStatusMedia, view string) *userviews.AuthStatusMedia

NewViewedAuthStatusMedia initializes viewed result type AuthStatusMedia from result type AuthStatusMedia using the given view.

func NewViewedUserMedia

func NewViewedUserMedia(res *UserMedia, view string) *userviews.UserMedia

NewViewedUserMedia initializes viewed result type UserMedia from result type UserMedia using the given view.

Types

type AuthStatusMedia

type AuthStatusMedia struct {
	// True if user has google Oauth signin
	Google bool
	// True if user has facebook Oauth signin
	Facebook bool
	// True if user has twitter Oauth signin
	Twitter bool
	// True if user has linkedin Oauth signin
	Linkedin bool
	// True if user has microsoft Oauth signin
	Instagram bool
	// True if user has password signin
	Standard bool
}

AuthStatusMedia is the result type of the user service getAuths method.

func NewAuthStatusMedia

func NewAuthStatusMedia(vres *userviews.AuthStatusMedia) *AuthStatusMedia

NewAuthStatusMedia initializes result type AuthStatusMedia from viewed result type AuthStatusMedia.

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	GetAuthsEndpoint          goa.Endpoint
	DeactivateEndpoint        goa.Endpoint
	GetUserEndpoint           goa.Endpoint
	ValidateEmailEndpoint     goa.Endpoint
	UpdateUserEndpoint        goa.Endpoint
	ResendVerifyEmailEndpoint goa.Endpoint
	UpdatePhoneEndpoint       goa.Endpoint
	ResendOtpEndpoint         goa.Endpoint
	VerifyPhoneEndpoint       goa.Endpoint
}

Client is the "user" service client.

func NewClient

func NewClient(getAuths, deactivate, getUser, validateEmail, updateUser, resendVerifyEmail, updatePhone, resendOtp, verifyPhone goa.Endpoint) *Client

NewClient initializes a "user" service client given the endpoints.

func (*Client) Deactivate

func (c *Client) Deactivate(ctx context.Context, p *DeactivatePayload) (err error)

Deactivate calls the "deactivate" endpoint of the "user" service. Deactivate may return the following errors:

  • "Forbidden" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) GetAuths

func (c *Client) GetAuths(ctx context.Context, p *GetAuthsPayload) (res *AuthStatusMedia, err error)

GetAuths calls the "getAuths" endpoint of the "user" service. GetAuths may return the following errors:

  • "BadRequest" (type *goa.ServiceError)
  • "Unauthorized" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, p *GetUserPayload) (res *UserMedia, err error)

GetUser calls the "getUser" endpoint of the "user" service. GetUser may return the following errors:

  • "Forbidden" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) ResendOtp

func (c *Client) ResendOtp(ctx context.Context, p *ResendOtpPayload) (err error)

ResendOtp calls the "resend-otp" endpoint of the "user" service. ResendOtp may return the following errors:

  • "BadRequest" (type *goa.ServiceError)
  • "Unauthorized" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) ResendVerifyEmail

func (c *Client) ResendVerifyEmail(ctx context.Context, p *ResendVerifyEmailPayload) (err error)

ResendVerifyEmail calls the "resend-verify-email" endpoint of the "user" service. ResendVerifyEmail may return the following errors:

  • "NotFound" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) UpdatePhone

func (c *Client) UpdatePhone(ctx context.Context, p *UpdatePhonePayload) (err error)

UpdatePhone calls the "update-phone" endpoint of the "user" service. UpdatePhone may return the following errors:

  • "BadRequest" (type *goa.ServiceError)
  • "Unauthorized" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, p *UserUpdateParams) (res *UserMedia, err error)

UpdateUser calls the "update-user" endpoint of the "user" service. UpdateUser may return the following errors:

  • "Forbidden" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) ValidateEmail

func (c *Client) ValidateEmail(ctx context.Context, p *ValidateEmailPayload) (err error)

ValidateEmail calls the "validate-email" endpoint of the "user" service. ValidateEmail may return the following errors:

  • "NotFound" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

func (*Client) VerifyPhone

func (c *Client) VerifyPhone(ctx context.Context, p *VerifyPhonePayload) (err error)

VerifyPhone calls the "verify-phone" endpoint of the "user" service. VerifyPhone may return the following errors:

  • "BadRequest" (type *goa.ServiceError)
  • "Unauthorized" (type *goa.ServiceError)
  • "InternalServerError" (type *goa.ServiceError)
  • error: internal error

type DeactivatePayload

type DeactivatePayload struct {
	ID            *string
	Admin         *string
	Authorization *string
	XSession      *string
	APIKey        *string
}

DeactivatePayload is the payload type of the user service deactivate method.

type Endpoints

type Endpoints struct {
	GetAuths          goa.Endpoint
	Deactivate        goa.Endpoint
	GetUser           goa.Endpoint
	ValidateEmail     goa.Endpoint
	UpdateUser        goa.Endpoint
	ResendVerifyEmail goa.Endpoint
	UpdatePhone       goa.Endpoint
	ResendOtp         goa.Endpoint
	VerifyPhone       goa.Endpoint
}

Endpoints wraps the "user" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "user" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "user" service endpoints.

type GetAuthsPayload

type GetAuthsPayload struct {
	UserID        *string
	Authorization *string
	XSession      *string
	APIKey        *string
}

GetAuthsPayload is the payload type of the user service getAuths method.

type GetUserPayload

type GetUserPayload struct {
	Authorization *string
	XSession      *string
	APIKey        *string
}

GetUserPayload is the payload type of the user service getUser method.

type ResendOtpPayload

type ResendOtpPayload struct {
	Authorization *string
	XSession      *string
	APIKey        *string
}

ResendOtpPayload is the payload type of the user service resend-otp method.

type ResendVerifyEmailPayload

type ResendVerifyEmailPayload struct {
	Authorization *string
	XSession      *string
	APIKey        *string
}

ResendVerifyEmailPayload is the payload type of the user service resend-verify-email method.

type Service

type Service interface {
	// Returns whether Oauth is attached or not
	GetAuths(context.Context, *GetAuthsPayload) (res *AuthStatusMedia, err error)
	// Disable a user's account
	Deactivate(context.Context, *DeactivatePayload) (err error)
	// Get a user's details
	GetUser(context.Context, *GetUserPayload) (res *UserMedia, err error)
	// Validates an email address, designed to be called by users directly in their
	// browser
	ValidateEmail(context.Context, *ValidateEmailPayload) (err error)
	// Update a user
	UpdateUser(context.Context, *UserUpdateParams) (res *UserMedia, err error)
	// Resends a verify email for the current user, also invalidates the link on
	// the previously send email verification
	ResendVerifyEmail(context.Context, *ResendVerifyEmailPayload) (err error)
	// Update Phone and send an OTP to entered phone for verification
	UpdatePhone(context.Context, *UpdatePhonePayload) (err error)
	// Resend otp for phone verification
	ResendOtp(context.Context, *ResendOtpPayload) (err error)
	// Verify phone with entered phone
	VerifyPhone(context.Context, *VerifyPhonePayload) (err error)
}

Service is the user service interface.

type UpdatePhonePayload

type UpdatePhonePayload struct {
	Phone         *string
	Country       *string
	Authorization *string
	XSession      *string
	APIKey        *string
}

UpdatePhonePayload is the payload type of the user service update-phone method.

type UserMedia

type UserMedia struct {
	// Unique unchanging user ID
	ID string
	// Given name for the user
	FirstName string
	// Family name for the user
	LastName string
	// Email attached to the account of the user
	Email string
	// Phone Number Of the user
	Phone string
	// When the user attempts to change their email, this is what they will change
	// it to after they verify that it belongs to them
	ChangingEmail *string
	// Whether the user has verified their email
	VerifiedEmail bool
	// Whether the user is an administrator on the site
	IsAdmin          *bool
	UpdatedAt        *string
	IsActive         *bool
	CreatedAt        *string
	CountryPhoneCode *string
	Authorization    string
	XSession         string
}

UserMedia is the result type of the user service getUser method.

func NewUserMedia

func NewUserMedia(vres *userviews.UserMedia) *UserMedia

NewUserMedia initializes result type UserMedia from viewed result type UserMedia.

type UserUpdateParams

type UserUpdateParams struct {
	// Given name for the user
	FirstName *string
	// Family name for the user
	LastName *string
	// Email attached to the account of the user
	Email *string
	// Phone Number Of the user
	Phone *string
	// When the user attempts to change their email, this is what they will change
	// it to after they verify that it belongs to them
	ChangingEmail *string
	// Whether the user has verified their email
	VerifiedEmail *bool
	// Whether the user is an administrator on the site
	IsAdmin          *bool
	CountryPhoneCode *string
	Authorization    *string
	XSession         *string
	APIKey           *string
}

UserUpdateParams is the payload type of the user service update-user method.

type ValidateEmailPayload

type ValidateEmailPayload struct {
	ValidateID *string
	APIKey     *string
}

ValidateEmailPayload is the payload type of the user service validate-email method.

type VerifyPhonePayload

type VerifyPhonePayload struct {
	Otp           *string
	Authorization *string
	XSession      *string
	APIKey        *string
}

VerifyPhonePayload is the payload type of the user service verify-phone method.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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