# Generated with protoc-gen-openapi
# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi

openapi: 3.0.3
info:
    title: UserAPI API
    version: 0.0.1
paths:
    /api/v1/user:
        get:
            tags:
                - UserAPI
            description: 查询用户信息。如果传递了Id参数，则表示查询用户的公开信息，否则查询当前用户的私有信息
            operationId: UserAPI_GetUser
            parameters:
                - name: id
                  in: query
                  schema:
                    type: integer
                    format: int64
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/User'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
        put:
            tags:
                - UserAPI
            description: 设置用户
            operationId: UserAPI_SetUser
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/SetUserRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
        post:
            tags:
                - UserAPI
            description: 新增用户
            operationId: UserAPI_AddUser
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/SetUserRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
        delete:
            tags:
                - UserAPI
            description: 删除用户。需要验证用户权限
            operationId: UserAPI_DeleteUser
            parameters:
                - name: id
                  in: query
                  schema:
                    type: array
                    items:
                        type: integer
                        format: int64
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/caniuploaddocument:
        get:
            tags:
                - UserAPI
            description: 用户是否可以上传文档
            operationId: UserAPI_CanIUploadDocument
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/captcha:
        get:
            tags:
                - UserAPI
            description: GetUserCaptcha 获取用户验证码
            operationId: UserAPI_GetUserCaptcha
            parameters:
                - name: type
                  in: query
                  schema:
                    type: string
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/GetUserCaptchaReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/dynamic:
        get:
            tags:
                - UserAPI
            description: 获取用户动态，包括获取关注的用户的动态
            operationId: UserAPI_ListUserDynamic
            parameters:
                - name: page
                  in: query
                  schema:
                    type: integer
                    format: int64
                - name: size
                  in: query
                  schema:
                    type: integer
                    format: int64
                - name: id
                  in: query
                  schema:
                    type: integer
                    format: int64
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ListUserDynamicReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/findpassword/stepone:
        post:
            tags:
                - UserAPI
            operationId: UserAPI_FindPasswordStepOne
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/FindPasswordRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/findpassword/steptwo:
        put:
            tags:
                - UserAPI
            operationId: UserAPI_FindPasswordStepTwo
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/FindPasswordRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/list:
        get:
            tags:
                - UserAPI
            description: |-
                查询用户列表。对于非管理员，返回相应用户的公开信息；
                 对于管理员，返回相应用户的绝大部分信息
            operationId: UserAPI_ListUser
            parameters:
                - name: page
                  in: query
                  schema:
                    type: integer
                    format: int64
                - name: size
                  in: query
                  schema:
                    type: integer
                    format: int64
                - name: wd
                  in: query
                  schema:
                    type: string
                - name: sort
                  in: query
                  schema:
                    type: string
                - name: id
                  in: query
                  schema:
                    type: array
                    items:
                        type: integer
                        format: int64
                - name: groupId
                  in: query
                  schema:
                    type: array
                    items:
                        type: integer
                        format: int64
                - name: status
                  in: query
                  schema:
                    type: array
                    items:
                        type: integer
                        format: int32
                - name: limit
                  in: query
                  schema:
                    type: integer
                    format: int64
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/ListUserReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/login:
        post:
            tags:
                - UserAPI
            description: 用户登录
            operationId: UserAPI_Login
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/RegisterAndLoginRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/LoginReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/logout:
        delete:
            tags:
                - UserAPI
            description: 退出登录
            operationId: UserAPI_Logout
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/password:
        put:
            tags:
                - UserAPI
            description: |-
                更新用户密码。如果不传用户ID，则表示更新当前用户的密码；
                 如果穿了用户ID，则表示更新指定用户的密码，这时需要验证当前用户的权限
            operationId: UserAPI_UpdateUserPassword
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/UpdateUserPasswordRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/permission:
        get:
            tags:
                - UserAPI
            description: GetUserCaptcha 获取用户验证码
            operationId: UserAPI_GetUserPermissions
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/GetUserPermissionsReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/profile:
        put:
            tags:
                - UserAPI
            description: |-
                更新用户密码。如果不传用户ID，则表示更新当前用户的密码；
                 如果穿了用户ID，则表示更新指定用户的密码，这时需要验证当前用户的权限
            operationId: UserAPI_UpdateUserProfile
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/User'
                required: true
            responses:
                "200":
                    description: OK
                    content: {}
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/register:
        post:
            tags:
                - UserAPI
            description: 用户注册
            operationId: UserAPI_Register
            requestBody:
                content:
                    application/json:
                        schema:
                            $ref: '#/components/schemas/RegisterAndLoginRequest'
                required: true
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/LoginReply'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
    /api/v1/user/sign:
        get:
            tags:
                - UserAPI
            description: 获取今日已签到记录
            operationId: UserAPI_GetSignedToday
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Sign'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
        put:
            tags:
                - UserAPI
            description: 每日签到
            operationId: UserAPI_SignToday
            responses:
                "200":
                    description: OK
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Sign'
                default:
                    description: Default error response
                    content:
                        application/json:
                            schema:
                                $ref: '#/components/schemas/Status'
components:
    schemas:
        Dynamic:
            type: object
            properties:
                id:
                    type: integer
                    format: int64
                userId:
                    type: integer
                    format: int64
                content:
                    type: string
                type:
                    type: integer
                    format: int32
                username:
                    type: string
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time
        FindPasswordRequest:
            type: object
            properties:
                email:
                    type: string
                token:
                    type: string
                password:
                    type: string
                captcha:
                    type: string
                captchaId:
                    type: string
        GetUserCaptchaReply:
            type: object
            properties:
                enable:
                    type: boolean
                id:
                    type: string
                captcha:
                    type: string
                type:
                    type: string
        GetUserPermissionsReply:
            type: object
            properties:
                permission:
                    type: array
                    items:
                        $ref: '#/components/schemas/Permission'
        GoogleProtobufAny:
            type: object
            properties:
                '@type':
                    type: string
                    description: The type of the serialized message.
            additionalProperties: true
            description: Contains an arbitrary serialized message along with a @type that describes the type of the serialized message.
        ListUserDynamicReply:
            type: object
            properties:
                total:
                    type: integer
                    format: int64
                dynamic:
                    type: array
                    items:
                        $ref: '#/components/schemas/Dynamic'
        ListUserReply:
            type: object
            properties:
                total:
                    type: integer
                    format: int64
                user:
                    type: array
                    items:
                        $ref: '#/components/schemas/User'
        LoginReply:
            type: object
            properties:
                token:
                    type: string
                user:
                    $ref: '#/components/schemas/User'
        Permission:
            type: object
            properties:
                id:
                    type: integer
                    format: int64
                method:
                    type: string
                path:
                    type: string
                title:
                    type: string
                description:
                    type: string
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time
        RegisterAndLoginRequest:
            type: object
            properties:
                username:
                    type: string
                password:
                    type: string
                captcha:
                    type: string
                captchaId:
                    type: string
                email:
                    type: string
        SetUserRequest:
            type: object
            properties:
                id:
                    type: integer
                    format: int64
                username:
                    type: string
                password:
                    type: string
                groupId:
                    type: array
                    items:
                        type: integer
                        format: int64
                email:
                    type: string
        Sign:
            type: object
            properties:
                id:
                    type: integer
                    format: int64
                userId:
                    type: integer
                    format: int64
                signAt:
                    type: integer
                    format: int32
                ip:
                    type: string
                createdAt:
                    type: string
                    format: date-time
                award:
                    type: integer
                    format: int32
        Status:
            type: object
            properties:
                code:
                    type: integer
                    description: The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
                    format: int32
                message:
                    type: string
                    description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
                details:
                    type: array
                    items:
                        $ref: '#/components/schemas/GoogleProtobufAny'
                    description: A list of messages that carry the error details.  There is a common set of message types for APIs to use.
            description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).'
        UpdateUserPasswordRequest:
            type: object
            properties:
                id:
                    type: integer
                    format: int64
                oldPassword:
                    type: string
                newPassword:
                    type: string
            description: 修改用户密码
        User:
            type: object
            properties:
                loginAt:
                    type: string
                    format: date-time
                createdAt:
                    type: string
                    format: date-time
                updatedAt:
                    type: string
                    format: date-time
                id:
                    type: integer
                    format: int64
                username:
                    type: string
                mobile:
                    type: string
                email:
                    type: string
                address:
                    type: string
                signature:
                    type: string
                lastLoginIp:
                    type: string
                registerIp:
                    type: string
                docCount:
                    type: integer
                    format: int32
                followCount:
                    type: integer
                    format: int32
                fansCount:
                    type: integer
                    format: int32
                favoriteCount:
                    type: integer
                    format: int32
                commentCount:
                    type: integer
                    format: int32
                status:
                    type: integer
                    format: int32
                avatar:
                    type: string
                identity:
                    type: string
                realname:
                    type: string
                groupId:
                    type: array
                    items:
                        type: integer
                        format: int64
                creditCount:
                    type: integer
                    format: int32
tags:
    - name: UserAPI
