From 8fba969417413322a07f39e393842ae90a85a0d6 Mon Sep 17 00:00:00 2001 From: Da Silva Mendonca Thomas Date: Thu, 5 Oct 2023 10:32:56 +0200 Subject: [PATCH] add site and product review api --- Config/module.xml | 2 +- Controller/Api/NetreviewsProductReview.php | 46 +++ .../Api/NetreviewsSiteReviewController.php | 45 +++ Model/Api/NetreviewsProductReview.php | 343 ++++++++++++++++++ Model/Api/NetreviewsSiteReview.php | 262 +++++++++++++ 5 files changed, 697 insertions(+), 1 deletion(-) create mode 100644 Controller/Api/NetreviewsProductReview.php create mode 100644 Controller/Api/NetreviewsSiteReviewController.php create mode 100644 Model/Api/NetreviewsProductReview.php create mode 100644 Model/Api/NetreviewsSiteReview.php diff --git a/Config/module.xml b/Config/module.xml index 9c1f149..4e1f418 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -15,7 +15,7 @@ en_US fr_FR - 2.0.2 + 2.0.3 Vincent Lopes-Vicente diff --git a/Controller/Api/NetreviewsProductReview.php b/Controller/Api/NetreviewsProductReview.php new file mode 100644 index 0000000..cf12b0e --- /dev/null +++ b/Controller/Api/NetreviewsProductReview.php @@ -0,0 +1,46 @@ +find(); + + return OpenApiService::jsonResponse( + array_map(fn($productReviews) => $modelFactory->buildModel('NetreviewsProductReview', $productReviews), iterator_to_array($productReviews)) + ); + } + +} \ No newline at end of file diff --git a/Controller/Api/NetreviewsSiteReviewController.php b/Controller/Api/NetreviewsSiteReviewController.php new file mode 100644 index 0000000..248eeff --- /dev/null +++ b/Controller/Api/NetreviewsSiteReviewController.php @@ -0,0 +1,45 @@ +find(); + + return OpenApiService::jsonResponse( + array_map(fn($siteReviews) => $modelFactory->buildModel('NetreviewsSiteReview', $siteReviews), iterator_to_array($siteReviews)) + ); + } +} \ No newline at end of file diff --git a/Model/Api/NetreviewsProductReview.php b/Model/Api/NetreviewsProductReview.php new file mode 100644 index 0000000..720b5f1 --- /dev/null +++ b/Model/Api/NetreviewsProductReview.php @@ -0,0 +1,343 @@ +productReviewId; + } + + /** + * @param string $productReviewId + * @return NetreviewsProductReview + */ + public function setProductReviewId(string $productReviewId): NetreviewsProductReview + { + $this->productReviewId = $productReviewId; + return $this; + } + + /** + * @return string + */ + public function getReviewId(): string + { + return $this->reviewId; + } + + /** + * @param string $reviewId + * @return NetreviewsProductReview + */ + public function setReviewId(string $reviewId): NetreviewsProductReview + { + $this->reviewId = $reviewId; + return $this; + } + + /** + * @return string + */ + public function getEmail(): string + { + return $this->email; + } + + /** + * @param string|null $email + * @return NetreviewsProductReview + */ + public function setEmail(?string $email): NetreviewsProductReview + { + $this->email = $email; + return $this; + } + + /** + * @return string + */ + public function getLastName(): string + { + return $this->lastName; + } + + /** + * @param string|null $lastName + * @return NetreviewsProductReview + */ + public function setLastName(?string $lastName): NetreviewsProductReview + { + $this->lastName = $lastName; + return $this; + } + + /** + * @return string + */ + public function getFirstName(): string + { + return $this->firstName; + } + + /** + * @param string|null $firstName + * @return NetreviewsProductReview + */ + public function setFirstName(?string $firstName): NetreviewsProductReview + { + $this->firstName = $firstName; + return $this; + } + + /** + * @return string + */ + public function getReviewDate(): string + { + return $this->reviewDate; + } + + /** + * @param DateTime|null $reviewDate + * @return NetreviewsProductReview + */ + public function setReviewDate(?DateTime $reviewDate): NetreviewsProductReview + { + $this->reviewDate = $reviewDate->format('Y-m-d H:i:s'); + return $this; + } + + /** + * @return string + */ + public function getMessage(): string + { + return $this->message; + } + + /** + * @param string|null $message + * @return NetreviewsProductReview + */ + public function setMessage(?string $message): NetreviewsProductReview + { + $this->message = $message; + return $this; + } + + /** + * @return string + */ + public function getRate(): string + { + return $this->rate; + } + + /** + * @param string|null $rate + * @return NetreviewsProductReview + */ + public function setRate(?string $rate): NetreviewsProductReview + { + $this->rate = $rate; + return $this; + } + + /** + * @return string + */ + public function getOrderRef(): string + { + return $this->orderRef; + } + + /** + * @param string|null $orderRef + * @return NetreviewsProductReview + */ + public function setOrderRef(?string $orderRef): NetreviewsProductReview + { + $this->orderRef = $orderRef; + return $this; + } + + /** + * @return string + */ + public function getProductRef(): string + { + return $this->productRef; + } + + /** + * @param string|null $productRef + * @return NetreviewsProductReview + */ + public function setProductRef(?string $productRef): NetreviewsProductReview + { + $this->productRef = $productRef; + return $this; + } + + /** + * @return int + */ + public function getProductId(): int + { + return $this->productId; + } + + /** + * @param int|null $productId + * @return NetreviewsProductReview + */ + public function setProductId(?int $productId): NetreviewsProductReview + { + $this->productId = $productId; + return $this; + } + + /** + * @return int + */ + public function getExchange(): int + { + return $this->exchange; + } + + /** + * @param int|null $exchange + * @return NetreviewsProductReview + */ + public function setExchange(?int $exchange): NetreviewsProductReview + { + $this->exchange = $exchange; + return $this; + } +} \ No newline at end of file diff --git a/Model/Api/NetreviewsSiteReview.php b/Model/Api/NetreviewsSiteReview.php new file mode 100644 index 0000000..d71b3cb --- /dev/null +++ b/Model/Api/NetreviewsSiteReview.php @@ -0,0 +1,262 @@ +siteReviewId; + } + + /** + * @param int $siteReviewId + * @return NetreviewsSiteReview + */ + public function setSiteReviewId(int $siteReviewId): NetreviewsSiteReview + { + $this->siteReviewId = $siteReviewId; + return $this; + } + + /** + * @return string + */ + public function getReviewId(): string + { + return $this->reviewId; + } + + /** + * @param string $reviewId + * @return NetreviewsSiteReview + */ + public function setReviewId(string $reviewId): NetreviewsSiteReview + { + $this->reviewId = $reviewId; + return $this; + } + + /** + * @return string + */ + public function getLastName(): string + { + return $this->lastName; + } + + /** + * @param string|null $lastName + * @return NetreviewsSiteReview + */ + public function setLastName(?string $lastName): NetreviewsSiteReview + { + $this->lastName = $lastName; + return $this; + } + + /** + * @return string + */ + public function getFirstName(): string + { + return $this->firstName; + } + + /** + * @param string|null $firstName + * @return NetreviewsSiteReview + */ + public function setFirstName(?string $firstName): NetreviewsSiteReview + { + $this->firstName = $firstName; + return $this; + } + + /** + * @return string + */ + public function getReview(): string + { + return $this->review; + } + + /** + * @param string|null $review + * @return NetreviewsSiteReview + */ + public function setReview(?string $review): NetreviewsSiteReview + { + $this->review = $review; + return $this; + } + + /** + * @return string + */ + public function getReviewDate(): string + { + return $this->reviewDate; + } + + /** + * @param DateTime|null $reviewDate + * @return NetreviewsSiteReview + */ + public function setReviewDate(?DateTime $reviewDate): NetreviewsSiteReview + { + $this->reviewDate = $reviewDate->format('Y-m-d H:i:s'); + return $this; + } + + /** + * @return string + */ + public function getRate(): string + { + return $this->rate; + } + + /** + * @param string|null $rate + * @return NetreviewsSiteReview + */ + public function setRate(?string $rate): NetreviewsSiteReview + { + $this->rate = $rate; + return $this; + } + + /** + * @return string + */ + public function getOrderRef(): string + { + return $this->orderRef; + } + + /** + * @param string|null $orderRef + * @return NetreviewsSiteReview + */ + public function setOrderRef(?string $orderRef): NetreviewsSiteReview + { + $this->orderRef = $orderRef; + return $this; + } + + /** + * @return string + */ + public function getOrderDate(): string + { + return $this->orderDate; + } + + /** + * @param DateTime|null $orderDate + * @return NetreviewsSiteReview + */ + public function setOrderDate(?DateTime $orderDate): NetreviewsSiteReview + { + $this->orderDate = $orderDate->format('Y-m-d H:i:s'); + return $this; + } +} \ No newline at end of file