-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55ea088
commit 431a180
Showing
7 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/pyconnectwise/endpoints/change_request/DefaultSettingsEndpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from pyconnectwise.endpoints.base.connectwise_endpoint import ConnectWiseEndpoint | ||
from pyconnectwise.endpoints.change_request.SetSettingsEndpoint import SetSettingsEndpoint | ||
from pyconnectwise.interfaces import IGettable, IPostable | ||
from pyconnectwise.models.change_request import SettingsData, SettingsObject, SetSettingsMsg | ||
from pyconnectwise.types import JSON, ConnectWiseChangeApprovalRequestParams | ||
|
||
if TYPE_CHECKING: | ||
from pyconnectwise.clients.connectwise_client import ConnectWiseClient | ||
|
||
|
||
class DefaultSettingsEndpoint( | ||
ConnectWiseEndpoint, | ||
): | ||
def __init__(self, client: "ConnectWiseClient", parent_endpoint: ConnectWiseEndpoint = None) -> None: | ||
ConnectWiseEndpoint.__init__(self, client, "DefaultSettings", parent_endpoint=parent_endpoint) | ||
|
||
@property | ||
def set_settings(self) -> SetSettingsEndpoint: | ||
return SetSettingsEndpoint(self.client, parent_endpoint=self) | ||
|
33 changes: 33 additions & 0 deletions
33
src/pyconnectwise/endpoints/change_request/SetSettingsEndpoint.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from pyconnectwise.endpoints.base.connectwise_endpoint import ConnectWiseEndpoint | ||
from pyconnectwise.interfaces import IGettable, IPostable | ||
from pyconnectwise.models.change_request import SettingsData, SettingsObject, SetSettingsMsg, SetSettingsObject | ||
from pyconnectwise.types import JSON, ConnectWiseChangeApprovalRequestParams | ||
|
||
if TYPE_CHECKING: | ||
from pyconnectwise.clients.connectwise_client import ConnectWiseClient | ||
|
||
|
||
class SetSettingsEndpoint( | ||
ConnectWiseEndpoint, | ||
IPostable[SetSettingsMsg, ConnectWiseChangeApprovalRequestParams], | ||
): | ||
def __init__(self, client: "ConnectWiseClient", parent_endpoint: ConnectWiseEndpoint = None) -> None: | ||
ConnectWiseEndpoint.__init__(self, client, "set_settings", parent_endpoint=parent_endpoint) | ||
|
||
def post( | ||
self, data: JSON | None = None, params: ConnectWiseChangeApprovalRequestParams | None = None | ||
) -> SetSettingsMsg: | ||
""" | ||
Performs a GET request against the /api/change_requests endpoint. | ||
Parameters: | ||
data (dict[str, Any]): The data to send in the request body. | ||
params (dict[str, int | str]): The parameters to send in the request query string. | ||
Returns: | ||
list[ChangeRequestMsg]: The parsed response data. | ||
""" | ||
obj = self._parse_one(SetSettingsObject, super()._make_request("POST", data=data, params=params).json()) | ||
return obj.msg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters