summaryrefslogtreecommitdiff
path: root/kodereviewer/network_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'kodereviewer/network_manager.py')
-rw-r--r--kodereviewer/network_manager.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/kodereviewer/network_manager.py b/kodereviewer/network_manager.py
index 089e69e..cbe5160 100644
--- a/kodereviewer/network_manager.py
+++ b/kodereviewer/network_manager.py
@@ -83,7 +83,14 @@ class NetworkManager(QObject):
pull_request_number = int(match.groups()[0])
pull_request = self._project.find_pull_request(pull_request_number)
if pull_request is not None:
- pull_request.load_comments(response_body)
+
+ # List
+ if reply.operation() == QNetworkAccessManager.Operation.GetOperation:
+ pull_request.load_comments(response_body)
+ elif reply.operation() == QNetworkAccessManager.Operation.PostOperation:
+ logger.info(response_body)
+ else:
+ logger.info("Pero la puta")
elif (match := FILE_LIST_URL.search(reply.url().toString())):
pull_request_number = int(match.groups()[0])
pull_request: Optional[PullRequest] = self._project.find_pull_request(pull_request_number)
@@ -109,6 +116,16 @@ class NetworkManager(QObject):
self._request_factory.createRequest(f'/issues/{number}/comments')
)
+ @Slot(int, str)
+ def createComment(self, number: int, comment: str) -> None:
+ request = self._request_factory.createRequest(
+ f'/issues/{number}/comments'
+ )
+ data = {
+ 'body': comment
+ }
+ self._manager.post(request, json.dumps(data).encode())
+
@Slot(int)
def getFiles(self, pull_request_number) -> None:
self._manager.get(