Skip to content

Commit

Permalink
Merge pull request #21 from WillyReyno/patch-2
Browse files Browse the repository at this point in the history
Add support for "isPublic" parameter when creating a library playlist
  • Loading branch information
PouleR authored May 22, 2024
2 parents a490613 + 1d14f55 commit 4b91e74
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/AppleMusicAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ public function createLibraryPlaylist(LibraryPlaylistCreationRequest $playlist)
$requestBody['attributes'] = [
'name' => $playlist->getName(),
'description' => $playlist->getDescription(),
'isPublic' => $playlist->isPublic(),
];

foreach ($playlist->getTracks() as $track) {
Expand Down
21 changes: 21 additions & 0 deletions src/Request/LibraryPlaylistCreationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ class LibraryPlaylistCreationRequest
*/
protected $description = '';

/**
* @var bool
*/
protected $isPublic = false;

/**
* @var LibraryResource[]
*/
Expand Down Expand Up @@ -64,6 +69,22 @@ public function getDescription(): string
return $this->description;
}

/**
* @param bool $isPublic
*/
public function setIsPublic(bool $isPublic): void
{
$this->isPublic = $isPublic;
}

/**
* @return bool
*/
public function isPublic(): bool
{
return $this->isPublic;
}

/**
* @param LibraryResource $track
*/
Expand Down

0 comments on commit 4b91e74

Please sign in to comment.