openapi: 3.1.0
info:
  title: CWS API Notifications
  version: '1.0'
  description: >
    CWS APIより外部システムに通知するWebhookを定義します。


    Webhookの通知先は[通知・アクセス設定](/apis/v1/cws_api#tag/Config/operation/patch-v1-applications)で指定してください。


    ## authenticationKeyの利用方法


    安全にご利用いただくために、Webhookの送信元がCWS APIであることを、ご確認いただくことを推奨します。


    送信元の検証を実施いただけるように、CWS APIでは、Webhookの送信の際に、HMAC SHA256ハッシュのhexdigestをHTTP
    Headerに付与しています。


    ハッシュは、[authenticationKeyを発行する](/apis/v1/cws_api#tag/Config/operation/post-v1-applications-auth)で発行した`authenticationKey`と、Webhookで送信するHTTP
    Request Bodyの値により生成しています。


    Webhookを受信した際に、CWS APIと同じ方法で生成したハッシュと比較することで、送信元がCWS APIであることをご検証いただけます。


    ### 送信元検証のサンプルプログラム


    Webhookを受信するFlaskアプリケーションで、送信元の検証を実施するサンプルプログラムを、以下に例示します。


    ```python

    import hmac

    import hashlib

    from flask import Flask, request, abort, jsonify



    app = Flask(__name__)



    @app.route('/device-event', methods=['GET', 'POST'])

    def device_event():
        if request.method == 'GET':
            return abort(403)

        key = get_authentication_key()
        data = request.data.decode('utf-8')

        hash = get_hmac_hash_hexdigest(key, data)

        if hash != request.headers.get('X-TLPF-NOTIFICATION-KEY'):
            return abort(403)

        return jsonify(None)


    def get_authentication_key():
        return 'CWS APIが発行した authenticationKey'


    def get_hmac_hash_hexdigest(key, data):
        return hmac.new(
            bytearray(key, "ASCII"),
            bytearray(data, "ASCII"),
            hashlib.sha256,
        ).hexdigest()
    ```


    <small>上記プログラムは一例であるため、これによる問題が発生した場合の責任は負いかねます。</small>


    ## Device Event について

    [通知・アクセス設定](/apis/v1/cws_api#tag/Config/operation/patch-v1-applications)で登録した「デバイスイベント通知先URL`deviceEvent`」に対して、トランザクションの結果またはデバイス状態変更を通知します。


    本通知は デバイスイベントの種別によって外部通知のリクエスト内容が変わります。そのため、本通知では デバイスイベント毎に表記しています。


    ### トランザクション結果通知の再送について


    CWSでは、端末がオンラインになった際、特定の条件を満たすトランザクションを再送します。

    詳しくは [トランザクション仕様](/docs/development/transaction#トランザクションの再送) を参照してください。


    ## Sora Event について

    [通知・アクセス設定](/apis/v1/cws_api#tag/Config/operation/patch-v1-applications)で登録した「Soraイベント送信先URL`soraEvent`」に対して
    Sora イベントを通知します。


    本通知は Sora イベントの種別によって外部通知のリクエスト内容が変わります。
paths: {}
servers:
  - url: https://<yourserver.yourdomain>
    description: ご利用者様のWebサーバー
security:
  - X-TLPF-NOTIFICATION-KEY: []
webhooks:
  /"デバイスイベント通知先URL" トランザクション結果通知:
    post:
      summary: トランザクション結果通知
      operationId: post-result-transaction
      description: |-
        トランザクションの結果を通知します。
        ### 関連API
          - [デバイスをアクティベートする](/apis/v1/cws_api#tag/Device/operation/post-v1-applications-devices)
          - [デバイスのディアクティベートする](/apis/v1/cws_api#tag/Device/operation/delete-v1-applications-devices)
          - [デバイスの初期化](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-reset)
          - [Wi-Fiを設定する](/apis/v1/cws_api#tag/Network/operation/put-v1-applications-devices-settings-wifi)
          - [Apnの設定をする](/apis/v1/cws_api#tag/Network/operation/put-v1-applications-devices-settings-apn)
          - [言語設定をする](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-settings-lang)
          - [LauncherAppへのKey設定](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-apps-launcher-keys)

        ### 通知タイミング
        デバイスで以下処理完了後に通知します
        - アクティベート
        - ディアクティベート
        - 初期化
        - Wifi設定
        - APN設定
        - 言語設定
        - LauncherAppへのKey設定
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Transaction'
            examples:
              アクティベート完了:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: post-v1-applications-devices
                  notificationType: processed
                  result: success
                  message: ''
                  timestamp: '2020-10-16T00:37:08.260Z'
              アクティベート失敗:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: post-v1-applications-devices
                  notificationType: processed
                  result: failure
                  message: ''
                  timestamp: '2020-10-16T00:37:08.260Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(ソフトウェア/ファームウェアのアップデート):
    post:
      summary: トランザクション結果通知(ソフトウェア/ファームウェアのアップデート)
      operationId: post-result-software
      description: |-
        トランザクションの結果(ソフトウェア/ファームウェアのアップデート)を通知する。
        ### 関連API
          - [ソフトウェアをすぐにアップデートさせる](/apis/v1/cws_api#tag/Update/operation/put-v1-applications-devices-apps)
          - [ファームウェアをすぐにアップデートさせる](/apis/v1/cws_api#tag/Update/operation/put-v1-applications-devices-firmware)

        ### 通知タイミング
        - デバイスで ソフトウェア/ファームウェア のアップデートを受け付けた
        - アップデート中に10秒間隔
        - アップデート完了
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionSotaFota'
            examples:
              アップデート受付:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-devices-apps
                  notificationType: accepted
                  result: success
                  progress: 0
                  message: message accepted.
                  timestamp: '2020-10-16T00:37:08.260Z'
              アップデート失敗:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-devices-apps
                  notificationType: processed
                  result: failure
                  progress: 1
                  message: install / update finished.
                  timestamp: '2020-10-16T00:37:08.260Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(コマンド実行):
    post:
      summary: トランザクション結果通知(コマンド実行)
      operationId: post-result-command
      description: >
        トランザクションの結果(コマンド実行)を通知します


        ### 関連API

        -
        [デバイスでコマンドを実行させる](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-commands)


        ### 通知タイミング

        - 端末内連携先アプリの呼出後
          - CWS APIはコマンド通知先である端末内連携先アプリの呼出結果を1度目に通知します
        - 端末内連携先アプリからの応答受信後
          - CWS APIは端末内連携先アプリでの処理結果を2度目に通知します

        ### 特記事項

        - 1度目の通知のsuccessは、端末内連携先アプリの呼出に対する成功、失敗を表します

        - 2度目の通知のsuccessは、端末内連携先アプリでの処理結果の成功、失敗を表します

        - customDataは、ユーザ独自の端末内連携先アプリで任意に定義することができます

        - 2度目の通知は、ユーザ独自の端末内連携先アプリがMDMアプリに対して結果を戻すことで通知されます
          - 連携情報を記載したmd ファイルはご希望の方に都度共有を行なっております。ご希望の方は FairyDevices にお問い合わせください。
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionCommands'
            examples:
              端末内連携先アプリの呼出後（1度目の通知）:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-devices-commands
                  success: true
                  process: processed
                  message: called app.
                  customData: ''
                  timestamp: '2020-10-16T00:37:08.260Z'
              端末内連携先アプリからの応答受信後（2度目の通知）:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-devices-commands
                  success: true
                  process: processed
                  message: notify `processed` from called app.
                  customData: message you want to send
                  timestamp: '2020-10-16T00:37:08.260Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(Bluetooth/ネットワーク一覧取得):
    post:
      summary: トランザクション結果通知(Bluetoothデバイス/ネットワークの一覧を取得)
      operationId: post-result-connectivity-list
      description: |-
        トランザクションの結果(Bluetoothデバイス/ネットワークの一覧を取得)を通知する。
        ### 関連API
          - [Bluetoothデバイス/ネットワークの一覧を取得する](/apis/v1/cws_api#tag/Connectivity/operation/get-v1-applications-connectivity-list)

        ### 通知タイミング
        デバイスで以下処理完了後に通知します
        - Bluetoothデバイスの一覧を取得
        - ネットワークの一覧を取得
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionConnectivityList'
            examples:
              Bluetoothデバイスの一覧を取得する:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: get-v1-applications-connectivity-list
                  message: ''
                  networkType: bluetooth
                  target: available
                  statusCode: 200
                  devices:
                    - status:
                        mode: connected
                        registered: true
                      name: bluetooth name
                      alias: bluetooth alias name
                      address: AA:11:22:BB:2A:3A
                  timestamp: '2020-10-16T00:37:48.771Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(Bluetoothデバイス/ネットワークのON/OFF状態を取得、変更する):
    post:
      summary: トランザクション結果通知(Bluetooth/ネットワークのON/OFF状態を取得、変更する)
      operationId: post-result-connectivity-onoff
      description: |-
        トランザクションの結果(Bluetooth/ネットワークのON/OFF状態を取得、変更)を通知する。
        ### 関連API
          - [Bluetooth/ネットワークのON/OFF状態を取得する](/apis/v1/cws_api#tag/Connectivity/operation/get-v1-applications-connectivity-state)
          - [Bluetooth/ネットワークのON/OFF状態を変更する](/apis/v1/cws_api#tag/Connectivity/operation/put-v1-applications-connectivity-state)

        ### 通知タイミング
        デバイスで以下処理完了後に通知します
        - BluetoothのON/OFF状態を取得
        - BluetoothのON/OFFの切り替え
        - ネットワークのON/OFF状態を取得
        - ネットワークのON/OFFの切り替え
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionConnectivityONOFF'
            examples:
              Bluetoothを有効にした:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-connectivity-state
                  message: ''
                  networkType: bluetooth
                  statusCode: 200
                  state: enabled
                  timestamp: '2020-10-16T00:37:48.771Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(Bluetooth/ネットワークの設定を初期化):
    post:
      summary: トランザクション結果通知(Bluetooth/ネットワークの設定を初期化する)
      operationId: post-result-connectivity-reset
      description: |-
        トランザクションの結果(Bluetooth/ネットワークの設定を初期化)を通知する。
        ### 関連API
          - [Bluetooth/ネットワークの設定を初期化する](/apis/v1/cws_api#tag/Connectivity/operation/delete-v1-applications-connectivity-reset)

        ### 通知タイミング
        デバイスで以下処理完了後に通知します
        - Bluetoothの初期化
        - ネットワークの初期化
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionConnectivityReset'
            examples:
              Bluetoothの設定を初期化:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: delete-v1-applications-connectivity-reset
                  message: ''
                  networkType: bluetooth
                  statusCode: 200
                  timestamp: '2020-10-16T00:37:48.771Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(Bluetoothペアリング):
    post:
      summary: トランザクション結果通知(Bluetoothペアリング)
      operationId: post-result-Bluetooth-pairing
      description: |-
        以下トランザクションの結果を通知する。
        - Bluetoothデバイスのペアリングを行う
        - ペアリング済みBluetoothデバイスを接続/切断する
        - Bluetoothデバイスのペアリングを解除する

        ### 関連API
          - [Bluetoothデバイスのペアリングを行う](/apis/v1/cws_api#tag/Connectivity/operation/post-v1-applications-bluetooth-device)
          - [ペアリング済みBluetoothデバイスを接続/切断する](/apis/v1/cws_api#tag/Connectivity/operation/put-v1-applications-bluetooth-device)
          - [Bluetoothデバイスのペアリングを解除する](/apis/v1/cws_api#tag/Connectivity/operation/delete-v1-applications-bluetooth-device)

        ### 通知タイミング
        デバイスで以下処理完了後に通知します
        - Bluetoothデバイスのペアリング
        - Bluetoothデバイスのペアリングを解除
        - Bluetoothデバイスの接続
        - Bluetoothデバイスの切断
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionBluetoothPairing'
            examples:
              Bluetoothデバイスに接続した:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  transactionId: 1
                  operationId: put-v1-applications-bluetooth-device
                  message: ''
                  networkType: bluetooth
                  statusCode: 200
                  devices:
                    - status:
                        mode: connected
                        registered: true
                      name: bluetooth name
                      alias: bluetooth alias name
                      address: AA:11:22:BB:2A:3A
                  timestamp: '2020-10-16T00:37:48.771Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(トランザクションの破棄):
    post:
      summary: トランザクション結果通知(トランザクションの破棄)
      operationId: post-result-transaction-canceled
      description: >-
        破棄したトランザクションを通知します。


        トランザクションが破棄される条件に関しては、[トランザクション結果通知の再送について](/apis/v1/cws_notification/#section/Device-Event)
        を参照してください。


        ### 通知タイミング

        デバイスがオンラインになった際
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionCanceled'
            example:
              applicationId: abcdefghigklmnopqrstuvwxyz012345
              deviceId: '123456789101234'
              transactionId: 1
              operationId: put-v1-applications-devices-apps
              notificationType: accepted
              result: failure
              message: >-
                The transaction was canceled because the retry limit was
                exceeded.
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" トランザクション結果通知(ソフトウェアのアンインストール):
    post:
      summary: トランザクション結果通知(ソフトウェアのアンインストール)
      operationId: post-result-uninstall
      description: |-
        トランザクションの結果(ソフトウェアのアンインストール)を通知する。
        ### 関連API
          - [ソフトウェアをアンインストールする](/apis/v1/cws_api#tag/Operation/operation/delete-v1-applications-devices-package)

        ### 通知タイミング
        - デバイスでソフトウェアのアンインストールを受け付けた
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TransactionUninstall'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(transaction)
  /"デバイスイベント通知先URL" 任意アプリからの任意文字列通知:
    post:
      summary: 任意アプリからの任意文字列通知
      operationId: post-result-command-notify
      description: |
        THINKLETデバイスへインストールしたユーザ独自の任意アプリから、任意の文字列を通知します

        ### 通知タイミング
        - MDMアプリが、任意文字列通知の`Broadcast Intent`を受信し、CWS APIへ接続可能となった時に通知します

        ### 特記事項
        - 本イベントは、ユーザ独自の任意アプリがMDMアプリに対して、任意文字列通知を要求することで通知されます
          - 連携情報を記載したmd ファイルはご希望の方に都度共有を行なっております。ご希望の方は FairyDevices にお問い合わせください。
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandNotify'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(端末起動状態):
    post:
      summary: デバイス状態変更通知(端末起動状態)
      operationId: post-result-boots
      description: |-
        デバイス状態変更(端末起動状態)を通知する。
        ### 通知タイミング
        - デバイス起動完了後に通知します
        - デバイス電源シャットダウン前に通知します
          - 電源ボタンからのシャットダウン要求時のみ
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationAppStatus'
            examples:
              デバイス起動完了後:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-app-status
                  type: app_status
                  appType: device
                  appStatus: started
                  timestamp: '2020-10-16T00:37:08.260Z'
                  text: device booted
              デバイス電源シャットダウン前:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-app-status
                  type: app_status
                  appType: device
                  appStatus: finished
                  timestamp: '2020-10-16T00:37:08.260Z'
                  text: Power-off
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(端末装着状態):
    post:
      summary: デバイス状態変更通知(端末装着状態)
      operationId: post-result-wear
      description: |-
        デバイス状態変更(端末装着状態)を通知する。
        ### 通知タイミング
        - デバイスでの近接センサー値の変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationUsage'
            examples:
              端末を装着:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-device-wearing-status
                  usage: device_wear
                  timestamp: '2020-10-16T00:37:08.260Z'
              端末を外す:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-device-wearing-status
                  usage: device_takeoff
                  timestamp: '2020-10-16T00:37:08.260Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(充電状態):
    post:
      summary: デバイス状態変更通知(充電状態)
      operationId: post-result-battery-charge
      description: |-
        デバイス状態変更(充電状態)を通知する。
        ### 通知タイミング
        - デバイスでの充電状態の変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationUsage'
            examples:
              充電を開始した:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-battery-charging
                  usage: start_charging
                  timestamp: '2020-10-16T00:37:08.260Z'
              充電を終了した:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-battery-charging
                  usage: stop_charging
                  timestamp: '2020-10-16T00:37:08.260Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(ネットワーク状態):
    post:
      summary: デバイス状態変更通知(ネットワーク状態)
      operationId: post-result-network
      description: |
        デバイス状態変更(ネットワーク状態)を通知する。
        ### 通知タイミング
        - `status: connectivity_online` の通知は、ネットワークがオンラインになったときに通知します
        - `status: connectivity_offline` の通知は、ネットワークがオフラインになったときに通知します
        - デバイスがアクティベートされていない場合には、通知しません
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationDeviceStatus'
            examples:
              ネットワークがオンラインになった:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-network-connection-status
                  status: connectivity_online
                  timestamp: '2020-10-16T00:37:48.771Z'
              ネットワークがオフラインになった:
                value:
                  applicationId: abcdefghigklmnopqrstuvwxyz012345
                  deviceId: '123456789101234'
                  operationId: notify-network-connection-status
                  status: connectivity_offline
                  timestamp: '2020-10-16T00:37:48.771Z'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(バッテリー残量):
    post:
      summary: デバイス状態変更通知(バッテリー残量)
      operationId: post-result-battery
      description: |-
        デバイス状態変更(バッテリー残量)を通知する。
        ### 通知タイミング
        - デバイスでのバッテリー残量(%)変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationBattery'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(位置情報):
    post:
      summary: デバイス状態変更通知(位置情報)
      operationId: post-result-location
      description: |-
        デバイス状態変更(位置情報)を通知する。
        ### 通知タイミング
        - デバイスでの位置情報変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationLocation'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(電波状況変化):
    post:
      summary: デバイス状態変更通知(電波状況変化)
      operationId: post-result-network-change
      description: |-
        デバイス状態変更(電波状況変化時)を通知する。
        ### 通知タイミング
        - デバイスでのネットワーク電波強度（Wi-Fi or mobile）変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationWifi'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(音量変更):
    post:
      summary: デバイス状態変更通知(音量変更)
      operationId: post-result-volume
      description: |-
        デバイス状態変更(音量変更時)を通知する。
        ### 通知タイミング
        - デバイスでの音量変化時に通知します
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationVolume'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"デバイスイベント通知先URL" デバイス状態変更通知(Bluetoothデバイス接続/切断):
    post:
      summary: デバイス状態変更通知(Bluetoothデバイス接続/切断)
      operationId: post-result-bluetooth
      description: |-
        デバイス状態変更(Bluetoothデバイス接続/切断時)を通知する。
        ### 通知タイミング
        - Bluetoothデバイスに接続した
        - Bluetoothデバイスと切断した
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationBluetoothDevices'
        description: ''
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Device Event(notify device state)
  /"Soraイベント送信先URL":
    post:
      summary: Soraイベント通知
      operationId: post-sora-event
      description: >-
        以下Sora のイベントを通知します。

        Soraからのイベント通知をそのまま転送していますが、キー項目をスネークケースからキャメルケースに変換しています。

        - 接続通知 (connection.created)

        - 接続状態更新通知 (connection.updated)

        - 切断通知 (connection.destroyed)

        - 録画保存ファイル出力通知 (archive.available)

        - 録画ファイル保存失敗通知 (archive.failed)


        各イベントの詳細は、[WebRTC SFU Sora
        ドキュメントのイベントウェブフック](https://sora-doc.shiguredo.jp/EVENT_WEBHOOK#)
        を参照してください。
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      tags:
        - Sora Event
  '"Sora録画データ通知先URL"':
    post:
      summary: 録画データ通知
      operationId: post-sora-save-event
      description: >-
        [通知・アクセス設定](/apis/v1/cws_api#tag/Config/operation/patch-v1-applications)で登録した「Sora録画データ通知先URL`soraFileSendEvent`」に対して、録画データ（録画ファイル、メタデータファイル）のアップロードが完了したことを通知します。


        当通知を受領後、マルチパートのファイルアップロードの完了処理を行ってください。


        マルチパートのファイルアップロードの完了処理を実施後、アップロードしたファイルをAmazon S3で確認できます。


        本通知には、アップロードに成功したファイルの情報のみ含まれます。アップロードに失敗したファイルの情報は、本通知には含まれません。


        Soraが提供している指定したチャネルの録画を停止するAPIを使用した際のドメインと、[WebRTCエンドポイント取得](/apis/v1/cws_api#tag/CommunicationService/operation/post-v1-applications-channels)で発行したエンドポイントのドメインが異なっていた場合、録画ファイルのアップロードは行われません。


        また、「録画データ（Sora）用署名付きURL取得URL（マルチパート対応）`soraRecGetMultiPresignedUrl`
        」からステータスコード:200 以外が返却された場合も、録画ファイルのアップロードは行われません。
      parameters:
        - schema:
            type: string
          in: header
          name: X-TLPF-NOTIFICATION-KEY
          description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SoraSaveNotification'
            examples:
              コネクションが1つの場合:
                value:
                  channel:
                    channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
                    metaFile: report-HE3010HSF92T5E3JKVDW9MN0QR.json
                    connections:
                      - connectionId: 1D0F0P98XX0W1FSBY4ZSV0E428
                        jsonFile: archive-1D0F0P98XX0W1FSBY4ZSV0E428.json
                        movieFile: &ref_0
                          file: archive-1D0F0P98XX0W1FSBY4ZSV0E428.mp4
                          splitted: 2
                          uploadId: >-
                            OW2fM5iVylEpFEMM9_HpKowRapC3vn5sSL39_396UW9zLFUWVrnRHaPjUJddQ5OxSHVXjYtrN47NBZ-khxOjyEXAMPLE
                          parts:
                            - lqy62e3wxsgdq23nxfosn5rc7example
                            - fvjnb1sv503rgvqui408liyl7example
                        webmFile: *ref_0
              コネクションが複数の場合:
                value:
                  channel:
                    channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
                    metaFile: report-HE3010HSF92T5E3JKVDW9MN0QR.json
                    connections:
                      - connectionId: 1D0F0P98XX0W1FSBY4ZSV0E428
                        jsonFile: archive-1D0F0P98XX0W1FSBY4ZSV0E428.json
                        movieFile: &ref_1
                          file: archive-1D0F0P98XX0W1FSBY4ZSV0E428.mp4
                          splitted: 2
                          uploadId: >-
                            OW2fM5iVylEpFEMM9_HpKowRapC3vn5sSL39_396UW9zLFUWVrnRHaPjUJddQ5OxSHVXjYtrN47NBZ-khxOjyEXAMPLE
                          parts:
                            - lqy62e3wxsgdq23nxfosn5rc7example
                            - fvjnb1sv503rgvqui408liyl7example
                        webmFile: *ref_1
                      - connectionId: ZGJCGBTWBH23Z6PRKNR6YGQ138
                        jsonFile: archive-ZGJCGBTWBH23Z6PRKNR6YGQ138.json
                        movieFile: &ref_2
                          file: archive-ZGJCGBTWBH23Z6PRKNR6YGQ138.mp4
                          splitted: 1
                          uploadId: >-
                            tZ20sgEAhQeApnMVW_yqg9j4swb3wKbE1DUo_FR64uQEy2DXrshomngSwPgPxj5wGjINj3AGU1ITHQ-hi4Z2FEXAMPLE
                          parts:
                            - yr4rrchq4blv7ay3shzpobrteexample
                        webmFile: *ref_2
                      - connectionId: xxxxxxxxxxxxxxxxxxxxxx
                        jsonFile: archive-xxxxxxxxxxxxxxxxxxxxxx.json
                        movieFile: &ref_3
                          file: archive-xxxxxxxxxxxxxxxxxxxxxx.mp4
                          splitted: 3
                          uploadId: >-
                            ud3N7J8YjCEW21dIC_OIe0WAjz4jvgjTVbAU_4Wnzy3TgGST5lSWpCQu4nm2gZqqc8cHx2WelIXqIS-essuHIEXAMPLE
                          parts:
                            - acxt5m9qzvyjpfjt6diho8dedexample
                            - tbrlopnl0na0j4lwmb0x2sa8rexample
                            - izr3kd4erlykrfeota0ex0rm0example
                        webmFile: *ref_3
              metaFileとwebmFileのアップロードに失敗した場合:
                value:
                  channel:
                    channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
                    connections:
                      - connectionId: 1D0F0P98XX0W1FSBY4ZSV0E428
                        jsonFile: archive-1D0F0P98XX0W1FSBY4ZSV0E428.json
              指定したチャネルの録画を停止するAPIを使用した際のドメインと、WebRTCエンドポイント取得で発行したエンドポイントが異なっていた場合:
                value:
                  channel:
                    channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
                  message: archive is not found.
              録画データ（Sora）用署名付きURL取得URLの実行結果がステータスコード 200 以外の場合:
                value:
                  channel:
                    channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
                  message: soraRecGetMultiPresignedUrl is failed.
      tags:
        - Sora Recorded Event
  '"ファイルアップロードイベント通知先URL"':
    parameters:
      - schema:
          type: string
        in: header
        required: true
        name: X-TLPF-NOTIFICATION-KEY
        description: 署名検証のハッシュ値(payloadとauthenticationKeyのHMAC-SHA256)
    post:
      summary: ファイルアップロードイベント通知
      operationId: post-file-upload-event
      description: >
        ファイルアップロードの成功/失敗イベントを通知します。


        本項での仕様は、下記へ設定されたURLが対象となります。


        - `fileUploadEvent` (ファイルアップロード用イベント通知先URL)


        上記の設定、取得に関しては、[CWS APIリファレンス](/apis/v1/cws_api)の下記を参照ください。


        -
        [通知・アクセス設定](/apis/v1/cws_api#tag/Config/operation/patch-v1-applications)

        -
        [通知・アクセス設定内容取得](/apis/v1/cws_api#tag/Config/operation/get-v1-applications)
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileUploadNotification'
            examples:
              example - ファイルアップロード成功通知:
                value:
                  result: success
                  file: <application_id>/<device_id>/upload_files/hogehoge.log
                  message: upload complete
              example - ファイルサイズが制限オーバーしているため失敗通知:
                value:
                  result: failure
                  file: <application_id>/<device_id>/upload_files/test/hogehoge.log
                  message: >-
                    File size is over
                    file:<application_id>/<device_id>/upload_files/test/hogehoge.log,
                    file size:22020096, limit size:20971520
              example - アプリケーションに端末がactivateされていないため失敗通知:
                value:
                  result: failure
                  file: <application_id>/<device_id>/upload_files/test/hogehoge.log
                  message: >-
                    Device:<device_id> is not associated with
                    Application:<application_id>
              example - 署名付きURLが取得できないため失敗通知:
                value:
                  result: failure
                  file: <application_id>/<device_id>/upload_files/test/hogehoge.log
                  message: 'FileUploadGetUrl:http://xxxxxxxxxx: can''t get presigned url.'
              example - 署名付きURLに対してファイルアップロードできないため失敗通知:
                value:
                  result: failure
                  file: <application_id>/<device_id>/upload_files/test/hogehoge.log
                  message: 'S3 presigned url : can''t upload.'
      responses:
        '200':
          description: Recieved - 正常時
        '400':
          description: Bad Request - 入力値誤りなど
        '500':
          description: Internal Server Error - 内部エラー（DB接続時エラーなど）
      tags:
        - File Upload Event
components:
  securitySchemes:
    X-TLPF-NOTIFICATION-KEY:
      type: http
      scheme: header
  schemas:
    Transaction:
      title: Transaction
      type: object
      description: トランザクションの結果を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [デバイスをアクティベートする](/apis/v1/cws_api#tag/Device/operation/post-v1-applications-devices):
            post-v1-applications-devices

            -
            [デバイスのディアクティベートする](/apis/v1/cws_api#tag/Device/operation/delete-v1-applications-devices):
            delete-v1-applications-devices

            -
            [デバイスの初期化](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-reset):
            put-v1-applications-devices-reset

            -
            [Wi-Fiを設定する](/apis/v1/cws_api#tag/Network/operation/put-v1-applications-devices-settings-wifi):
            put-v1-applications-devices-settings-wifi

            -
            [Apnの設定をする](/apis/v1/cws_api#tag/Network/operation/put-v1-applications-devices-settings-apn):
            put-v1-applications-devices-settings-apn

            -
            [言語設定をする](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-settings-lang):
            put-v1-applications-devices-settings-lang

            -
            [LauncherAppへのKey設定](/apis/v1/cws_api#tag/Operation/operation/put-v1-applications-devices-apps-launcher-keys):
            put-v1-applications-devices-apps-launcher-keys
        notificationType:
          type: string
          description: |-
            通知種別
            - accepted: デバイスでAPIの指示を受け付けた<br/>
            - processed: アップデート完了
        result:
          type: string
          description: トランザクション結果(success:成功, failure:失敗)
        message:
          type: string
          description: トランザクションの処理結果メッセージ
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - notificationType
        - result
        - message
        - timestamp
    TransactionSotaFota:
      title: TransactionSotaFota
      type: object
      description: SOTA/FOTAのトランザクションの結果を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [ソフトウェアをすぐにアップデートさせる](/apis/v1/cws_api#tag/Update/operation/put-v1-applications-devices-apps):
            put-v1-applications-devices-apps

            -
            [ファームウェアをすぐにアップデートさせる](/apis/v1/cws_api#tag/Update/operation/put-v1-applications-devices-firmware):
            put-v1-applications-devices-firmware
        notificationType:
          type: string
          description: |-
            通知種別。通知タイミング毎に以下値となる。
            - accepted: デバイスで ソフトウェア/ファームウェア のアップデートを受け付けた<br/>
            - in_progress: アップデート中<br/>
            - processed: アップデート完了
        result:
          type: string
          description: トランザクション結果(success:成功, failure:失敗)
        progress:
          type: number
          format: float
          description: |
            端末での、アップデート用データ（FW、アプリ）のダウンロード進捗率（0.0〜1.0）
            この項目は、MDM v0.6.21 以降を使用する場合に存在します。

            進捗率は以下のnotificationTypeと値のパターンで通知します
              - notificationType: accepted
                - 0.0
              - notificationType: in_progress
                - 0.0〜1.0(ダウンロード進捗率)
              - notificationType: processed
                - 0.0
                  - 本システムにおいて、ダウンロード前のインストール・アップデート要求受付時に不正なメッセージと判断した場合
                - 1.0
                  - ダウンロード失敗時
                  - ダウンロード完了後、インストール・アップデート要求の発行に失敗した場合
        message:
          type: string
          description: トランザクションの処理結果メッセージ
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - notificationType
        - result
        - message
        - timestamp
    TransactionCommands:
      title: TransactionCommands
      type: object
      description: トランザクションの結果(コマンド実行)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [デバイスでコマンドを実行させる](/apis/v1/cws_api#tag/Connectivity/operation/put-v1-applications-devices-commands):
            put-v1-applications-devices-commands
        success:
          type: boolean
          description: コマンド実行結果(true:成功, false:失敗)
        process:
          type: string
          description: processed(固定値)
        message:
          type: string
          description: トランザクションの処理結果メッセージ
        customData:
          type: string
          description: |
            端末内連携先アプリからの送信データ（任意項目）</br>
            送信データがない場合は、空文字列（””）が設定される
          default: ''
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - success
        - process
        - message
        - customData
        - timestamp
    TransactionConnectivityDeviceInfo:
      title: TransactionConnectivityDeviceInfo
      type: object
      description: Bluetoothデバイスの接続/切断情報
      properties:
        status:
          type: object
          description: ステータス
          properties:
            mode:
              type: string
              enum:
                - connected
                - disconnected
                - detected
              description: |-
                Bluetoothデバイスの状態<br/>
                以下いずれかの値となる
                - connected: 接続済みのBluetoothデバイス
                - disconnected: 切断済みのBluetoothデバイス
                - detected: 検出中のBluetoothデバイス
            registered:
              type: boolean
              description: |-
                Bluetoothデバイスの登録状態<br/>
                以下いずれかの値となる
                - true: デバイスが登録されている
                - false: デバイスが登録されていない
          required:
            - mode
            - registered
        name:
          type: string
          description: Bluetoothデバイスの名前
        alias:
          type: string
          description: Bluetoothデバイスのエイリアス名
        address:
          type: string
          description: MACアドレス
      required:
        - status
        - name
        - alias
        - address
    TransactionConnectivityNetworkInfo:
      title: TransactionConnectivityNetworkInfo
      type: object
      description: ネットワーク情報
      properties:
        status:
          type: object
          description: ステータス
          properties:
            mode:
              type: string
              enum:
                - connected
                - available
                - unavailable
              description: ネットワークの状態
            registered:
              type: boolean
              description: |-
                Bluetoothデバイスの登録状態<br/>
                以下いずれかの値となる
                - true: ネットワークが登録済み
                - false: ネットワークが未登録
          required:
            - mode
            - registered
        level:
          type: integer
          description: ネットワークレベル
        name:
          type: string
          description: ネットワーク名
        networkId:
          type: integer
          description: ネットワークID
        security:
          type: string
          enum:
            - WPA
            - WEP
            - NONE
          description: セキュリティ
      required:
        - status
        - name
    TransactionConnectivityList:
      title: TransactionConnectivityList
      type: object
      description: トランザクションの結果(Bluetooth/ネットワーク一覧取得)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [Bluetoothデバイス/ネットワークの一覧を取得する](/apis/v1/cws_api#tag/Connectivity/operation/get-v1-applications-connectivity-list):
            get-v1-applications-connectivity-list
        message:
          type: string
          description: メッセージ
        networkType:
          type: string
          enum:
            - bluetooth
            - wifi
            - apn
          description: 通知内容の種類
        target:
          type: string
          enum:
            - all
            - connected
            - available
          description: >-
            Bluetoothデバイス/ネットワーク の取得対象。

            [Bluetoothデバイス/ネットワークの一覧を取得する](/apis/v1/cws_api#tag/Connectivity/operation/get-v1-applications-connectivity-list)
            で指定したtarget。<br/>

            targetの詳細は以下。

            - all:
            Bluetoothデバイス/ネットワークの一覧を取得するAPIの要求を受け付けた時点で、THINKLETに登録済み(接続中含む) および
            検出可能なBluetoothデバイス/ネットワーク

            - connected:
            Bluetoothデバイス/ネットワークの一覧を取得するAPIの要求を受け付けた時点で、THINKLETに接続中のBluetoothデバイス/ネットワーク

            - available:
            Bluetoothデバイス/ネットワークの一覧を取得するAPIの要求を受け付けた時点で、THINKLETに登録済み(接続中含む)のBluetoothデバイス/ネットワーク
        statusCode:
          type: integer
          enum:
            - 200
            - 403
            - 500
          description: 実行結果コード
        devices:
          type: array
          items:
            $ref: '#/components/schemas/TransactionConnectivityDeviceInfo'
          description: Bluetoothデバイスの情報の一覧。networkTypeが`bluetooth`の場合のみ存在する。
        networks:
          type: array
          items:
            $ref: '#/components/schemas/TransactionConnectivityNetworkInfo'
          description: ネットワーク情報の一覧。networkTypeが`wifi`,`apn`の場合のみ存在する。
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - networkType
        - target
        - statusCode
        - timestamp
    TransactionConnectivityONOFF:
      title: TransactionConnectivityONOFF
      type: object
      description: トランザクションの結果(Bluetooth/ネットワークのON/OFF状態を取得、変更)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [Bluetooth/ネットワークのON/OFF状態を取得する](/apis/v1/cws_api#tag/Connectivity/operation/get-v1-applications-connectivity-state):
            get-v1-applications-connectivity-state

            -
            [Bluetooth/ネットワークのON/OFF状態を変更する](/apis/v1/cws_api#tag/Connectivity/operation/put-v1-applications-connectivity-state):
            put-v1-applications-connectivity-state
        message:
          type: string
          description: メッセージ
        networkType:
          type: string
          enum:
            - bluetooth
            - wifi
            - mobile
          description: 通知内容の種類
        statusCode:
          type: integer
          enum:
            - 200
            - 400
            - 500
          description: 実行結果コード
        state:
          type: string
          enum:
            - enabled
            - disabled
            - unknown
          description: ONOFFの状態
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - networkType
        - statusCode
        - state
        - timestamp
    TransactionConnectivityReset:
      title: TransactionConnectivityReset
      type: object
      description: トランザクションの結果(Bluetooth初期化/ネットワーク初期化)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [Bluetooth/ネットワークの設定を初期化する](/apis/v1/cws_api#tag/Connectivity/operation/delete-v1-applications-connectivity-reset):
            delete-v1-applications-connectivity-reset
        message:
          type: string
          description: メッセージ
        networkType:
          type: string
          enum:
            - bluetooth
            - wifi
            - mobile
          description: 通知内容の種類
        statusCode:
          type: integer
          enum:
            - 200
            - 500
          description: 実行結果コード
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - networkType
        - statusCode
        - timestamp
    TransactionBluetoothDeviceInfo:
      title: TransactionBluetoothDeviceInfo
      type: object
      description: Bluetoothデバイスの接続/切断情報
      properties:
        status:
          type: object
          description: ステータス
          properties:
            mode:
              type: string
              enum:
                - connected
                - disconnected
                - deleted
              description: |-
                Bluetoothデバイスの状態<br/>
                以下いずれかの値となる
                - connected: 接続済みのBluetoothデバイス
                - disconnected: 切断済みのBluetoothデバイス
                - deleted: 設定を削除したBluetoothデバイス
            registered:
              type: boolean
              description: |-
                Bluetoothデバイスの登録状態<br/>
                以下いずれかの値となる
                - true: デバイスが登録されている
                - false: デバイスが登録されていない
          required:
            - mode
            - registered
        name:
          type: string
          description: Bluetoothデバイスの名前
        alias:
          type: string
          description: Bluetoothデバイスのエイリアス名
        address:
          type: string
          description: MACアドレス
      required:
        - status
        - name
        - alias
        - address
    TransactionBluetoothPairing:
      title: TransactionBluetoothPairing
      type: object
      description: トランザクションの結果(Bluetoothペアリング)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: >-
            トランザクション結果通知の種別となるオペレーションID。

            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。

            APIとoperationIdの値の組み合わせは以下である。

            -
            [Bluetoothデバイスのペアリングを行う](/apis/v1/cws_api#tag/Connectivity/operation/post-v1-applications-bluetooth-device):
            post-v1-applications-bluetooth-device

            -
            [ペアリング済みBluetoothデバイスを接続/切断する](/apis/v1/cws_api#tag/Connectivity/operation/put-v1-applications-bluetooth-device):
            put-v1-applications-bluetooth-device

            -
            [Bluetoothデバイスのペアリングを解除する](/apis/v1/cws_api#tag/Connectivity/operation/delete-v1-applications-bluetooth-device):
            delete-v1-applications-bluetooth-device
        message:
          type: string
          description: メッセージ
        networkType:
          type: string
          enum:
            - bluetooth
          description: 通知内容の種類
        statusCode:
          type: integer
          enum:
            - 200
            - 400
            - 403
            - 404
            - 409
            - 500
          description: 実行結果コード
        devices:
          type: array
          items:
            $ref: '#/components/schemas/TransactionBluetoothDeviceInfo'
          description: デバイスの情報
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - networkType
        - statusCode
        - devices
        - timestamp
    TransactionCanceled:
      title: TransactionCanceled
      type: object
      description: トランザクションの結果(トランザクションの破棄)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        transactionId:
          type: integer
          description: トランザクションID
        operationId:
          type: string
          description: |-
            トランザクション結果通知の種別となるオペレーションID。
            オペレーションIDは、トランザクションを発行したCWS APIのAPI操作に応じて異なる値となっている。
        notificationType:
          type: string
          description: |-
            通知種別
            - accepted: デバイスでAPIの指示を受け付けた<br/>
        result:
          type: string
          description: トランザクション結果。必ず failure:失敗 となる。
        message:
          type: string
          description: |-
            トランザクションの処理結果メッセージ。

            端末がオンラインになった際にCWSが破棄したトランザクションは、以下のメッセージを送信する。

            - 再送が一定回数を超えたトランザクション<br/>
              The transaction was canceled because the retry limit was exceeded.
            - 同一オペレーションIDの古いトランザクション<br/>
              The transaction was canceled because there is a new transaction.
            - デバイスをディアクティベートするAPI実行前に発行したトランザクション<br/>
              The transaction was canceled because it occurred before deactivation.
            - デバイスの初期化API実行前に発行したトランザクション<br/>
              The transaction was canceled because it occurred before reset.
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - notificationType
        - result
        - message
    TransactionUninstall:
      title: TransactionUninstall
      type: object
      description: トランザクションの結果(ソフトウェアのアンインストール)を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        transactionId:
          type: integer
          description: トランザクションID
          example: 1
        operationId:
          type: string
          description: トランザクション結果通知の種別となるオペレーションID
          example: delete-v1-applications-devices-package
        package:
          type: string
          description: パッケージ名
          example: com.example.sample
        result:
          type: string
          description: トランザクション結果(success:成功, failure:失敗)
          example: success
        message:
          type: string
          description: トランザクションの処理結果メッセージ
          example: uninstall success.
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - transactionId
        - operationId
        - package
        - result
        - message
        - timestamp
    CommandNotify:
      title: CommandNotify
      type: object
      description: 任意アプリケーションからの任意文字列を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        operationId:
          type: string
          enum:
            - notify-custom-data
          description: 通知の種別となるオペレーションID
          example: notify-custom-data
        success:
          type: boolean
          description: 任意アプリケーションからのBroadcast Intent連携時の指定Boolean値
          default: false
          example: false
        message:
          type: string
          description: 処理結果メッセージ(固定値)
          default: notify ACTION_SEND_CUSTOM_DATA message.
          example: notify ACTION_SEND_CUSTOM_DATA message.
        customData:
          type: string
          description: |
            任意アプリケーションからのBroadcast Intent連携時の指定送信データ（任意項目）</br>
            送信データがない場合は、空文字列（””）が設定される
          default: ''
          example: ''
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:08.260Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - success
        - message
        - customData
        - timestamp
    NotificationAppStatus:
      title: Notification
      type: object
      description: 端末の端末起動状態を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        operationId:
          type: string
          enum:
            - notify-app-status
          description: デバイス変更通知の種別となるオペレーションID
        type:
          type: string
          description: メッセージ種別。必ず app_status となります。
        appType:
          type: string
          description: メッセージ種別。必ず device となります。
        appStatus:
          type: string
          description: メッセージ種別。started/finished のどちらかとなります。
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
        text:
          type: string
          description: デバイス変更通知で受け取った詳細を表す自由文字列
      required:
        - applicationId
        - deviceId
        - operationId
        - type
        - appType
        - appStatus
        - timestamp
        - text
    NotificationUsage:
      title: Notification
      type: object
      description: 端末の充電状態、装着状態、バッテリー確認を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        operationId:
          type: string
          enum:
            - notify-battery-charging
            - notify-device-wearing-status
          description: デバイス変更通知の種別となるオペレーションID
        usage:
          type: string
          description: |
            端末で発生したイベント。
            端末の装着状態の通知では、device_wear または device_takeoff、
            端末の充電状態の通知では、start_charging または stop_charging となります。
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - operationId
        - usage
        - timestamp
    NotificationDeviceStatus:
      title: Notification
      type: object
      description: 端末の状態を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
        deviceId:
          type: string
          description: THINKLETのIMEI NO
        operationId:
          type: string
          enum:
            - notify-network-connection-status
          description: デバイス変更通知の種別となるオペレーションID
        status:
          type: string
          description: |
            デバイスで発生したイベント種類。
            ネットワーク状態の通知では、connectivity_online または connectivity_offline。
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
      required:
        - applicationId
        - deviceId
        - operationId
        - status
        - timestamp
    NotificationBattery:
      title: Notification
      type: object
      description: 端末のバッテリー残量を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        operationId:
          type: string
          enum:
            - notify-battery-percentage-changed
          description: デバイス変更通知の種別となるオペレーションID
          example: notify-battery-percentage-changed
        status:
          type: string
          description: デバイス状態変更通知の種別。バッテリー残量通知では必ずbattery_changedとなります。
          example: battery_changed
        batteryPercentage:
          type: integer
          description: バッテリー残量[%]
          example: 99
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - status
        - batteryPercentage
        - timestamp
    NotificationLocation:
      title: Notification
      type: object
      description: 端末の位置情報の変更を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        operationId:
          type: string
          enum:
            - notify-location
          description: デバイス変更通知の種別となるオペレーションID
          example: notify-location
        status:
          type: string
          description: デバイス状態変更通知の種別。位置情報変更通知では必ずlocationとなります。
          example: XXX.XXXXX
        lat:
          type: string
          description: 位置情報変更通知の緯度
          example: XXX.XXXXX
        lon:
          type: string
          description: 位置情報変更通知の経度
          example: location
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - status
        - lat
        - lon
        - timestamp
    NotificationWifi:
      title: Notification
      type: object
      description: 端末の電波状況の変更を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        operationId:
          type: string
          enum:
            - notify-network-level
          description: デバイス変更通知の種別となるオペレーションID
          example: notify-network-level
        status:
          type: string
          description: デバイス状態変更通知の種別。電波状況変更通知では必ずnetwork_levelとなります。
          example: network_level
        networkType:
          type: string
          description: 電波状況変更通知のネットワーク種別。Wi-Fi もしくは mobile となります。
          example: wifi
        active:
          type: boolean
          description: networkTypeで指定したnetworkを使用している場合は true となります。
          example: true
        networkName:
          type: string
          description: 電波状況が変化した対象のnetwork名（Wi-Fiの場合はSSID/mobileの場合はAPN名）
          example: SSID1234
        networkLevel:
          type: integer
          minimum: 0
          maximum: 4
          description: |
            電波状況変更通知のネットワークレベル
          example: 1
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - status
        - networkType
        - active
        - networkLevel
        - timestamp
    NotificationVolume:
      title: Notification
      type: object
      description: 端末の音量変更を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        operationId:
          type: string
          enum:
            - notify-volume
          description: デバイス変更通知の種別となるオペレーションID
          example: notify-volume
        status:
          type: string
          description: デバイス状態変更通知の種別。音量変更通知では必ずvolumeとなります。
          example: volume
        volumeType:
          type: string
          description: 音量の種別。media固定
          example: media
        stream:
          type: string
          description: 端末で受け取ったVolumeStream。music 固定
          example: music
        min:
          type: integer
          description: 最小音量
          example: 0
        max:
          type: integer
          description: 最大音量
          example: 16
        current:
          type: integer
          description: 現在の音量
          example: 8
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - status
        - volumeType
        - stream
        - min
        - max
        - current
        - timestamp
    NotificationBluetoothDeviceInfo:
      title: NotificationBluetoothDeviceInfo
      type: object
      description: Bluetoothデバイスの接続/切断情報
      properties:
        status:
          type: object
          description: ステータス
          properties:
            mode:
              type: string
              enum:
                - connected
                - disconnected
              description: |-
                Bluetoothデバイスの状態<br/>
                以下いずれかの値となる
                - connected: 接続済みのBluetoothデバイス
                - disconnected: 切断済みのBluetoothデバイス
            registered:
              type: boolean
              description: |-
                Bluetoothデバイスの登録状態<br/>
                以下いずれかの値となる
                - true: デバイスが登録されている
          required:
            - mode
            - registered
        name:
          type: string
          description: Bluetoothデバイスの名前
        alias:
          type: string
          description: Bluetoothデバイスのエイリアス名
        address:
          type: string
          description: MACアドレス
      required:
        - status
        - name
        - alias
        - address
    NotificationBluetoothDevices:
      title: NotificationBluetoothDevices
      type: object
      description: 端末のBluetoothデバイスの接続/切断を通知するリクエスト本文のモデル
      properties:
        applicationId:
          type: string
          description: アプリケーションID
          example: abcdefghigklmnopqrstuvwxyz012345
        deviceId:
          type: string
          description: THINKLETのIMEI NO
          example: '123456789101234'
        transactionId:
          type: integer
          description: トランザクションID
          example: 1
        operationId:
          type: string
          enum:
            - notify-bluetooth-connection
          description: デバイス変更通知の種別となるオペレーションID
          example: notify-bluetooth-connection
        message:
          type: string
          description: メッセージ
          example: ''
        networkType:
          type: string
          enum:
            - bluetooth
          description: 通知内容の種類
          example: bluetooth
        statusCode:
          type: integer
          enum:
            - 200
            - 500
          description: 実行結果コード
          example: 200
        devices:
          type: array
          items:
            $ref: '#/components/schemas/NotificationBluetoothDeviceInfo'
          description: デバイスの情報
          example:
            - status:
                mode: connected
                registered: true
              name: bluetooth name
              alias: bluetooth alias name
              address: AA:11:22:BB:2A:3A
        timestamp:
          type: string
          description: イベント発生時のタイムスタンプ
          example: '2020-10-16T00:37:48.771Z'
      required:
        - applicationId
        - deviceId
        - operationId
        - networkType
        - statusCode
        - devices
        - timestamp
    SoraSaveNotification:
      title: SoraSaveNotification
      type: object
      example:
        channel:
          channelId: 01954c30-4b29-4a03-b7e8-335f1fd145ea
          metaFile: HE3010HSF92T5E3JKVDW9MN0QR.json
          connections:
            - connectionId: 1D0F0P98XX0W1FSBY4ZSV0E428
              jsonFile: RSSWN3F0YS2P794XGFBW22MXG4.json
              movieFile: &ref_4
                file: RSSWN3F0YS2P794XGFBW22MXG4.mp4
                splitted: 2
                uploadId: >-
                  OW2fM5iVylEpFEMM9_HpKowRapC3vn5sSL39_396UW9zLFUWVrnRHaPjUJddQ5OxSHVXjYtrN47NBZ-khxOjyEXAMPLE
                parts:
                  - lqy62e3wxsgdq23nxfosn5rc7example
                  - fvjnb1sv503rgvqui408liyl7example
              webmFile: *ref_4
      description: Sora録画データ通知モデル
      properties:
        channel:
          type: object
          description: チャネル
          properties:
            channelId:
              type: string
              description: チャネルID
            metaFile:
              type: string
              description: 全体メタファイル
            connections:
              type: array
              description: コネクション
              items:
                type: object
                description: （※コネクション数分存在）
                properties:
                  connectionId:
                    type: string
                    description: コネクションID
                  jsonFile:
                    type: string
                    description: 個別の映像音声ファイルのメタデータ
                  movieFile:
                    type: object
                    description: 動画音声ファイル
                    properties:
                      file:
                        type: string
                        minLength: 1
                        description: ファイル名
                      splitted:
                        type: integer
                        description: 分割数
                      uploadId:
                        type: string
                        minLength: 1
                        description: アップロードID
                      parts:
                        type: array
                        items:
                          type: string
                          minLength: 1
                        description: etag の一覧
                  webmFile:
                    type: object
                    deprecated: true
                    description: 動画音声ファイル。互換性のために提供されており、movieFileと同内容。
                    properties:
                      file:
                        type: string
                        minLength: 1
                        description: ファイル名
                      splitted:
                        type: integer
                        description: 分割数
                      uploadId:
                        type: string
                        minLength: 1
                        description: アップロードID
                      parts:
                        type: array
                        items:
                          type: string
                          minLength: 1
                        description: etag の一覧
                required:
                  - connectionId
          required:
            - channelId
        message:
          type: string
          description: メッセージ
      required:
        - channel
    FileUploadNotification:
      title: FileUploadNotification
      type: object
      description: ファイルアップロードイベント通知モデル
      properties:
        result:
          type: string
          description: |
            アップロードの成功/失敗
            - success
            - failure
        file:
          type: string
          description: |
            アップロードファイルのパス

            （例 = '<利用者様アプリケーションID>/<利用者様端末のデバイスID>/upload_files/<任意のパス/ファイル名>'
        message:
          type: string
          description: アップロード結果に対するメッセージ
      required:
        - result
        - file
        - message
tags:
  - name: Device Event(transaction)
    description: デバイスイベント通知(トランザクション結果)
  - name: Device Event(notify device state)
    description: デバイスイベント通知(デバイス状態)
  - name: Sora Event
    description: Soraイベント通知
  - name: Sora Recorded Event
    description: Sora録画イベント通知
  - name: File Upload Event
    description: ファイルアップロードイベント通知
