get:
  tags:
    - users
  summary: get user emails
  description: |
    This operation lists all emails associated with the user.
    This route is accessible to all users if the target user has elected to show their email publicly. Otherwise, it is only accessible to privileged users, or if the calling user is the same as the target user.
  parameters:
    - in: path
      required: true
      name: uid
      schema:
        type: number
      description: A valid user id
      example: 1
  responses:
    '200':
      description: user emails successfully listed
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                $ref: ../../../components/schemas/Status.yaml#/Status
              response:
                type: object
                properties:
                  emails:
                    type: array
                    items:
                      type: string
                      description: An email address
post:
  tags:
    - users
  summary: add email to user
  description: |
    This operation adds an email to the user account, optionally bypassing the confirmation step if requested.

    **Note**: The confirmation bypass can only be called by super administrators or users with the `admin:users` privilege.
  parameters:
  - in: path
    name: uid
    schema:
      type: integer
    required: true
    description: uid of the account to add the email
    example: 1
  requestBody:
    required: true
    content:
      application/json:
        schema:
          type: object
          properties:
            email:
              type: string
              description: A single email address
              example: test@example.org
            skipConfirmation:
              type: boolean
              description: If truthy, will automatically confirm the user's email.
              example: 1
          required:
            - email
  responses:
    '200':
      description: email successfully added to user account
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                $ref: ../../../components/schemas/Status.yaml#/Status
              response:
                type: object
                properties:
                  emails:
                    type: array
                    items:
                      type: string
                      description: An email address