user

package
v0.0.0-...-5f4f256 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 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 = [6]string{"getAuths", "deactivate", "getUser", "validate-email", "update-user", "resend-verify-email"}

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 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 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 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 AggCampaignMedia

type AggCampaignMedia struct {
	Rejected    []interface{}
	Invited     []interface{}
	Applied     []interface{}
	Shortlisted []interface{}
	Selected    []interface{}
	Previous    []interface{}
}

type AggInstagramMedia

type AggInstagramMedia struct {
	Website        *string
	SelectedPlan   *SelectedPlanMedia
	Username       *string
	ProfilePicture *string
	Bio            *string
	ID             *string
	IsBusiness     *bool
	FullName       *string
}

type AggSocialMedia

type AggSocialMedia struct {
	Instagram *AggInstagramMedia
}

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
	Microsoft 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
}

Client is the "user" service client.

func NewClient

func NewClient(getAuths, deactivate, getUser, validateEmail, updateUser, resendVerifyEmail 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) 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) 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

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
}

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 ResendVerifyEmailPayload

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

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

type SelectedPlanMedia

type SelectedPlanMedia struct {
	ID          *string `json:"id"`
	Title       *string `json:"title"`
	Description *string `json:"description"`
	CPC         *int    `json:"CPC"`
	Commission  *int    `json:"commission"`
	OneP        *int    `json:"1P"`
	TwoP        *int    `json:"2P"`
	OneV        *int    `json:"1V"`
	TwoV        *int    `json:"2V"`
	OnePOneV    *int    `json:"1P + 1V"`
}

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)
}

Service is the user service interface.

type UserLocationMedia

type UserLocationMedia struct {
	Street   *string
	Line2    *string
	Locality *string
	City     *string
	State    *string
	Country  *string
	Postcode *string
	Text     *string
}

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
	// Category of the user generated by our algorithms
	Category *string
	// Phone Number Of the user
	Username 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
	Genres        []string
	// Whether the user has verified their email
	VerifiedEmail bool
	// Whether the user is an administrator on the site
	IsAdmin bool
	// Whether the user is a brand manager on the site
	IsBrandManager     bool
	UID                *string
	UpdatedAt          *string
	IsActive           *bool
	AggCampaigns       *AggCampaignMedia
	Gender             *string
	Onboarded          *UserOnboardedMedia
	Location           *UserLocationMedia
	Dob                *string
	CreatedAt          *string
	AggSocial          *AggSocialMedia
	SocialMediaRawData interface{}
	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 UserOnboardedMedia

type UserOnboardedMedia struct {
	Profile         *bool
	Signup          *bool
	Store           *bool
	CampaignDetails *bool
}

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
	// Phone Number Of the user
	Username *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
	Genres        []string
	// Whether the user has verified their email
	VerifiedEmail *bool
	// Whether the user is an administrator on the site
	IsAdmin *bool
	// Whether the user is a brand manager on the site
	IsBrandManager *bool
	UID            *string
	UpdatedAt      *string
	IsActive       *bool
	Gender         *string
	Dob            *string
	CreatedAt      *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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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