diff --git a/PlagScan/API.php b/PlagScan/API.php index b7518bff24da7b126d3902dc3c2a3b951c0e28d2..bb222cb4a67b0f642c291e85f43233d23b7531be 100644 --- a/PlagScan/API.php +++ b/PlagScan/API.php @@ -61,7 +61,7 @@ class API $url .= '?access_token=' . $accessToken; } - if ($requestType === 'GET') { + if ($requestType === 'GET' || $requestType === 'PATCH') { foreach ($data as $key => $value) { $url .= '&' . $key . '=' . $value; } diff --git a/PlagScan/Helper/Documents.php b/PlagScan/Helper/Documents.php index df09dadb99f15dadc906770f581a48ece8fc865f..539f87a5c9ddd9882204d38ddaf2d8e8ec598c13 100644 --- a/PlagScan/Helper/Documents.php +++ b/PlagScan/Helper/Documents.php @@ -29,17 +29,21 @@ class Documents extends Base } /** - * @param string $data + * @param string $fileData * @param bool $plain + * @param int $userID * @return array|string */ - public function add(string $fileData, bool $plain = false) + public function add(string $fileData, bool $plain, int $userID = 0) { if ($plain) { $data['textdata'] = $fileData; } else { $data['fileUpload'] = $fileData; } + if($userID){ + $data['userID'] = $userID; + } return $this->handler->request('documents', 'POST', $this->accessToken, $data); } diff --git a/PlagScan/Helper/Repository.php b/PlagScan/Helper/Repository.php index fb5f4a1a56f4a91bc3d7cdf20f4d7113dc62f5c0..deb8a3c0c4cc15903b135dfd171b2f1c4f9d8a99 100644 --- a/PlagScan/Helper/Repository.php +++ b/PlagScan/Helper/Repository.php @@ -25,6 +25,6 @@ class Repository extends Base */ public function delete(int $docID) { - return $this->handler->request('submissions/documents/' . $docID, 'DELETE', $this->accessToken); + return $this->handler->request('repositories/documents/' . $docID, 'DELETE', $this->accessToken); } } \ No newline at end of file diff --git a/PlagScan/Helper/Submissions.php b/PlagScan/Helper/Submissions.php index 5a8a7499a53f317be7d94d63dd37230b8f6e0ffe..8687c57cd5f64d77f4987b9a317f84d31d245449 100644 --- a/PlagScan/Helper/Submissions.php +++ b/PlagScan/Helper/Submissions.php @@ -70,7 +70,7 @@ class Submissions extends Base */ public function change(int $submissionID, array $changes) { - return $this->handler->request('submission/' . $submissionID, 'PATCH', $this->accessToken, $changes); + return $this->handler->request('submissions/' . $submissionID, 'PATCH', $this->accessToken, $changes); } /**