Skip to content

Commit c97bb0f

Browse files
committed
Update docs for artifact
1 parent 27103b3 commit c97bb0f

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@
7272
* [List all customers with access to a package](#list-all-customers-with-access-to-a-package)
7373
* [Create an artifact package file](#create-an-artifact-package-file)
7474
* [Create an artifact package](#create-an-artifact-package)
75-
* [Update artifact files of a package](#update-artifact-files-of-a-package)
7675
* [Add an artifact file to an existing package](#add-an-artifact-file-to-an-existing-package)
76+
* [Update or replace artifact files of a package](#update-or-replace-artifact-files-of-a-package)
7777
* [Credential](#credential)
7878
* [List an organization's credentials](#list-an-organizations-credentials)
7979
* [Show a credential](#show-a-credential)
@@ -99,7 +99,7 @@
9999
* [Validate incoming webhook payloads](#validate-incoming-webhook-payloads)
100100
* [License](#license)
101101

102-
<!-- Added by: wissem, at: Thu Oct 15 10:37:57 CEST 2020 -->
102+
<!-- Added by: wissem, at: Fri Oct 16 14:23:54 CEST 2020 -->
103103

104104
<!--te-->
105105

@@ -598,14 +598,6 @@ $response = $client->packages()->artifacts()->create($file, 'application/zip', $
598598
$artifactId = $response['id'];
599599
$client->packages()->createArtifactPackage([$artifactId]);
600600
```
601-
#### Update artifact files of a package
602-
603-
```php
604-
$result = $client->packages()->artifacts()->showPackageArtifacts('acme-website/package'); // get artifact files details for a package
605-
$artifactFileIds = [42, 43];
606-
$client->packages()->editArtifactPackage('acme-website/package', $artifactFileIds);
607-
```
608-
609601
#### Add an artifact file to an existing package
610602

611603
```php
@@ -614,6 +606,19 @@ $fileName = 'package1.zip';
614606
$file = file_get_contents($fileName);
615607
$client->packages()->artifacts()->add($packageName, $file, 'application/zip', $fileName);
616608
```
609+
#### Update or replace artifact files of a package
610+
611+
```php
612+
// in case you want to replace the artifact file with a newly uploaded one
613+
// 1. upload the new artifact file
614+
$fileName = 'package1.zip';
615+
$file = file_get_contents($fileName);
616+
$response = $client->packages()->artifacts()->create($file, 'application/zip', $fileName);
617+
$artifactId = $response['id'];
618+
// 2. send the artifact file ids you want to use for the package
619+
$client->packages()->editArtifactPackage('acme-website/package', [$artifactId, 42]);
620+
```
621+
617622
### Credential
618623

619624
#### List an organization's credentials

0 commit comments

Comments
 (0)