async def get(self) -> r200[AutoconnectSettings]:
        """
        Get autoconnecting flag.

        Tags: Settings
        """
        syncher = synchronization.fget(self.request.app)
        settings = AutoconnectSettings(enabled=syncher.get_autoconnecting())
        return web.json_response(settings.dict())
    async def put(self,
                  args: AutoconnectSettings) -> r200[AutoconnectSettings]:
        """
        Set autoconnecting flag.

        Tags: Settings
        """
        syncher = synchronization.fget(self.request.app)
        settings = AutoconnectSettings(
            enabled=await syncher.set_autoconnecting(args.enabled))
        return web.json_response(settings.dict())
예제 #3
0
async def autoconnect_put(request: web.Request) -> web.Response:
    syncher = synchronization.fget(request.app)
    enabled = await syncher.set_autoconnecting(request['data']['enabled'])
    return web.json_response({'enabled': enabled})
예제 #4
0
async def autoconnecting_get(request: web.Request) -> web.Response:
    syncher = synchronization.fget(request.app)
    enabled = syncher.get_autoconnecting()
    return web.json_response({'enabled': enabled})
예제 #5
0
async def units_put(request: web.Request) -> web.Response:
    syncher = synchronization.fget(request.app)
    updated = await syncher.set_user_units(request['data'])
    return web.json_response(updated)
예제 #6
0
async def units_get(request: web.Request) -> web.Response:
    syncher = synchronization.fget(request.app)
    return web.json_response(syncher.get_user_units())