Skip to content

Commit

Permalink
Merge pull request #80 from packagist/subrepo-package-id-changes
Browse files Browse the repository at this point in the history
Mention subrepository package id changes
  • Loading branch information
glaubinix authored Sep 4, 2024
2 parents bca533e + c8e2c04 commit 7b315a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,15 @@ $packages = $client->subrepositories()->packages()->all($subrepositoryName);
Returns an array of subrepositories packages.

#### Show a subrepository package

You can reference a package by its name or ID.

```php
$subrepositoryName = 'subrepository';
// Either use package name:
$package = $client->subrepositories()->packages()->show($subrepositoryName, 'acme-website/package');
// Or the package ID:
$package = $client->subrepositories()->packages()->show($subrepositoryName, 123);
```
Returns the package.

Expand Down
20 changes: 10 additions & 10 deletions src/Api/Subrepositories/Packages.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public function all($subrepositoryName, array $filters = [])
return $this->get(sprintf('/subrepositories/%s/packages/', $subrepositoryName), $filters);
}

public function show($subrepositoryName, $packageName)
public function show($subrepositoryName, $packageIdOrName)
{
return $this->get(sprintf('/subrepositories/%s/packages/%s', $subrepositoryName, $packageName));
return $this->get(sprintf('/subrepositories/%s/packages/%s', $subrepositoryName, $packageIdOrName));
}

public function createVcsPackage($subrepositoryName, $url, $credentialId = null, $type = 'vcs', $defaultSubrepositoryAccess = null)
Expand All @@ -44,27 +44,27 @@ public function createCustomPackage($subrepositoryName, $customJson, $credential
return $this->post(sprintf('/subrepositories/%s/packages/', $subrepositoryName), $data->toParameters());
}

public function editVcsPackage($subrepositoryName, $packageName, $url, $credentialId = null, $type = 'vcs', $defaultSubrepositoryAccess = null)
public function editVcsPackage($subrepositoryName, $packageIdOrName, $url, $credentialId = null, $type = 'vcs', $defaultSubrepositoryAccess = null)
{
$data = new VcsPackageConfig($url, $credentialId, $type, $defaultSubrepositoryAccess);

return $this->put(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageName), $data->toParameters());
return $this->put(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageIdOrName), $data->toParameters());
}

public function editCustomPackage($subrepositoryName, $packageName, $customJson, $credentialId = null, $defaultSubrepositoryAccess = null)
public function editCustomPackage($subrepositoryName, $packageIdOrName, $customJson, $credentialId = null, $defaultSubrepositoryAccess = null)
{
$data = new CustomPackageConfig($customJson, $credentialId, $defaultSubrepositoryAccess);

return $this->put(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageName), $data->toParameters());
return $this->put(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageIdOrName), $data->toParameters());
}

public function remove($subrepositoryName, $packageName)
public function remove($subrepositoryName, $packageIdOrName)
{
return $this->delete(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageName));
return $this->delete(sprintf('/subrepositories/%s/packages/%s/', $subrepositoryName, $packageIdOrName));
}

public function listDependents($subrepositoryName, $packageName)
public function listDependents($subrepositoryName, $packageIdOrName)
{
return $this->get(sprintf('/subrepositories/%s/packages/%s/dependents/', $subrepositoryName, $packageName));
return $this->get(sprintf('/subrepositories/%s/packages/%s/dependents/', $subrepositoryName, $packageIdOrName));
}
}

0 comments on commit 7b315a0

Please sign in to comment.