rest

package
v0.0.0-...-0f1690e Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package rest provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

View Source
const (
	JWTAuthScopes = "JWTAuth.Scopes"
)

Variables

This section is empty.

Functions

func AccessTokenMiddleware

func AccessTokenMiddleware(next http.Handler) http.Handler

func BindAndValidate

func BindAndValidate(request *http.Request, target any) error

BindAndValidate TODO: if a json field has wrong type comparing to GO lang struct then the func below throws error like: json: cannot unmarshal bool into Go struct field UpdatePasswordRequest.feel_like_get_hacked of type string it should be replaced by error "invalid type of field"

func GetAccountIDFromJWT

func GetAccountIDFromJWT(r *http.Request) (string, error)

func GetEmailFromURL

func GetEmailFromURL(r *http.Request) (string, error)

func GetNicknameFromPath

func GetNicknameFromPath(r *http.Request) (string, error)

func GetNicknameFromURL

func GetNicknameFromURL(r *http.Request) (string, error)

func GetRealIP

func GetRealIP(r *http.Request) (string, error)

func GetUUIDFromPath

func GetUUIDFromPath(r *http.Request) (string, error)

func GetValidationError

func GetValidationError(errs validator.ValidationErrors) error

func GetValidator

func GetValidator() *validator.Validate

func IsJSONMiddleware

func IsJSONMiddleware(next http.Handler) http.Handler

func ValidateNickname

func ValidateNickname(nickname string) (bool, error)

func WriteErrorResponse

func WriteErrorResponse(ctx context.Context, errorResponse error, writer http.ResponseWriter,
	meta map[string]interface{})

func WriteResponse

func WriteResponse(ctx context.Context, body []byte, statusCode int, writer http.ResponseWriter)

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken string `json:"access_token"`
}

AccessTokenResponse defines model for AccessTokenResponse.

type AccountResponse

type AccountResponse struct {
	BirthDate      openapi_types.Date `json:"birth_date"`
	CurrentCountry string             `json:"current_country"`
	Email          string             `json:"email"`
	FirstName      string             `json:"first_name"`
	LastName       string             `json:"last_name"`
	Nickname       string             `json:"nickname"`
}

AccountResponse defines model for AccountResponse.

type CaptchaResponse

type CaptchaResponse struct {
	Captcha   string  `json:"captcha"`
	CaptchaId string  `json:"captcha_id"`
	PipeId    *string `json:"pipe_id,omitempty"`
}

CaptchaResponse defines model for CaptchaResponse.

type GenerateCaptchaRequest

type GenerateCaptchaRequest struct {
	CaptchaType int `json:"captcha_type" validate:"required,oneof=1 2"`
}

GenerateCaptchaRequest defines model for GenerateCaptchaRequest.

type GetAccountsEmailParams

type GetAccountsEmailParams struct {
	// Email Email to check
	Email string `form:"email" json:"email"`
}

GetAccountsEmailParams defines parameters for GetAccountsEmail.

type GetAccountsNicknameParams

type GetAccountsNicknameParams struct {
	// Nickname Nickname to check
	Nickname string `form:"nickname" json:"nickname"`
}

GetAccountsNicknameParams defines parameters for GetAccountsNickname.

type GetAccountsSignInCaptchaCheckParams

type GetAccountsSignInCaptchaCheckParams struct {
	Email string `form:"email" json:"email"`
}

GetAccountsSignInCaptchaCheckParams defines parameters for GetAccountsSignInCaptchaCheck.

type HandleSessionsOverflowRequest

type HandleSessionsOverflowRequest struct {
	Email     string `json:"email" validate:"required,email"`
	PipeId    string `json:"pipe_id" validate:"required,uuid"`
	VerifCode string `json:"verif_code" validate:"required,numeric"`
}

HandleSessionsOverflowRequest defines model for HandleSessionsOverflowRequest.

type HandleSessionsOverflowResponse

type HandleSessionsOverflowResponse struct {
	AccessToken string `json:"access_token"`
}

HandleSessionsOverflowResponse defines model for HandleSessionsOverflowResponse.

type IsCaptchaForSignInResponse

type IsCaptchaForSignInResponse struct {
	IsCaptcha bool `json:"is_captcha"`
}

IsCaptchaForSignInResponse defines model for IsCaptchaForSignInResponse.

type PasswordReset

type PasswordReset struct {
	Email       string `json:"email" validate:"required,email"`
	NewPassword string `json:"new_password" validate:"required,gte=10,password"`
	VerifCode   string `json:"verif_code" validate:"required,numeric"`
}

PasswordReset defines model for PasswordReset.

type PasswordResetRequest

type PasswordResetRequest struct {
	CaptchaId             string `json:"captcha_id" validate:"required,base64"`
	Email                 string `json:"email" validate:"required,email"`
	ProvidedCaptchaAnswer string `json:"provided_captcha_answer" validate:"required,numeric"`
}

PasswordResetRequest defines model for PasswordResetRequest.

type PostAccountsPasswordResetJSONRequestBody

type PostAccountsPasswordResetJSONRequestBody = PasswordReset

PostAccountsPasswordResetJSONRequestBody defines body for PostAccountsPasswordReset for application/json ContentType.

type PostAccountsPasswordResetRequestJSONRequestBody

type PostAccountsPasswordResetRequestJSONRequestBody = PasswordResetRequest

PostAccountsPasswordResetRequestJSONRequestBody defines body for PostAccountsPasswordResetRequest for application/json ContentType.

type PostAccountsSessionsOverflowHandlingJSONRequestBody

type PostAccountsSessionsOverflowHandlingJSONRequestBody = HandleSessionsOverflowRequest

PostAccountsSessionsOverflowHandlingJSONRequestBody defines body for PostAccountsSessionsOverflowHandling for application/json ContentType.

type PostAccountsSignUpPipeJSONRequestBody

type PostAccountsSignUpPipeJSONRequestBody = StartSignUpPipeRequest

PostAccountsSignUpPipeJSONRequestBody defines body for PostAccountsSignUpPipe for application/json ContentType.

type PostCaptchaJSONRequestBody

type PostCaptchaJSONRequestBody = GenerateCaptchaRequest

PostCaptchaJSONRequestBody defines body for PostCaptcha for application/json ContentType.

type PostSendingVerifCodePasswordResetJSONRequestBody

type PostSendingVerifCodePasswordResetJSONRequestBody = ResendVerifCodeForPasswordReset

PostSendingVerifCodePasswordResetJSONRequestBody defines body for PostSendingVerifCodePasswordReset for application/json ContentType.

type PutAccountsJSONRequestBody

type PutAccountsJSONRequestBody = UpdateAccountRequest

PutAccountsJSONRequestBody defines body for PutAccounts for application/json ContentType.

type RefreshTokenResponse

type RefreshTokenResponse struct {
	RefreshToken string `json:"refresh_token"`
}

RefreshTokenResponse defines model for RefreshTokenResponse.

type ResendVerifCodeForPasswordReset

type ResendVerifCodeForPasswordReset struct {
	Email string `json:"email" validate:"required,email"`
}

ResendVerifCodeForPasswordReset defines model for ResendVerifCodeForPasswordReset.

type SendCodeToCleanSessionsRequest

type SendCodeToCleanSessionsRequest struct {
	Email  string `json:"email" validate:"required,email"`
	PipeId string `json:"pipe_id" validate:"required,uuid"`
}

SendCodeToCleanSessionsRequest defines model for SendCodeToCleanSessionsRequest.

type SendVerifCodeJSONRequestBody

type SendVerifCodeJSONRequestBody = VerifCodeForSignUpRequest

SendVerifCodeJSONRequestBody defines body for SendVerifCode for application/json ContentType.

type SendVerifCodeToCleanSessionsJSONRequestBody

type SendVerifCodeToCleanSessionsJSONRequestBody = SendCodeToCleanSessionsRequest

SendVerifCodeToCleanSessionsJSONRequestBody defines body for SendVerifCodeToCleanSessions for application/json ContentType.

type SignInJSONRequestBody

type SignInJSONRequestBody = SignInRequest

SignInJSONRequestBody defines body for SignIn for application/json ContentType.

type SignInRequest

type SignInRequest struct {
	CaptchaId             string `json:"captcha_id" validate:"omitempty,base64"`
	Email                 string `json:"email" validate:"required,email"`
	Password              string `json:"password" validate:"required"`
	ProvidedCaptchaAnswer string `json:"provided_captcha_answer" validate:"omitempty,numeric"`
}

SignInRequest defines model for SignInRequest.

type SignInResponse

type SignInResponse struct {
	AccessToken string `json:"access_token"`
}

SignInResponse defines model for SignInResponse.

type SignUpJSONRequestBody

type SignUpJSONRequestBody = SignUpRequest

SignUpJSONRequestBody defines body for SignUp for application/json ContentType.

type SignUpRequest

type SignUpRequest struct {
	PipeId    string `json:"pipe_id" validate:"required,uuid"`
	VerifCode string `json:"verif_code" validate:"required,numeric"`
}

SignUpRequest defines model for SignUpRequest.

type StartSignUpPipeRequest

type StartSignUpPipeRequest struct {
	CaptchaId             string `json:"captcha_id" validate:"required,base64"`
	Email                 string `json:"email" validate:"required,email"`
	Nickname              string `json:"nickname" validate:"required,alphanum"`
	Password              string `json:"password" validate:"required,gte=10,password"`
	ProvidedCaptchaAnswer string `json:"provided_captcha_answer" validate:"required,numeric"`
}

StartSignUpPipeRequest defines model for StartSignUpPipeRequest.

type StartSignUpPipeResponse

type StartSignUpPipeResponse struct {
	PipeId string `json:"pipe_id"`
}

StartSignUpPipeResponse defines model for StartSignUpPipeResponse.

type UpdateAccountRequest

type UpdateAccountRequest struct {
	BirthDate      openapi_types.Date `json:"birth_date" validate:"required"`
	CurrentCountry string             `json:"current_country" validate:"required,country"`
	FirstName      string             `json:"first_name" validate:"omitempty,alpha"`
	LastName       string             `json:"last_name" validate:"omitempty,alpha"`
}

UpdateAccountRequest defines model for UpdateAccountRequest.

type UpdatePasswordJSONRequestBody

type UpdatePasswordJSONRequestBody = UpdatePasswordRequest

UpdatePasswordJSONRequestBody defines body for UpdatePassword for application/json ContentType.

type UpdatePasswordRequest

type UpdatePasswordRequest struct {
	FeelLikeGetHacked string `json:"feel_like_get_hacked" validate:"required,boolean"`
	NewPassword       string `json:"new_password" validate:"required,gte=10,password"`
	VerifCode         string `json:"verif_code" validate:"required,numeric"`
}

UpdatePasswordRequest defines model for UpdatePasswordRequest.

type UserIDCtx

type UserIDCtx struct{}

type ValidationError

type ValidationError struct {
	Error  *string   `json:"error,omitempty"`
	Errors *[]string `json:"errors,omitempty"`
}

ValidationError defines model for ValidationError.

type VerifCodeForSignUpRequest

type VerifCodeForSignUpRequest struct {
	PipeId string `json:"pipe_id" validate:"required,uuid"`
}

VerifCodeForSignUpRequest defines model for VerifCodeForSignUpRequest.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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