openapi: 3.0.0
info:
  description: |
    Welcome to the HumHub like module API reference.
  version: 1.0.0
  title: HumHub - Like API
  contact:
    email: info@humhub.com
  license:
    name: AGPLv2
    url: https://www.humhub.org/en/licences
paths:
  "/like/{id}":
    get:
      summary: Get like by id
      description: ""
      parameters:
        - name: id
          in: path
          description: The id of the like
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Like"
        "400":
          description: Invalid like id supplied
        "404":
          description: Like not found
    delete:
      summary: Deletes a like by id
      parameters:
        - name: id
          in: path
          description: The id of the like
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: successful operation
        "404":
          description: Like not found
  /like/findByRecord:
    get:
      summary: Get all likes by content id
      description: ""
      parameters:
        - name: model
          in: query
          description: The model record class
          required: true
          schema:
            type: string
        - name: pk
          in: query
          description: The primary key of the record
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    $ref: common.yaml#/components/schemas/totalProperty
                  page:
                    $ref: common.yaml#/components/schemas/pageProperty
                  pages:
                    $ref: common.yaml#/components/schemas/pagesProperty
                  links:
                    $ref: common.yaml#/components/schemas/linksProperty
                  results:
                    type: array
                    items:
                      $ref: "#/components/schemas/Like"
        "400":
          description: Invalid like id supplied
        "404":
          description: Like not found
servers:
  - url: /api/v1
components:
  securitySchemes:
    _ref: common.yaml#/securityDefinitions
  schemas:
    LikesSummary:
      type: object
      properties:
        total:
          type: integer
          format: int64
          readOnly: true
          example: 35
    Like:
      type: object
      properties:
        id:
          type: integer
          format: int64
          readOnly: true
          example: 42
        createdBy:
          $ref: user.yaml#/components/schemas/UserShort
        createdAt:
          type: string
          readOnly: true
          example: 2018-08-09 14:22:03
