Skip to content

Commit

Permalink
Merge pull request #3 from michaeldchin/add-summary-fields
Browse files Browse the repository at this point in the history
add get delete summary fields
  • Loading branch information
Trey Foster authored Oct 21, 2021
2 parents f40ad6c + 25f2b36 commit 23c7efd
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/Resources/Sheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
}

0 comments on commit 23c7efd

Please sign in to comment.