@@ -330,6 +330,9 @@ async def post(self, request: web.Request, service: str, path: str) -> web.Respo
330330 async def put (self , request : web .Request , service : str , path : str ) -> web .Response :
331331 return await self ._handle (request , service , path , "PUT" )
332332
333+ async def patch (self , request : web .Request , service : str , path : str ) -> web .Response :
334+ return await self ._handle (request , service , path , "PATCH" )
335+
333336 async def delete (self , request : web .Request , service : str , path : str ) -> web .Response :
334337 return await self ._handle (request , service , path , "DELETE" )
335338
@@ -745,6 +748,10 @@ async def _rpc(method, params=()):
745748 async with http .get (f"{ base } /api/v3/rootfolder" , headers = hdrs , ssl = ssl ) as r :
746749 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
747750
751+ if path == "diskspace" :
752+ async with http .get (f"{ base } /api/v3/diskspace" , headers = hdrs , ssl = ssl ) as r :
753+ return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
754+
748755 if path == "queue" :
749756 incl = request .query .get ("includeUnknownMovieItems" , "false" )
750757 async with http .get (
@@ -942,6 +949,10 @@ async def _rpc(method, params=()):
942949 async with http .get (f"{ base } /api/v3/rootfolder" , headers = hdrs , ssl = ssl ) as r :
943950 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
944951
952+ if path == "diskspace" :
953+ async with http .get (f"{ base } /api/v3/diskspace" , headers = hdrs , ssl = ssl ) as r :
954+ return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
955+
945956 if path == "queue" :
946957 async with http .get (f"{ base } /api/v3/queue?pageSize=200&includeUnknownSeriesItems=false&includeEpisode=true&includeSeries=true" , headers = hdrs , ssl = ssl ) as r :
947958 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
@@ -1156,6 +1167,10 @@ async def _rpc(method, params=()):
11561167 async with http .get (f"{ base } /api/v3/rootfolder" , headers = hdrs , ssl = ssl ) as r :
11571168 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
11581169
1170+ if path == "diskspace" :
1171+ async with http .get (f"{ base } /api/v3/diskspace" , headers = hdrs , ssl = ssl ) as r :
1172+ return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
1173+
11591174 if path == "queue" :
11601175 async with http .get (f"{ base } /api/v3/queue?includeMovie=false&pageSize=100" , headers = hdrs , ssl = ssl ) as r :
11611176 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
@@ -1295,6 +1310,10 @@ async def _rpc(method, params=()):
12951310 async with http .get (f"{ base } /api/v3/rootfolder" , headers = hdrs , ssl = ssl ) as r :
12961311 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
12971312
1313+ if path == "diskspace" :
1314+ async with http .get (f"{ base } /api/v3/diskspace" , headers = hdrs , ssl = ssl ) as r :
1315+ return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
1316+
12981317 if path == "queue" :
12991318 async with http .get (f"{ base } /api/v3/queue?pageSize=200&includeUnknownSeriesItems=false&includeEpisode=true&includeSeries=true" , headers = hdrs , ssl = ssl ) as r :
13001319 return web .Response (body = await r .read (), content_type = "application/json" , status = r .status )
@@ -2287,8 +2306,8 @@ def _tmdb_cast(d):
22872306 if not tracearr_url or not tracearr_key :
22882307 return web .json_response ({"error" : "Tracearr not configured" }, status = 503 )
22892308
2290- # Library and stats endpoints require admin JWT; public endpoints use the public key
2291- is_library = path .startswith ("v1/library" ) or path .startswith ("v1/stats" )
2309+ # Library, stats and rules endpoints require admin JWT; public endpoints use the public key
2310+ is_library = path .startswith ("v1/library" ) or path .startswith ("v1/stats" ) or path . startswith ( "v1/rules" )
22922311 if is_library :
22932312 refresh_token = cfg .get (CONF_TRACEARR_REFRESH_TOKEN , "" )
22942313 entry_id = next (iter (self ._hass .config_entries .async_entries ("arr_stack" )), None )
@@ -2332,6 +2351,28 @@ def _tmdb_cast(d):
23322351 raw = await r .read ()
23332352 ct = r .headers .get ("Content-Type" , "application/json" ).split (";" )[0 ].strip ()
23342353 return web .Response (body = raw , content_type = ct , status = r .status )
2354+ elif method == "PATCH" :
2355+ body = await request .read ()
2356+ async with http .patch (
2357+ target_url ,
2358+ headers = headers ,
2359+ data = body ,
2360+ timeout = aiohttp .ClientTimeout (total = 15 ),
2361+ ssl = ssl ,
2362+ ) as r :
2363+ raw = await r .read ()
2364+ ct = r .headers .get ("Content-Type" , "application/json" ).split (";" )[0 ].strip ()
2365+ return web .Response (body = raw , content_type = ct , status = r .status )
2366+ elif method == "DELETE" :
2367+ async with http .delete (
2368+ target_url ,
2369+ headers = headers ,
2370+ timeout = aiohttp .ClientTimeout (total = 15 ),
2371+ ssl = ssl ,
2372+ ) as r :
2373+ raw = await r .read ()
2374+ ct = r .headers .get ("Content-Type" , "application/json" ).split (";" )[0 ].strip ()
2375+ return web .Response (body = raw , content_type = ct , status = r .status )
23352376
23362377 # ════════════════════════════════════════════
23372378 # System
0 commit comments