Documentation ¶
Index ¶
- type AIInfo
- type ChangePasswordRequest
- type CreateAIRequest
- type CreatePostRequest
- type CreatePostResponse
- type CreateUserRequest
- type GetAIResponse
- type GetPostResponse
- type GetUserResponse
- type ListAIRequest
- type ListAIResponse
- type ListPostsRequest
- type ListPostsResponse
- type ListUserRequest
- type ListUserResponse
- type LoginRequest
- type LoginResponse
- type PostInfo
- type UpdateAIRequest
- type UpdatePostRequest
- type UpdateUserRequest
- type UserInfo
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 specifies the request parameters for `POST /v1/users/{username}/change-password`
type CreateAIRequest ¶
type CreateAIRequest AIInfo
type CreatePostRequest ¶
type CreatePostRequest struct { Title string `json:"title" valid:"required,stringlength(1|255)"` Content string `json:"content" valid:"required"` }
CreatePostRequest specifies the request parameters for `POST /v1/posts`
type CreatePostResponse ¶
type CreatePostResponse struct {
PostID string `json:"post_id"`
}
CreatePostResponse specifies the response parameters for `POST /v1/posts`
type CreateUserRequest ¶
type CreateUserRequest struct { Postcount int64 `json:"postcount" valid:"stringlength(1|255)"` Username string `json:"username" valid:"alphanum,required,stringlength(1|30)"` Password string `json:"password" valid:"required,stringlength(6|18)"` Nickname string `json:"nickname" valid:"required,stringlength(1|30)"` Email string `json:"email" valid:"required,email"` // only male || female || other Gender string `json:"gender" valid:"required"` Phone string `json:"phone" valid:"required,numeric,stringlength(11|11)"` QQ string `json:"qq" valid:"numeric,stringlength(5|16)"` }
CreateUserRequest specifies the request parameters for `POST /v1/users`
type GetAIResponse ¶
type GetAIResponse AIInfo
type GetPostResponse ¶
type GetPostResponse PostInfo
GetPostResponse specifies the request parameters for `GET /v1/posts/{post_id}`
type GetUserResponse ¶
type GetUserResponse UserInfo
GetUserResponse specifies the response parameters for `GET /v1/users/{username}`
type ListAIRequest ¶
type ListAIResponse ¶
type ListPostsRequest ¶
ListPostsRequest specifies the request parameters for `GET /v1/posts`
type ListPostsResponse ¶
type ListPostsResponse struct { TotalCount int64 `json:"totalCount"` Posts []*PostInfo `json:"posts"` }
ListPostsResponse specifies the response parameters for `GET /v1/posts`
type ListUserRequest ¶
type ListUserRequest struct { Offset int `form:"offset" valid:"numeric"` Limit int `form:"limit" valid:"numeric"` }
ListUserRequest specifies the request parameters for `GET /v1/users`
type ListUserResponse ¶
type ListUserResponse struct { TotalCount int64 `json:"totalCount" valid:"numeric"` Users []*UserInfo `json:"users"` }
ListUserResponse specifies the response parameters for `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 specifies the request parameters for `POST /login`
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
}
LoginResponse specifies the response parameters for `POST /login`
type PostInfo ¶
type PostInfo struct { Username string `json:"username,omitempty"` PostID string `json:"post_id,omitempty"` Title string `json:"title"` Content string `json:"content"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` }
PostInfo is the post's detail info
type UpdateAIRequest ¶
type UpdateAIRequest AIInfo
type UpdatePostRequest ¶
type UpdatePostRequest struct { Title *string `json:"title" valid:"stringlength(1|255)"` Content *string `json:"content" valid:"stringlength(1|65535)"` }
UpdatePostRequest specifies the request parameters for `PUT /v1/posts`
type UpdateUserRequest ¶
type UpdateUserRequest struct { Nickname *string `json:"nickname" valid:"stringlength(1|255)"` Email *string `json:"email" valid:"email"` Gender *string `json:"gender" valid:"stringlength(1|10)"` Phone *string `json:"phone" valid:"numeric,stringlength(11|11)"` QQ *string `json:"qq" valid:"numeric,stringlength(5|16)"` }
UpdateUserRequest specifies the request parameters for `PUT /v1/users/{username}`
type UserInfo ¶
type UserInfo struct { PostCount int64 `json:"postcount"` Username string `json:"username"` Nickname string `json:"nickname"` Email string `json:"email"` Gender string `json:"gender"` Phone string `json:"phone"` QQ string `json:"qq"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` }
UserInfo is the user's all information that can be listed