diff --git a/README.md b/README.md index c6b77dc..5eca21f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,11 @@ $webflow->createItem($collectionId, $fields); $webflow->updateItem($collectionId, $itemId, $fields); ``` +### Patch Collection Item +``` +$webflow->patchItem($collectionId, $itemId, $fields); +``` + ### Remove Collection Item ``` $webflow->removeItem($collectionId, $itemId); diff --git a/src/Webflow/Api.php b/src/Webflow/Api.php index b9d8e78..18bca2b 100644 --- a/src/Webflow/Api.php +++ b/src/Webflow/Api.php @@ -76,6 +76,11 @@ private function put($path, $data) return $this->request($path, "PUT", $data); } + private function patch($path, $data) + { + return $this->request($path, "PATCH", $data); + } + private function delete($path) { return $this->request($path, "DELETE"); @@ -179,6 +184,13 @@ public function updateItem(string $collectionId, string $itemId, array $fields, ]); } + public function patchItem(string $collectionId, string $itemId, array $fields, bool $live = false) + { + return $this->patch("/collections/{$collectionId}/items/{$itemId}" . ($live ? "?live=true" : ""), [ + 'fields' => $fields, + ]); + } + public function removeItem(string $collectionId, $itemId) { return $this->delete("/collections/{$collectionId}/items/{$itemId}");