openapi: 3.0.0
paths:
  /connect/ping:
    get:
      operationId: ConnectController_ping
      parameters: []
      responses:
        '200':
          description: ''
  /connect/auth:
    post:
      operationId: AuthenticationController_signInUser
      summary: Sign in existing user
      parameters:
        - &ref_0
          name: connect-token
          in: header
          description: Study Connect Token
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/TransactionIdDto'
                  - properties:
                      accessToken:
                        type: string
                      refreshToken:
                        type: string
      tags: &ref_1
        - authentication
  /connect/auth/reset:
    post:
      operationId: AuthenticationController_resetPassword
      summary: Reset user password
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PasswordResetDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionIdDto'
      tags: *ref_1
  /connect/auth/reset/verify:
    post:
      operationId: AuthenticationController_verifyPasswordReset
      summary: Verify the password request
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyPasswordResetDto'
      responses:
        '200':
          description: ''
      tags: *ref_1
  /connect/auth/verify:
    post:
      operationId: AuthenticationController_verifyUser
      summary: Verify the login attempt
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VerifyDto'
      responses:
        '200':
          description: ''
      tags: *ref_1
  /connect/auth/register:
    post:
      operationId: AuthenticationController_registerUser
      summary: Register a new user
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionIdDto'
      tags: *ref_1
  /connect/auth/refresh:
    post:
      operationId: AuthenticationController_refreshTokens
      summary: Refresh access token
      parameters:
        - *ref_0
      responses:
        '201':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /connect/auth/preferences:
    put:
      operationId: AuthenticationController_putUserPreferences
      summary: Update user preferences
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: string
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
    get:
      operationId: AuthenticationController_getUserPreferences
      summary: Get user preferences
      parameters:
        - *ref_0
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /connect/auth/firebaseToken:
    post:
      operationId: AuthenticationController_postFirebaseToken
      parameters:
        - *ref_0
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FirebaseTokenDto'
      responses:
        '200':
          description: ''
      tags: *ref_1
      security:
        - bearer: []
  /connect/tracking:
    get:
      operationId: TrackingController_getActions
      summary: Get tracking actions
      parameters:
        - &ref_2
          name: connect-token
          in: header
          description: Study Connect Token
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: &ref_3
        - tracking
      security: &ref_4
        - bearer: []
    post:
      operationId: TrackingController_postTrackingAction
      summary: Post tracking action
      parameters:
        - *ref_2
        - name: action
          required: true
          in: query
          schema:
            type: string
      responses:
        '204':
          description: ''
      tags: *ref_3
      security: *ref_4
  /connect/observing:
    get:
      operationId: ObservingController_getObservations
      summary: Get user observations
      parameters:
        - &ref_5
          name: connect-token
          in: header
          description: Study Connect Token
          schema:
            type: string
        - name: observationType
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: &ref_6
        - observing
      security: &ref_7
        - bearer: []
    post:
      operationId: ObservingController_postObservation
      summary: Post user observation
      parameters:
        - *ref_5
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ObservationDto'
      responses:
        '204':
          description: ''
      tags: *ref_6
      security: *ref_7
  /connect/observing/bundle:
    post:
      operationId: ObservingController_postObservationsBundle
      summary: Post user observations as a bundle
      parameters:
        - *ref_5
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
      responses:
        '204':
          description: ''
      tags: *ref_6
      security: *ref_7
  /connect/directs/questionnaires:
    get:
      operationId: DirectsController_getQuestionnaires
      summary: Get user questionnaires
      parameters:
        - &ref_8
          name: connect-token
          in: header
          description: Study Connect Token
          schema:
            type: string
        - name: Authorization
          in: header
          description: Authorization token
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: &ref_9
        - directs
      security: &ref_10
        - bearer: []
  /connect/directs/questionnaires/feedback:
    get:
      operationId: DirectsController_getUserFeedbackQuestionnaires
      summary: Get user feedback questionnaire
      parameters:
        - *ref_8
      responses:
        '200':
          description: ''
      tags: *ref_9
      security: *ref_10
  /connect/directs/messages:
    get:
      operationId: DirectsController_getMessages
      summary: Get user messages
      parameters:
        - *ref_8
      responses:
        '200':
          description: ''
      tags: *ref_9
      security: *ref_10
  /connect/directs/predictors/{predictor}:
    post:
      operationId: DirectsController_getPrediction
      summary: Get predictor output
      parameters:
        - *ref_8
        - name: predictor
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags: *ref_9
      security: *ref_10
info:
  title: Hubro Connect API
  description: OpenAPI documentation of the Hubro Connect API
  version: '1.0'
  contact:
    name: Hubro Research AS
    url: https://github.com/hubro-platform
    email: info@hubroresearch.no
tags: []
servers: []
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
  schemas:
    TransactionIdDto:
      type: object
      properties:
        transactionId:
          type: string
      required:
        - transactionId
    AuthDto:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
      required:
        - username
        - password
    PasswordResetDto:
      type: object
      properties:
        username:
          type: string
        phone:
          type: string
        email:
          type: string
      required:
        - username
        - phone
        - email
    VerifyPasswordResetDto:
      type: object
      properties:
        transactionId:
          type: string
        code:
          type: string
        password:
          type: string
      required:
        - transactionId
        - code
        - password
    VerifyDto:
      type: object
      properties:
        transactionId:
          type: string
        code:
          type: string
      required:
        - transactionId
        - code
    RegisterDto:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
        phone:
          type: string
      required:
        - username
        - password
        - phone
    FirebaseTokenDto:
      type: object
      properties:
        token:
          type: string
        validUntil:
          type: number
      required:
        - token
        - validUntil
    ObservationDto:
      type: object
      properties:
        type:
          type: string
        value:
          type: number
        dateTime:
          type: string
        unit:
          type: string
        device:
          type: string
      required:
        - type
        - value
        - dateTime
        - unit
        - device
