mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-11 18:39:30 +00:00
refactor(backups): make construct_provider not public
This commit is contained in:
parent
6b0c55a786
commit
3684345c2d
|
@ -51,7 +51,7 @@ class Backups:
|
||||||
location: str,
|
location: str,
|
||||||
repo_id: str = "",
|
repo_id: str = "",
|
||||||
):
|
):
|
||||||
provider = Backups.construct_provider(
|
provider = Backups._construct_provider(
|
||||||
kind,
|
kind,
|
||||||
login,
|
login,
|
||||||
key,
|
key,
|
||||||
|
@ -76,14 +76,14 @@ class Backups:
|
||||||
Storage.store_provider(json_provider)
|
Storage.store_provider(json_provider)
|
||||||
return json_provider
|
return json_provider
|
||||||
|
|
||||||
none_provider = Backups.construct_provider(
|
none_provider = Backups._construct_provider(
|
||||||
BackupProviderEnum.NONE, login="", key="", location=""
|
BackupProviderEnum.NONE, login="", key="", location=""
|
||||||
)
|
)
|
||||||
Storage.store_provider(none_provider)
|
Storage.store_provider(none_provider)
|
||||||
return none_provider
|
return none_provider
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def construct_provider(
|
def _construct_provider(
|
||||||
kind: BackupProviderEnum,
|
kind: BackupProviderEnum,
|
||||||
login: str,
|
login: str,
|
||||||
key: str,
|
key: str,
|
||||||
|
@ -104,7 +104,7 @@ class Backups:
|
||||||
provider_model = Storage.load_provider()
|
provider_model = Storage.load_provider()
|
||||||
if provider_model is None:
|
if provider_model is None:
|
||||||
return None
|
return None
|
||||||
return Backups.construct_provider(
|
return Backups._construct_provider(
|
||||||
BackupProviderEnum[provider_model.kind],
|
BackupProviderEnum[provider_model.kind],
|
||||||
provider_model.login,
|
provider_model.login,
|
||||||
provider_model.key,
|
provider_model.key,
|
||||||
|
@ -133,7 +133,7 @@ class Backups:
|
||||||
if provider_dict == DEFAULT_JSON_PROVIDER:
|
if provider_dict == DEFAULT_JSON_PROVIDER:
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return Backups.construct_provider(
|
return Backups._construct_provider(
|
||||||
kind=BackupProviderEnum[provider_dict["provider"]],
|
kind=BackupProviderEnum[provider_dict["provider"]],
|
||||||
login=provider_dict["accountId"],
|
login=provider_dict["accountId"],
|
||||||
key=provider_dict["accountKey"],
|
key=provider_dict["accountKey"],
|
||||||
|
|
Loading…
Reference in a new issue