openapi: 3.0.3
info:
  title: Marketplace Webvitals Exporter Documentation
  description: Marketplace Webvitals Exporter Documentation
  termsOfService: 'urn:tos'
  contact: {}
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0'
  version: '1.3'
servers:
  - url: https://dev.rarible.com
  - url: https://rinkeby.rarible.com
  - url: https://testnet.rarible.com
  - url: https://rarible.com
tags:
  - name: metrics-controller
    description: Metrics Controller
  - name: download-metrics-controller
    description: Download Metrics Controller
  - name: order-metrics-controller
    description: Order Metrics Controller
  - name: images-metrics-controller
    description: Images Metrics Controller
paths:
  '/marketplace/metrics/v1/record':
    post:
      tags:
        - metrics-controller
      summary: Webvitals metrics controller
      operationId: recordWebvitals
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Metrics'
      responses:
        '200':
          description: OK
  '/marketplace/metrics/v1/download':
    post:
      tags:
        - download-metrics-controller
      summary: Download time metrics controller
      operationId: recordDownloadTimes
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DownloadMetrics'
      responses:
        '200':
          description: OK
  '/marketplace/metrics/v1/order':
    post:
      tags:
        - order-metrics-controller
      summary: Order proccessing metrics controller
      operationId: recordOrderMetrics
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrderMetrics'
      responses:
        '200':
          description: OK
  '/marketplace/metrics/v1/order/openModal':
    post:
      tags:
        - order-metrics-controller
      summary: Order proccessing metrics controller
      operationId: recordOpenOrderModalMetrics
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenOrderModalMetrics'
      responses:
        '200':
          description: OK
  '/marketplace/metrics/v1/images/availability':
    post:
      tags:
        - images-metrics-controller
      summary: Images availability
      operationId: recordImagesAvailability
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImagesAvailability'
      responses:
        '200':
          description: OK
components:
  schemas:
    Metrics:
      title: Metrics
      type: object
      properties:
        lcp:
          type: integer
          format: int64
        fcp:
          type: integer
          format: int64
        fid:
          type: integer
          format: int64
        tti:
          type: integer
          format: int64
        tbt:
          type: integer
          format: int64
        ttfb:
          type: integer
          format: int64
        cls:
          type: integer
          format: int64
        memoryUsage:
          type: integer
          format: int32
        cachedSize:
          type: integer
          format: int32
        url:
          type: string
    DownloadMetrics:
      title: DownloadMetrics
      type: object
      required:
        - successCount
        - failCount
        - retryCount
        - durationsMillis
      properties:
        successCount:
          type: integer
          format: int32
        failCount:
          type: integer
          format: int32
        retryCount:
          type: integer
          format: int32
        durationsMillis:
          type: array
          items:
            type: integer
            format: int64
    OrderMetricType:
      title: OrderMetricType
      type: string
      enum:
        - BID
        - PURCHASE
    OrderMetricResult:
      title: OrderMetricResult
      type: string
      enum:
        - SUCCESS
        - FAILED
        - CANCEL
    OrderMetrics:
      title: OrderMetrics
      type: object
      required:
        - result
        - type
      properties:
        result:
          $ref: '#/components/schemas/OrderMetricResult'
        type:
          $ref: '#/components/schemas/OrderMetricType'
        errorCode:
          type: string
        platform:
          type: string
        blockchain:
          type: string
    OpenOrderModalMetrics:
      title: OrderMetrics
      type: object
      required:
        - type
        - platform
        - blockchain
      properties:
        type:
          $ref: '#/components/schemas/OrderMetricType'
        platform:
          type: string
        blockchain:
          type: string
    ImagesAvailability:
      title: ImagesAvailability
      type: object
      required:
        - collectionId
        - availability
      properties:
        collectionId:
          type: string
        availability:
          type: number
          format: double
