initial commit
This commit is contained in:
22
src/komgapi/endpoints/settings_controller.py
Normal file
22
src/komgapi/endpoints/settings_controller.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from .baseapi import BaseAPI
|
||||
import pathlib
|
||||
import subprocess
|
||||
import requests
|
||||
import typing_extensions
|
||||
from typing import List, Optional, Dict, Any, Union
|
||||
from komgapi.errors import KomgaError, LoginError, ResultErrror
|
||||
from komgapi.schemas import * # Progress, Series
|
||||
|
||||
|
||||
class SettingsController(BaseAPI):
|
||||
def __init__(self, username, password, url, timeout=20) -> None:
|
||||
super().__init__(username, password, url, timeout)
|
||||
|
||||
def getSettings(self) -> Settings:
|
||||
url = self.url + "settings"
|
||||
data = self.getRequest(url)
|
||||
return Settings(**data)
|
||||
|
||||
def updateSettings(self, settings: Settings) -> None:
|
||||
url = self.url + "settings"
|
||||
data = self.patchRequest(url, settings.model_dump())
|
||||
Reference in New Issue
Block a user