openapi: 3.0.0
x-origin:
  - url: http://0.0.0.0:8080/v2/api-docs
    format: swagger
    version: "2.0"
    converter:
      url: https://github.com/mermade/oas-kit
      version: 5.3.0
info:
  description: Goldilox Server APIs
  version: "3.0"
  title: Goldilox API
  contact:
    name: Baby Bear
    email: baby@thehouseinthewoods.com
tags:
  - name: auth-controller
    description: Operations to device authentication
  - name: banner-rate-controller
    description: Banner Rate Controller
  - name: config-controller
    description: Config Controller
  - name: device-state-controller
    description: Device State Controller
  - name: selector-controller
    description: Selector Controller
paths:
  "/api/{apiVersion}/{partnerCode}/content/bannerrate":
    get:
      tags:
        - banner-rate-controller
      summary: getBannerRate
      operationId: getBannerRateUsingGET_1
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: API and operation version number.
          required: true
          schema:
            type: string
        - name: date
          in: query
          description: date
          required: false
          schema:
            type: string
            format: date
        - name: partnerCode
          in: path
          description: Code used to identify which partner the operation applies to.
          required: true
          schema:
            type: string
        - name: step
          in: query
          description: step
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "*/*":
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/RulesetBannerRates"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/content/bannerrate/{rulesetId}":
    get:
      tags:
        - banner-rate-controller
      summary: getBannerRate
      operationId: getBannerRateUsingGET
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: API and operation version number.
          required: true
          schema:
            type: string
        - name: date
          in: query
          description: date
          required: false
          schema:
            type: string
            format: date
        - name: partnerCode
          in: path
          description: Code used to identify which partner the operation applies to.
          required: true
          schema:
            type: string
        - name: rulesetId
          in: path
          description: rulesetId
          required: true
          schema:
            type: string
        - name: step
          in: query
          description: step
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/RulesetBannerRates"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/content/categories":
    get:
      tags:
        - selector-controller
      summary: Get content categories for the client.
      operationId: getContentCategoriesUsingGET
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: API and operation version number.
          required: true
          schema:
            type: string
        - name: partnerCode
          in: path
          description: Code used to identify which partner the operation applies to.
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: "#/components/schemas/ContentCategoryResponse"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/content/selector":
    post:
      tags:
        - selector-controller
      summary: Get content for the client.
      operationId: getContentUsingPOST
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: API and operation version number.
          required: true
          schema:
            type: string
        - name: partnerCode
          in: path
          description: Code used to identify which partner the operation applies to.
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json;charset=UTF-8:
            schema:
              $ref: "#/components/schemas/ContentRequest"
        description: contentRequest
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json;charset=UTF-8:
              schema:
                $ref: "#/components/schemas/ContentResponse"
        "201":
          description: Created
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/device/auth":
    post:
      tags:
        - auth-controller
      summary: Get device authentication JWT token.
      operationId: postUsingPOST
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: apiVersion
          required: true
          schema:
            type: string
        - name: partnerCode
          in: path
          description: partnerCode
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TokenRequest"
        description: tokenRequest
        required: true
      responses:
        "200":
          description: OK
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/TokenResponse"
        "201":
          description: Created
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/device/config":
    get:
      tags:
        - config-controller
      summary: Get client specific device configuration.
      operationId: getDeviceConfigUsingGET
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: apiVersion
          required: true
          schema:
            type: string
        - name: clientVersion
          in: query
          description: clientVersion
          required: true
          schema:
            type: string
        - name: clientVersionCode
          in: query
          description: clientVersionCode
          required: false
          schema:
            type: string
            default: "0"
        - name: partnerCode
          in: path
          description: partnerCode
          required: true
          schema:
            type: string
        - name: platform
          in: query
          description: platform
          required: true
          schema:
            type: string
        - name: platformVersion
          in: query
          description: platformVersion
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/DeviceConfig"
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
  "/api/{apiVersion}/{partnerCode}/device/status/{state}":
    get:
      tags:
        - device-state-controller
      summary: Gets actions for client device.
      operationId: getUsingGET
      parameters:
        - name: Authorization
          in: header
          description: JWToken
          required: false
          schema:
            type: string
        - name: apiVersion
          in: path
          description: apiVersion
          required: true
          schema:
            type: string
        - name: partnerCode
          in: path
          description: partnerCode
          required: true
          schema:
            type: string
        - name: state
          in: path
          description: state
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
        "401":
          description: Unauthorized
        "403":
          description: Forbidden
        "404":
          description: Not Found
      deprecated: false
servers:
  - url: //0.0.0.0:8080/api
components:
  schemas:
    BannerRate:
      type: object
      properties:
        deliveryCount:
          type: number
          format: double
        metrics:
          type: object
      title: BannerRate
    CheckinRule:
      type: object
      properties:
        checkin-uri:
          type: string
        expiration-date:
          type: string
        start-date:
          type: string
        trigger:
          $ref: "#/components/schemas/Condition"
      title: CheckinRule
    Condition:
      type: object
      properties:
        conditions:
          type: array
          items:
            $ref: "#/components/schemas/Condition"
        max_checkin_window:
          type: string
        metric:
          type: string
          enum:
            - time
            - tos
            - connection-speed
            - udcc
            - language
            - device-locked
            - content-category-blacklist
            - network-connection
            - version-code
            - version-name
            - screen-locked
            - network-quality
            - battery-percentage
            - latitude
            - longitude
            - city
            - state
            - zipcode
            - location
            - fsd
            - notification
            - unknown
        offset:
          type: string
        operator:
          type: string
        range:
          type: string
        type:
          type: string
          enum:
            - BOOLEAN
            - METRIC
            - DAY_OF_WEEK
            - TIME
            - HOURLY
            - DATE
        value:
          type: string
        values:
          type: array
          items:
            type: string
      title: Condition
    ContentCategory:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
      title: ContentCategory
    ContentCategoryResponse:
      type: object
      properties:
        categories:
          type: array
          items:
            $ref: "#/components/schemas/ContentCategory"
      title: ContentCategoryResponse
    ContentLayout:
      type: object
      properties:
        height:
          type: string
        width:
          type: string
      title: ContentLayout
    ContentNotification:
      type: object
      properties:
        text:
          type: string
        title:
          type: string
      title: ContentNotification
    ContentRequest:
      type: object
      properties:
        metrics:
          type: object
          additionalProperties:
            type: string
        ruleset-id:
          type: array
          items:
            type: string
      title: ContentRequest
    ContentResponse:
      type: object
      properties:
        displayType:
          type: string
        displayView:
          type: string
        layout:
          $ref: "#/components/schemas/ContentLayout"
        notification:
          $ref: "#/components/schemas/ContentNotification"
        url:
          type: string
      title: ContentResponse
    DeliveryMetric:
      type: object
      properties:
        name:
          type: string
        operators:
          type: array
          items:
            type: string
        type:
          type: string
        values:
          type: array
          items:
            type: string
      title: DeliveryMetric
    DeviceCheckinRules:
      type: object
      properties:
        checkin-rule:
          $ref: "#/components/schemas/CheckinRule"
        metrics:
          type: array
          items:
            type: string
            enum:
              - time
              - tos
              - connection-speed
              - udcc
              - language
              - device-locked
              - content-category-blacklist
              - network-connection
              - version-code
              - version-name
              - screen-locked
              - network-quality
              - battery-percentage
              - latitude
              - longitude
              - city
              - state
              - zipcode
              - location
              - fsd
              - notification
              - unknown
        ruleset-id:
          type: string
      title: DeviceCheckinRules
    DeviceConfig:
      type: object
      properties:
        awsRegion:
          type: string
        cognitoPoolId:
          type: string
        defaultCheckinRule:
          $ref: "#/components/schemas/DeviceCheckinRules"
        diagnosticStream:
          type: string
        eventStream:
          type: string
        googleCloudSenderId:
          type: string
        pinpointAppId:
          type: string
      title: DeviceConfig
    RulesetBannerRates:
      type: object
      properties:
        bannerRates:
          type: array
          items:
            $ref: "#/components/schemas/BannerRate"
        possibleMetrics:
          type: array
          items:
            $ref: "#/components/schemas/DeliveryMetric"
        rulesetId:
          type: string
      title: RulesetBannerRates
    TokenRequest:
      type: object
      properties:
        awsAccessKey:
          type: string
        awsSecretKey:
          type: string
        cognitoId:
          type: string
        cognitoSessionToken:
          type: string
        legacyDeviceAuthToken:
          type: string
        legacyDeviceId:
          type: string
        pinpointId:
          type: string
      title: TokenRequest
    TokenResponse:
      type: object
      properties:
        clearFsd:
          type: boolean
        clearNotification:
          type: boolean
        deviceId:
          type: string
        error:
          type: string
        firstConnect:
          type: string
          format: date-time
        jwtExpiration:
          type: integer
          format: int64
        jwtExpirationInMs:
          type: integer
          format: int64
        jwtToken:
          type: string
        legacyFirstConnect:
          type: string
          format: date-time
        tos:
          type: string
        udcc:
          type: integer
          format: int32
      title: TokenResponse
