httptransport

package
v0.0.0-...-75c6f16 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalDashboardResponse

func MarshalDashboardResponse(responseData *way_c.DashboardResponseIDO, w http.ResponseWriter)

func MarshalLoginResponse

func MarshalLoginResponse(responseData *gateway_s.LoginResponseIDO, w http.ResponseWriter)

func MarshalProfileResponse

func MarshalProfileResponse(responseData *user_s.User, w http.ResponseWriter)

func MarshalRefreshTokenResponse

func MarshalRefreshTokenResponse(accessToken string, accessTokenExpiryDate time.Time, refreshToken string, refreshTokenExpiryDate time.Time, u *user_s.User, w http.ResponseWriter)

func UnmarshalExecutiveVisitsTenantRequest

func UnmarshalExecutiveVisitsTenantRequest(ctx context.Context, r *http.Request) (*gateway_c.ExecutiveVisitsTenantRequest, error)

func UnmarshalProfileUpdateRequest

func UnmarshalProfileUpdateRequest(ctx context.Context, r *http.Request) (*user_s.User, error)

func ValidateForgotPasswordRequest

func ValidateForgotPasswordRequest(dirtyData *ForgotPasswordRequestIDO) error

func ValidateLoginRequest

func ValidateLoginRequest(dirtyData *LoginRequestIDO) error

func ValidatePasswordResetRequest

func ValidatePasswordResetRequest(dirtyData *PasswordResetRequestIDO) error

func ValidateProfileUpdateRequest

func ValidateProfileUpdateRequest(dirtyData *ProfileUpdateRequestIDO) error

func ValidateRefreshTokenRequest

func ValidateRefreshTokenRequest(dirtyData *RefreshTokenRequestIDO) (bool, string)

Types

type ForgotPasswordRequestIDO

type ForgotPasswordRequestIDO struct {
	Email string `json:"email"`
}

func UnmarshalForgotPasswordRequest

func UnmarshalForgotPasswordRequest(ctx context.Context, r *http.Request) (*ForgotPasswordRequestIDO, error)

type GreetingRequest

type GreetingRequest struct {
	Name string `json:"name"`
}

type GreetingResponse

type GreetingResponse struct {
	Message string `json:"message"`
}

type Handler

type Handler struct {
	Logger     *slog.Logger
	Controller gateway_c.GatewayController
}

Handler Creates http request handler

func NewHandler

func NewHandler(loggerp *slog.Logger, c gateway_c.GatewayController) *Handler

NewHandler Constructor

func (*Handler) Dashboard

func (h *Handler) Dashboard(w http.ResponseWriter, r *http.Request)

func (*Handler) DisableOTP

func (h *Handler) DisableOTP(w http.ResponseWriter, r *http.Request)

func (*Handler) ExecutiveVisitsTenant

func (h *Handler) ExecutiveVisitsTenant(w http.ResponseWriter, r *http.Request)

func (*Handler) ForgotPassword

func (h *Handler) ForgotPassword(w http.ResponseWriter, r *http.Request)

func (*Handler) GenerateOTP

func (h *Handler) GenerateOTP(w http.ResponseWriter, r *http.Request)

func (*Handler) GenerateOTPAndQRCodePNGImage

func (h *Handler) GenerateOTPAndQRCodePNGImage(w http.ResponseWriter, r *http.Request)

func (*Handler) Greet

func (h *Handler) Greet(w http.ResponseWriter, r *http.Request)

PostGreet returns the greeting

func (*Handler) HealthCheck

func (h *Handler) HealthCheck(w http.ResponseWriter, r *http.Request)

Returns the status of the system.

func (*Handler) Login

func (h *Handler) Login(w http.ResponseWriter, r *http.Request)

func (*Handler) Logout

func (h *Handler) Logout(w http.ResponseWriter, r *http.Request)

func (*Handler) PasswordReset

func (h *Handler) PasswordReset(w http.ResponseWriter, r *http.Request)

func (*Handler) Profile

func (h *Handler) Profile(w http.ResponseWriter, r *http.Request)

func (*Handler) ProfileChangePassword

func (h *Handler) ProfileChangePassword(w http.ResponseWriter, r *http.Request)

func (*Handler) ProfileUpdate

func (h *Handler) ProfileUpdate(w http.ResponseWriter, r *http.Request)

func (*Handler) RefreshToken

func (h *Handler) RefreshToken(w http.ResponseWriter, r *http.Request)

func (*Handler) UserRegister

func (h *Handler) UserRegister(w http.ResponseWriter, r *http.Request)

func (*Handler) ValidateOTP

func (h *Handler) ValidateOTP(w http.ResponseWriter, r *http.Request)

func (*Handler) VerifyOTP

func (h *Handler) VerifyOTP(w http.ResponseWriter, r *http.Request)

func (*Handler) Version

func (h *Handler) Version(w http.ResponseWriter, r *http.Request)

Version returns the server version. Developers note, to see result you can run in your terminal `curl http://localhost:8000/api/v1/version`.

type LoginRequestIDO

type LoginRequestIDO struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

func UnmarshalLoginRequest

func UnmarshalLoginRequest(ctx context.Context, r *http.Request) (*LoginRequestIDO, error)

type PasswordResetRequestIDO

type PasswordResetRequestIDO struct {
	VerificationCode string `json:"verification_code"`
	Password         string `json:"password"`
	PasswordRepeated string `json:"password_repeated"`
}

func UnmarshalPasswordResetRequest

func UnmarshalPasswordResetRequest(ctx context.Context, r *http.Request) (*PasswordResetRequestIDO, error)

type ProfileUpdateRequestIDO

type ProfileUpdateRequestIDO struct {
	FirstName                   string             `bson:"first_name" json:"first_name"`
	LastName                    string             `bson:"last_name" json:"last_name"`
	Email                       string             `json:"email"`
	Phone                       string             `bson:"phone,omitempty" json:"phone,omitempty"`
	Country                     string             `bson:"country,omitempty" json:"country,omitempty"`
	Region                      string             `bson:"region,omitempty" json:"region,omitempty"`
	City                        string             `bson:"city,omitempty" json:"city,omitempty"`
	PostalCode                  string             `bson:"postal_code,omitempty" json:"postal_code,omitempty"`
	AddressLine1                string             `bson:"address_line1,omitempty" json:"address_line1,omitempty"`
	AddressLine2                string             `bson:"address_line2,omitempty" json:"address_line2,omitempty"`
	HowDidYouHearAboutUsID      primitive.ObjectID `bson:"how_did_you_hear_about_us_id" json:"how_did_you_hear_about_us_id,omitempty"`
	IsHowDidYouHearAboutUsOther bool               `bson:"is_how_did_you_hear_about_us_other" json:"is_how_did_you_hear_about_us_other,omitempty"`
	HowDidYouHearAboutUsOther   string             `bson:"how_did_you_hear_about_us_other" json:"how_did_you_hear_about_us_other,omitempty"`
	AgreePromotionsEmail        bool               `bson:"agree_promotions_email,omitempty" json:"agree_promotions_email,omitempty"`
	HasShippingAddress          bool               `bson:"has_shipping_address" json:"has_shipping_address,omitempty"`
	ShippingName                string             `bson:"shipping_name" json:"shipping_name,omitempty"`
	ShippingPhone               string             `bson:"shipping_phone" json:"shipping_phone,omitempty"`
	ShippingCountry             string             `bson:"shipping_country" json:"shipping_country,omitempty"`
	ShippingRegion              string             `bson:"shipping_region" json:"shipping_region,omitempty"`
	ShippingCity                string             `bson:"shipping_city" json:"shipping_city,omitempty"`
	ShippingPostalCode          string             `bson:"shipping_postal_code" json:"shipping_postal_code,omitempty"`
	ShippingAddressLine1        string             `bson:"shipping_address_line1" json:"shipping_address_line1,omitempty"`
	ShippingAddressLine2        string             `bson:"shipping_address_line2" json:"shipping_address_line2,omitempty"`
}

type RefreshTokenRequestIDO

type RefreshTokenRequestIDO struct {
	Value string `json:"value"`
}

func UnmarshalRefreshTokenRequest

func UnmarshalRefreshTokenRequest(ctx context.Context, r *http.Request) (*RefreshTokenRequestIDO, error, int)

type RefreshTokenResponseIDO

type RefreshTokenResponseIDO struct {
	Email                  string    `json:"username"`
	AccessToken            string    `json:"access_token"`
	AccessTokenExpiryDate  time.Time `json:"access_token_expiry_date"`
	RefreshToken           string    `json:"refresh_token"`
	RefreshTokenExpiryDate time.Time `json:"refresh_token_expiry_date"`
}

RefreshTokenResponseIDO struct used to represent the system's response when the `login` POST request was a success.

Jump to

Keyboard shortcuts

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