Skip to content

Commit 0af775a

Browse files
committed
Update code examples in docs
1 parent 7b94ead commit 0af775a

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

docs/usage.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,15 +228,14 @@ To check for failed requests you can afterwards check the status code via `$clie
228228
```php
229229

230230
$client->getApi('tracker')->list();
231-
$client->getApi('tracker')->listing();
231+
$client->getApi('tracker')->listNames();
232232
```
233233

234234
#### IssueStatus API
235235

236236
```php
237237
$client->getApi('issue_status')->list();
238-
$client->getApi('issue_status')->listing();
239-
$client->getApi('issue_status')->getIdByName('New');
238+
$client->getApi('issue_status')->listNames();
240239

241240
```
242241

@@ -247,10 +246,8 @@ $client->getApi('project')->list();
247246
$client->getApi('project')->list([
248247
'limit' => 10,
249248
]);
250-
$client->getApi('project')->listing();
251-
$client->getApi('project')->listing();
249+
$client->getApi('project')->listNames();
252250
$client->getApi('project')->show($projectId);
253-
$client->getApi('project')->getIdByName('Elvis');
254251
$client->getApi('project')->create([
255252
'name' => 'some name',
256253
'identifier' => 'the_identifier',
@@ -270,7 +267,7 @@ $client->getApi('project')->remove($projectId);
270267

271268
```php
272269
$client->getApi('user')->list();
273-
$client->getApi('user')->listing();
270+
$client->getApi('user')->listLogins();
274271
$client->getApi('user')->getCurrentUser([
275272
'include' => [
276273
'memberships',
@@ -279,7 +276,6 @@ $client->getApi('user')->getCurrentUser([
279276
'status',
280277
],
281278
]);
282-
$client->getApi('user')->getIdByUsername('kbsali');
283279
$client->getApi('user')->show($userId, [
284280
'include' => [
285281
'memberships',
@@ -358,8 +354,11 @@ $client->getApi('issue')->update($issueId, [
358354
'priority_id' => 5,
359355
'due_date' => date('Y-m-d'),
360356
]);
357+
$client->getApi('issue')->addWatcher($issueId, $userId);
358+
$client->getApi('issue')->removeWatcher($issueId, $userId);
361359
$client->getApi('issue')->setIssueStatus($issueId, 'Resolved');
362360
$client->getApi('issue')->addNoteToIssue($issueId, 'some comment');
361+
$client->getApi('issue')->addNoteToIssue($issueId, 'private note', true);
363362
$client->getApi('issue')->remove($issueId);
364363

365364
// To upload a file + attach it to an existing issue with $issueId
@@ -421,9 +420,8 @@ Array
421420

422421
```php
423422
$client->getApi('issue_category')->listByProject('project1');
424-
$client->getApi('issue_category')->listing($projectId);
423+
$client->getApi('issue_category')->listNamesByProject($projectId);
425424
$client->getApi('issue_category')->show($categoryId);
426-
$client->getApi('issue_category')->getIdByName($projectId, 'Administration');
427425
$client->getApi('issue_category')->create('otherProject', [
428426
'name' => 'test category',
429427
]);
@@ -440,9 +438,8 @@ $client->getApi('issue_category')->remove($categoryId, [
440438

441439
```php
442440
$client->getApi('version')->listByProject('test');
443-
$client->getApi('version')->listing('test');
441+
$client->getApi('version')->listNamesByProject('test');
444442
$client->getApi('version')->show($versionId);
445-
$client->getApi('version')->getIdByName('test', 'v2');
446443
$client->getApi('version')->create('test', [
447444
'name' => 'v3432',
448445
]);
@@ -456,9 +453,17 @@ $client->getApi('version')->remove($versionId);
456453

457454
```php
458455
$client->getApi('attachment')->show($attachmentId);
456+
$client->getApi('attachment')->upload(file_get_contents('example.png'), [
457+
'filename' => 'example.png',
458+
]);
459+
$client->getApi('attachment')->update($attachmentId, [
460+
'filename' => 'example.png',
461+
]);
459462

460463
$file_content = $client->getApi('attachment')->download($attachmentId);
461464
file_put_contents('example.png', $file_content);
465+
466+
$client->getApi('attachment')->remove($attachmentId);
462467
```
463468

464469
#### News API
@@ -472,8 +477,8 @@ $client->getApi('news')->listByProject('test');
472477

473478
```php
474479
$client->getApi('role')->list();
480+
$client->getApi('role')->listNames();
475481
$client->getApi('role')->show(1);
476-
$client->getApi('role')->listing();
477482
```
478483

479484
#### Query API
@@ -530,21 +535,26 @@ $client->getApi('time_entry')->remove($timeEntryId);
530535

531536
```php
532537
$client->getApi('time_entry_activity')->list();
538+
$client->getApi('time_entry_activity')->listNames();
533539
```
534540

535541
#### IssueRelation API
536542

537543
```php
538544
$client->getApi('issue_relation')->listByIssueId($issueId);
539545
$client->getApi('issue_relation')->show($issueRelationId);
546+
$client->getApi('issue_relation')->create($issueId, [
547+
'relation_type' => 'relates',
548+
'issue_to_id' => $issueToId,
549+
]);
540550
$client->getApi('issue_relation')->remove($issueRelationId);
541551
```
542552

543553
#### Group of members API
544554

545555
```php
546556
$client->getApi('group')->list();
547-
$client->getApi('group')->listing();
557+
$client->getApi('group')->listNames();
548558
$client->getApi('group')->show($groupId, ['include' => 'users,memberships']);
549559
$client->getApi('group')->remove($groupId);
550560
$client->getApi('group')->addUser($groupId, $userId);
@@ -582,7 +592,12 @@ $client->getApi('membership')->create($projectId, [
582592
'user_id' => 1,
583593
'role_ids' => [5],
584594
]);
595+
$client->getApi('membership')->update($membershipId, [
596+
'user_id' => 1,
597+
'role_ids' => [5],
598+
]);
585599
$client->getApi('membership')->remove($membershipId);
600+
$client->getApi('membership')->removeMember($projectId, $userId);
586601
```
587602

588603
#### IssuePriority API
@@ -613,13 +628,16 @@ $client->getApi('wiki')->remove('testProject', 'about');
613628
#### Search API
614629

615630
```php
616-
// ----------------------------
617-
// Search
618-
$client->getApi('search')->search('Myproject', ['limit' => 100]);
631+
$client->getApi('search')->listByQuery('search query', ['limit' => 100]);
619632
```
620633

621634
#### CustomField API
622635

636+
```php
637+
$client->getApi('custom_field')->list();
638+
$client->getApi('custom_field')->listNames();
639+
```
640+
623641
#### API entry points implementation state:
624642

625643
* :heavy_check_mark: Attachments

0 commit comments

Comments
 (0)