diff --git a/src/QueryBuilder/DeleteQuery/DeleteQuery.php b/src/QueryBuilder/DeleteQuery/DeleteQuery.php new file mode 100644 index 0000000..701d9de --- /dev/null +++ b/src/QueryBuilder/DeleteQuery/DeleteQuery.php @@ -0,0 +1,31 @@ +QueryString = $queryString; + } + public function __toString() + { + return $this->QueryString; + } + + public function RunQuery(DeegraphServer $server): DeleteQueryResponse + { + $response = $server->RunRawRequest( + endpoint: "/api/v1/@query", + method: "POST", + body: $this->QueryString + ); + $temp = json_decode($response, true); + return new DeleteQueryResponse($temp); + } +} diff --git a/src/QueryBuilder/DeleteQuery/DeleteQueryBuilder.php b/src/QueryBuilder/DeleteQuery/DeleteQueryBuilder.php new file mode 100644 index 0000000..cc9d160 --- /dev/null +++ b/src/QueryBuilder/DeleteQuery/DeleteQueryBuilder.php @@ -0,0 +1,35 @@ +RelativePath = $relativePath; + return $this; + } + + public function Build(): DeleteQuery + { + self::ValidateValues(target: $this); + + $builder = "DELETE " . $this->RelativePath; + + return new DeleteQuery(queryString: $builder); + } +} diff --git a/src/QueryBuilder/DeleteQuery/DeleteQueryResponse.php b/src/QueryBuilder/DeleteQuery/DeleteQueryResponse.php new file mode 100644 index 0000000..73c1b1d --- /dev/null +++ b/src/QueryBuilder/DeleteQuery/DeleteQueryResponse.php @@ -0,0 +1,10 @@ +RelativePath($this->TestUUID) + ->Build(); + self::assertEquals( + expected: "DELETE {$this->TestUUID}", + actual: $query + ); + } +}