Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/public/Teams/ITeamFolderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
14 changes: 13 additions & 1 deletion lib/public/Teams/TeamFolder.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class TeamFolder implements \JsonSerializable {
public function __construct(
private int $id,
private string $mountPoint,
private ?int $quota = null,
) {
}

Expand All @@ -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,
];
}
Expand Down
10 changes: 9 additions & 1 deletion tests/lib/Teams/TeamFolderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Loading