Skip to content

Commit

Permalink
📝 document download function
Browse files Browse the repository at this point in the history
  • Loading branch information
devmoath committed Feb 12, 2023
1 parent ed841f7 commit 997dad9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/vendor/
/.phpunit.result.cache
/composer.lock
.DS_Store
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,27 @@ null

---

#### `download` function

Download an attachment content.

```php
$attachment = $client->attachments()->get(id: '1000');

$client->attachments()->download(url: $attachment['content']);
```

<details>
<summary>response example</summary>

```text
{"a":"b"}\n
```

</details>

---

### `Customers` Resource

#### `create` function
Expand Down
4 changes: 2 additions & 2 deletions tests/Resources/Attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
it('can download an attachment content', function () {
$client = mockClient(
method: Method::GET,
uri: 'https://www.example.com/jira/attachments/10000',
uri: 'https://www.example.com/secure/attachment/4157499/index-1.json',
response: downloadAttachment(),
function: 'requestContent'
);

$result = $client->attachments()->download(url: 'https://www.example.com/jira/attachments/10000');
$result = $client->attachments()->download(url: 'https://www.example.com/secure/attachment/4157499/index-1.json');

expect($result)->toBe(downloadAttachment());
});

0 comments on commit 997dad9

Please sign in to comment.