http

package
v0.0.0-...-47b434b Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinPasswordLength = 6
	MinVarcharLength  = 2
	MaxVarcharLength  = 255
	UUIDLength        = 36
)

Variables

This section is empty.

Functions

func PasswordValidation

func PasswordValidation(pass interface{}) error

custom password validation

upp: at least one upper case letter. low: at least one lower case letter. num: at least one digit. tot: at least eight characters long. No empty string or whitespace.

Types

type Comment

type Comment struct {

	// posting id
	PostingId int64 `json:"posting_id"`

	// comment
	Comment string `json:"comment"`
}

Comment - posting comment

func (*Comment) ValidateParam

func (c *Comment) ValidateParam() error

type Email

type Email struct {

	// email
	Email string `json:"email"`
}

func (*Email) ValidateParam

func (e *Email) ValidateParam() error

type Follow

type Follow struct {

	// followed user name
	FollowedUserName string `json:"followed_user_name"`
}

Follow - follow

func (*Follow) ValidateParam

func (f *Follow) ValidateParam() error

type Like

type Like struct {

	// posting id
	PostingId int64 `json:"posting_id"`
}

Like - like

func (*Like) ValidateParam

func (l *Like) ValidateParam() error

type PostingId

type PostingId struct {

	// posting id
	PostingId int64 `json:"posting_id,omitempty"`
}

type RequestChangePassword

type RequestChangePassword struct {

	// old password
	OldPassword string `json:"old_password"`

	// new password
	NewPassword string `json:"new_password"`
}

func (*RequestChangePassword) ValidateParam

func (req *RequestChangePassword) ValidateParam() error

type RequestLogin

type RequestLogin struct {

	// email
	Email string `json:"email"`

	// password
	Password string `json:"password"`
}

func (*RequestLogin) ValidateParam

func (req *RequestLogin) ValidateParam() error

type RequestRegisterPosting

type RequestRegisterPosting struct {

	// the title of posting
	Title string `json:"title"`

	// base64 encoded file
	Image string `json:"image"`
}

func (*RequestRegisterPosting) ValidateParam

func (req *RequestRegisterPosting) ValidateParam() error

type RequestRegisterUser

type RequestRegisterUser struct {

	// email
	Email string `json:"email"`

	// user_name
	UserName string `json:"user_name"`

	// password
	Password string `json:"password"`
}

func (*RequestRegisterUser) ValidateParam

func (req *RequestRegisterUser) ValidateParam() error

type RequestResetPassword

type RequestResetPassword struct {

	// user name
	UserName string `json:"user_name"`

	// password
	Password string `json:"password"`

	// hashed key for password reset
	PasswordResetKey string `json:"password_reset_key"`
}

func (*RequestResetPassword) ValidateParam

func (req *RequestResetPassword) ValidateParam() error

type RequestUpdateUser

type RequestUpdateUser struct {

	// password
	Password string `json:"password,omitempty"`

	// base64 encoded file
	Icon string `json:"icon,omitempty"`

	// self introduction
	SelfIntroduction string `json:"self_introduction,omitempty"`
}

type ResponseBadRequest

type ResponseBadRequest struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseBadRequest - Bad Reqeust

type ResponseForbidden

type ResponseForbidden struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseForbidden - Forbidden

type ResponseGetComment

type ResponseGetComment struct {

	// comment id
	CommentId int64 `json:"comment_id"`

	// user_name
	UserName string `json:"user_name"`

	// commented datetime with TZ. This means created_at in postings table.
	CommentedAt time.Time `json:"commented_at"`

	// the content of comment
	Comment string `json:"comment"`
}

type ResponseGetComments

type ResponseGetComments struct {

	// posting id
	PostingId int64 `json:"posting_id,omitempty"`

	// list of comment
	Comments []ResponseGetComment `json:"comments,omitempty"`
}

ResponseGetComments - get comments

type ResponseGetCsrfToken

type ResponseGetCsrfToken struct {

	// csrf token
	CsrfToken string `json:"csrf_token"`
}

ResponseGetCsrfToken - get csrf token

type ResponseGetNotification

type ResponseGetNotification struct {

	// acting user name
	VisitorName string `json:"visitor_name"`

	// only when action is like or comment
	PostingId int64 `json:"posting_id,omitempty"`

	// only when action is comment
	CommentId int64 `json:"comment_id,omitempty"`

	// action type
	ActionType string `json:"action_type,omitempty"`

	// datetime with TZ
	CreatedAt time.Time `json:"created_at"`
}

type ResponseGetNotifications

type ResponseGetNotifications struct {

	// acted user name
	VisitedName string `json:"visited_name,omitempty"`

	// actions
	Actions []ResponseGetNotification `json:"actions,omitempty"`
}

ResponseGetNotifications - get notifications

type ResponseGetPosting

type ResponseGetPosting struct {

	// id
	PostingId int64 `json:"posting_id"`

	// user_name
	UserName string `json:"user_name"`

	// uploaded datetime with TZ. This means created_at in postings table.
	UploadedAt time.Time `json:"uploaded_at"`

	// the title of posting
	Title string `json:"title"`

	// image url
	ImageUrl string `json:"image_url,omitempty"`

	// the number of liked
	LikedCount int64 `json:"liked_count"`

	// liked or not by request user
	Liked bool `json:"liked"`
}

type ResponseGetPostings

type ResponseGetPostings struct {

	// list of posting
	Postings []ResponseGetPosting `json:"postings"`
}

ResponseGetPostings - get postings

type ResponseGetUser

type ResponseGetUser struct {

	// user name
	UserName string `json:"user_name"`

	// icon
	Icon string `json:"icon"`

	// self introduction
	SelfIntroduction string `json:"self_introduction"`

	// the total count of posting
	PostingCount int64 `json:"posting_count"`

	// the total count of like
	LikeCount int64 `json:"like_count"`

	// the total count of liked
	LikedCount int64 `json:"liked_count"`

	// the total count of follow
	FollowCount int64 `json:"follow_count"`

	// the total count of followed
	FollowedCount int64 `json:"followed_count"`

	// the datetime when the account is created
	CreatedAt time.Time `json:"created_at"`
}

ResponseGetUser - get user

type ResponseInternalServerError

type ResponseInternalServerError struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseInternalServerError - Internal Server Error

type ResponseNotAllowedMethod

type ResponseNotAllowedMethod struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseNotAllowedMethod - Not Allowed Method

type ResponseNotFound

type ResponseNotFound struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseNotFound - Not Found

type ResponseSimpleSuccess

type ResponseSimpleSuccess struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseSimpleSuccess - Success

type ResponseUnauthorized

type ResponseUnauthorized struct {

	// status
	Status int32 `json:"status"`

	// message
	Message string `json:"message"`
}

ResponseUnauthorized - Unauthorized

type Token

type Token struct {

	// token to request APIs
	IdToken string `json:"id_token"`
}

Jump to

Keyboard shortcuts

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