-
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
ec41438
commit b303d1e
Showing
5 changed files
with
75 additions
and
2 deletions.
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
32 changes: 32 additions & 0 deletions
32
src/pyconnectwise/endpoints/change_request/SettingsEndpoint.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,32 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
from pyconnectwise.endpoints.base.connectwise_endpoint import ConnectWiseEndpoint | ||
from pyconnectwise.interfaces import IGettable | ||
from pyconnectwise.models.change_request import ChangeRequestMsg, SettingsData, SettingsObject | ||
from pyconnectwise.types import JSON, ConnectWiseChangeApprovalRequestParams | ||
|
||
if TYPE_CHECKING: | ||
from pyconnectwise.clients.connectwise_client import ConnectWiseClient | ||
|
||
|
||
class SettingsEndpoint( | ||
ConnectWiseEndpoint, | ||
IGettable[list[SettingsData], ConnectWiseChangeApprovalRequestParams], | ||
): | ||
def __init__(self, client: "ConnectWiseClient", parent_endpoint: ConnectWiseEndpoint = None) -> None: | ||
ConnectWiseEndpoint.__init__(self, client, "settings", parent_endpoint=parent_endpoint) | ||
IGettable.__init__(self, list[SettingsData]) | ||
|
||
def get(self, data: JSON | None = None, params: ConnectWiseChangeApprovalRequestParams | None = None) -> list[SettingsData]: | ||
""" | ||
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(SettingsObject, super()._make_request("GET", data=data, params=params).json()) | ||
# TODO - `total`, `current`, which is paginated? | ||
return obj.msg.data |
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