v1

package
v0.0.0-...-385473e Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangePasswordRequest

type ChangePasswordRequest struct {
	// 旧密码.
	OldPassword string `json:"oldPassword" valid:"required,stringlength(6|18)"`

	// 新密码.
	NewPassword string `json:"newPassword" valid:"required,stringlength(6|18)"`
}

ChangePasswordRequest 指定了 `POST /v1/users/{name}/change-password` 接口的请求参数.

type CreatePostRequest

type CreatePostRequest struct {
	Title   string `json:"title" valid:"required,stringlength(1|256)"`
	Content string `json:"content" valid:"required,stringlength(1|10240)"`
}

CreatePostRequest 指定了 `POST /v1/posts` 接口的请求参数.

type CreatePostResponse

type CreatePostResponse struct {
	PostID string `json:"postID"`
}

CreatePostResponse 指定了 `POST /v1/posts` 接口的返回参数.

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username" valid:"alphanum,required,stringlength(1|255)"`
	Password string `json:"password" valid:"required,stringlength(6|18)"`
	Nickname string `json:"nickname" valid:"required,stringlength(1|255)"`
	Email    string `json:"email" valid:"required,email"`
	Phone    string `json:"phone" valid:"required,stringlength(11|11)"`
}

CreateUserRequest 指定了 `POST /v1/users` 接口的请求参数.

type GetPostResponse

type GetPostResponse PostInfo

GetPostResponse 指定了 `GET /v1/posts/{postID}` 接口的返回参数.

type GetUserResponse

type GetUserResponse UserInfo

GetUserResponse 指定了 `GET /v1/users/{name}` 接口的返回参数.

type ListPostRequest

type ListPostRequest struct {
	Offset int `form:"offset"`
	Limit  int `form:"limit"`
}

ListPostRequest 指定了 `GET /v1/posts` 接口的请求参数.

type ListPostResponse

type ListPostResponse struct {
	TotalCount int64       `json:"totalCount"`
	Posts      []*PostInfo `json:"posts"`
}

ListPostResponse 指定了 `GET /v1/posts` 接口的返回参数.

type ListUserRequest

type ListUserRequest struct {
	Offset int `form:"offset"`
	Limit  int `form:"limit"`
}

ListUserRequest 指定了 `GET /v1/users` 接口的请求参数.

type ListUserResponse

type ListUserResponse struct {
	TotalCount int64       `json:"totalCount"`
	Users      []*UserInfo `json:"users"`
}

ListUserResponse 指定了 `GET /v1/users` 接口的返回参数.

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" valid:"alphanum,required,stringlength(1|255)"`
	Password string `json:"password" valid:"required,stringlength(6|18)"`
}

LoginRequest 指定了 `POST /login` 接口的请求参数.

type LoginResponse

type LoginResponse struct {
	Token string `json:"token"`
}

LoginResponse 指定了 `POST /login` 接口的返回参数.

type PostInfo

type PostInfo struct {
	Username  string `json:"username,omitempty"`
	PostID    string `json:"postID,omitempty"`
	Title     string `json:"title"`
	Content   string `json:"content"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

PostInfo 指定了博客的详细信息.

type UpdatePostRequest

type UpdatePostRequest struct {
	Title   *string `json:"title" valid:"stringlength(1|256)"`
	Content *string `json:"content" valid:"stringlength(1|10240)"`
}

UpdatePostRequest 指定了 `PUT /v1/posts` 接口的请求参数.

type UpdateUserRequest

type UpdateUserRequest struct {
	Nickname *string `json:"nickname" valid:"stringlength(1|255)"`
	Email    *string `json:"email" valid:"email"`
	Phone    *string `json:"phone" valid:"stringlength(11|11)"`
}

UpdateUserRequest 指定了 `PUT /v1/users/{name}` 接口的请求参数.

type UserInfo

type UserInfo struct {
	Username  string `json:"username"`
	Nickname  string `json:"nickname"`
	Email     string `json:"email"`
	Phone     string `json:"phone"`
	PostCount int64  `json:"postCount"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

UserInfo 指定了用户的详细信息.

Jump to

Keyboard shortcuts

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