openapi: 3.0.3
info:
  title: flowerate
  version: 0.0.1-dev
  description: Web api that provides hourly updated currency exchange rate and webhook
    for specified rate updates
components:
  schemas:
    IoChengFlowerateV0ModelsRateToAllResponse:
      description: flowerate response for exchange rate for base currency to all currencies
      type: object
      required:
      - base
      - rates
      - timestamp
      properties:
        base:
          $ref: '#/components/schemas/IoChengFlowerateV0EnumsCurrency'
          description: base currency
        rates:
          description: target currencies
          type: object
          additionalProperties:
            type: number
            format: double
        timestamp:
          description: epoch timestamp of returned exchange rate
          type: integer
          format: int64
    IoChengFlowerateV0ModelsWebhookRegisterRequest:
      description: payload of POST request to register a webhook
      type: object
      required:
      - clientId
      - webhooks
      properties:
        clientId:
          description: user id
          type: string
        webhooks:
          description: a sequence of webhook details
          type: array
          items:
            $ref: '#/components/schemas/IoChengFlowerateV0ModelsWebhookDetail'
    IoChengFlowerateV0ModelsFixerErrorDetail:
      description: fixer.io error detail inside a failure response
      type: object
      required:
      - code
      - type
      properties:
        code:
          description: error code
          type: integer
          format: int64
        type:
          description: fixer.io error type
          type: string
    IoChengFlowerateV0ModelsFixerRatesFailureResponse:
      description: fixer.io failure response for exchange rate between two currencies
      type: object
      required:
      - success
      - error
      properties:
        success:
          description: response status, should be false in this case
          type: boolean
        error:
          $ref: '#/components/schemas/IoChengFlowerateV0ModelsFixerErrorDetail'
          description: error from fixer.io
    IoChengFlowerateV0ModelsRateBetweenResponse:
      description: flowerate response for exchange rate between two currencies
      type: object
      required:
      - base
      - target
      - rate
      - timestamp
      properties:
        base:
          $ref: '#/components/schemas/IoChengFlowerateV0EnumsCurrency'
          description: base currency
        target:
          $ref: '#/components/schemas/IoChengFlowerateV0EnumsCurrency'
          description: targey currency
        rate:
          description: exchange rate, target currency to base currency
          type: number
          format: double
        timestamp:
          description: epoch timestamp of returned exchange rate
          type: integer
          format: int64
    IoChengFlowerateV0ModelsWebhookDetail:
      description: describe subscribed action and corresponding url of a webhook
      type: object
      required:
      - currencyRateEvent
      - url
      properties:
        currencyRateEvent:
          $ref: '#/components/schemas/IoChengFlowerateV0EnumsCurrencyRateEvent'
          description: enum value, currency rate event that this webhook subscribe
            to
        url:
          description: where POST request to when subscribed event happens
          type: string
    IoChengFlowerateV0ModelsFixerRatesSuccessResponse:
      description: fixer.io response for exchange rate between two currencies
      type: object
      required:
      - success
      - base
      - rates
      - timestamp
      properties:
        success:
          description: response status, should be true in this case
          type: boolean
        base:
          $ref: '#/components/schemas/IoChengFlowerateV0EnumsCurrency'
          description: base currency
        rates:
          description: target currencies
          type: object
          additionalProperties:
            type: number
            format: double
        timestamp:
          description: epoch timestamp of returned exchange rate
          type: integer
          format: int64
    IoChengFlowerateV0EnumsCurrency:
      type: string
      enum:
      - AED
      - AFN
      - ALL
      - AMD
      - ANG
      - AOA
      - ARS
      - AUD
      - AWG
      - AZN
      - BAM
      - BBD
      - BDT
      - BGN
      - BHD
      - BIF
      - BMD
      - BND
      - BOB
      - BRL
      - BSD
      - BTC
      - BTN
      - BWP
      - BYN
      - BYR
      - BZD
      - CAD
      - CDF
      - CHF
      - CLF
      - CLP
      - CNY
      - COP
      - CRC
      - CUC
      - CUP
      - CVE
      - CZK
      - DJF
      - DKK
      - DOP
      - DZD
      - EGP
      - ERN
      - ETB
      - EUR
      - FJD
      - FKP
      - GBP
      - GEL
      - GGP
      - GHS
      - GIP
      - GMD
      - GNF
      - GTQ
      - GYD
      - HKD
      - HNL
      - HRK
      - HTG
      - HUF
      - IDR
      - ILS
      - IMP
      - INR
      - IQD
      - IRR
      - ISK
      - JEP
      - JMD
      - JOD
      - JPY
      - KES
      - KGS
      - KHR
      - KMF
      - KPW
      - KRW
      - KWD
      - KYD
      - KZT
      - LAK
      - LBP
      - LKR
      - LRD
      - LSL
      - LTL
      - LVL
      - LYD
      - MAD
      - MDL
      - MGA
      - MKD
      - MMK
      - MNT
      - MOP
      - MRO
      - MUR
      - MVR
      - MWK
      - MXN
      - MYR
      - MZN
      - NAD
      - NGN
      - NIO
      - NOK
      - NPR
      - NZD
      - OMR
      - PAB
      - PEN
      - PGK
      - PHP
      - PKR
      - PLN
      - PYG
      - QAR
      - RON
      - RSD
      - RUB
      - RWF
      - SAR
      - SBD
      - SCR
      - SDG
      - SEK
      - SGD
      - SHP
      - SLL
      - SOS
      - SRD
      - STD
      - SVC
      - SYP
      - SZL
      - THB
      - TJS
      - TMT
      - TND
      - TOP
      - TRY
      - TTD
      - TWD
      - TZS
      - UAH
      - UGX
      - USD
      - UYU
      - UZS
      - VEF
      - VND
      - VUV
      - WST
      - XAF
      - XAG
      - XAU
      - XCD
      - XDR
      - XOF
      - XPF
      - YER
      - ZAR
      - ZMK
      - ZMW
      - ZWL
    IoChengFlowerateV0EnumsCurrencyRateEvent:
      type: string
      enum:
      - CurrencyRateChange
    IoChengFlowerateV0UnionsFixerRateResponse:
      description: Models rates response from fixer io
      oneOf:
      - $ref: '#/components/schemas/IoChengFlowerateV0ModelsFixerRatesSuccessResponse'
      - $ref: '#/components/schemas/IoChengFlowerateV0ModelsFixerRatesFailureResponse'
