From 25f2b365bd42e86e2ae2be781ba003b262decf5f Mon Sep 17 00:00:00 2001 From: michaeldchin Date: Thu, 21 Oct 2021 08:56:56 -0500 Subject: [PATCH] add get delete summary fields --- src/Resources/Sheet.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/Resources/Sheet.php b/src/Resources/Sheet.php index 82d4a0f..3ea5b1e 100644 --- a/src/Resources/Sheet.php +++ b/src/Resources/Sheet.php @@ -331,4 +331,33 @@ public function getColumns(): array { return $this->columns; } + + public function addSummaryField(String $title, String $formula, String $type = 'TEXT_NUMBER') + { + $options = [ + [ + 'title' => $title, + 'type' => $type, + 'formula' => $formula + ] + ]; + return $this->client->post("sheets/$this->id/summary/fields", + ['json' => [...$options]] + ); + } + + public function getSummaryFields() + { + return $this->client->get("sheets/$this->id/summary"); + } + + public function deleteSummaryFields(array $fieldIds) + { + return $this->client->delete("sheets/$this->id/summary/fields?ids=". implode(',', $fieldIds)); + } + + public function deleteSummaryField(String $fieldId) + { + return $this->deleteSummaryFields([$fieldId]); + } }