openapi: 3.1.0

info:
  title: LaunchNotes API
  version: 1.0.0
  description: API for reading announcements and tracking viewership in LaunchNotes.

servers:
  - url: https://app.launchnotes.io

paths:
  /embed/unread:
    get:
      summary: Fetch Unread Count
      operationId: fetchUnreadCount
      parameters:
        - in: query
          name: anonymousUserId
          schema:
            type: string
          required: false
        - in: query
          name: token
          schema:
            type: string
          required: true
        - in: query
          name: projectId
          schema:
            type: string
          required: true
        - in: query
          name: view
          schema:
            type: string
          required: false
        - in: query
          name: categories
          schema:
            type: array
            items:
              type: string
          style: form
          explode: false
          required: false
        - in: query
          name: lastViewedAt
          schema:
            type: string
          required: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  lastViewedAt:
                    type: "string"
                  unreadCount:
                    type: 
                        - "number"
                        - "null"

  /embed/announcement_list:
    get:
      summary: Fetch Announcements
      operationId: fetchAnnouncements
      parameters:
        - in: query
          name: token
          schema:
            type: string
          required: true
        - in: query
          name: projectId
          schema:
            type: string
          required: true
        - in: query
          name: view
          schema:
            type: string
          required: false
        - in: query
          name: categories
          schema:
            type: array
            items:
              type: string
          style: form
          explode: false
          required: false
        - in: query
          name: limit
          schema:
            type: integer
            default: 10
          required: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  announcements:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        headline:
                          type: string
                        publishedAt:
                          type: string
                          format: date-time
                        publicPermalink:
                          type: string
                          format: uri
                        categories:
                          type: array
                          items:
                            type: object
                            properties:
                              name:
                                type: string
                              backgroundColor:
                                type: string
                                format: color
                        unread:
                          type: boolean
                  project:
                    type: object
                    properties:
                      name:
                        type: string
                      published:
                        type: boolean
                      permalink:
                        type: string
                        format: uri
                      heading:
                        type: string
                  unreadCount:
                    type: 
                      - "number"
                      - "null"

  /embed/announcements/track_open:
    post:
      summary: Track Open
      operationId: trackOpen
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                anonymousUserId:
                  type: string
                token:
                  type: string
                projectId:
                  type: string
                categories:
                  type: array
                  items:
                    type: string
                lastViewedAt:
                  type: string
                limit:
                  type: integer
                  default: 10
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error:
                    type: string
                  lastViewedAt:
                    type: string
                    format: date-time
