diff --git a/lib/public/Teams/ITeamFolderProvider.php b/lib/public/Teams/ITeamFolderProvider.php index 58b1b6f19ca41..4eb33fe33d819 100644 --- a/lib/public/Teams/ITeamFolderProvider.php +++ b/lib/public/Teams/ITeamFolderProvider.php @@ -39,6 +39,16 @@ public function getTeamFolder(string $teamId): ?TeamFolder; */ public function createTeamFolder(Team $team, int $quota = 0): TeamFolder; + /** + * Update the storage quota of the team folder. + * + * @param string $teamId The team single id. + * @param int $quota Quota in bytes; zero means unlimited. + * @return TeamFolder The updated folder. + * @since 35.0.0 + */ + public function updateTeamFolderQuota(string $teamId, int $quota): TeamFolder; + /** * Remove the exclusive relationship but retain the folder and its contents. * diff --git a/lib/public/Teams/TeamFolder.php b/lib/public/Teams/TeamFolder.php index 0d87a11b46f36..7a5c0858294f7 100644 --- a/lib/public/Teams/TeamFolder.php +++ b/lib/public/Teams/TeamFolder.php @@ -24,6 +24,7 @@ class TeamFolder implements \JsonSerializable { public function __construct( private int $id, private string $mountPoint, + private ?int $quota = null, ) { } @@ -42,13 +43,24 @@ public function getMountPoint(): string { } /** - * @return array{id: int, mountPoint: string} + * The storage quota in bytes, zero for unlimited, or null if the active + * provider does not expose a quota for this folder. + * + * @since 35.0.0 + */ + public function getQuota(): ?int { + return $this->quota; + } + + /** + * @return array{id: int, mountPoint: string, quota: int|null} * @since 35.0.0 */ #[\Override] public function jsonSerialize(): array { return [ 'id' => $this->id, + 'quota' => $this->quota, 'mountPoint' => $this->mountPoint, ]; } diff --git a/tests/lib/Teams/TeamFolderTest.php b/tests/lib/Teams/TeamFolderTest.php index 0b5397dbf224e..bc062b98d61e2 100644 --- a/tests/lib/Teams/TeamFolderTest.php +++ b/tests/lib/Teams/TeamFolderTest.php @@ -18,6 +18,14 @@ public function testSerializesFolderIdentity(): void { $this->assertSame(42, $folder->getId()); $this->assertSame('Engineering', $folder->getMountPoint()); - $this->assertSame(['id' => 42, 'mountPoint' => 'Engineering'], $folder->jsonSerialize()); + $this->assertNull($folder->getQuota()); + $this->assertSame(['id' => 42, 'quota' => null, 'mountPoint' => 'Engineering'], $folder->jsonSerialize()); + } + + public function testSerializesFolderQuota(): void { + $folder = new TeamFolder(42, 'Engineering', 1024); + + $this->assertSame(1024, $folder->getQuota()); + $this->assertSame(['id' => 42, 'quota' => 1024, 'mountPoint' => 'Engineering'], $folder->jsonSerialize()); } }