Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Oct 11, 2023
1 parent 62e54a3 commit 151d20e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ You can now use the `getApi()` method to create and get a specific Redmine API.
```php
<?php

$client->getApi('user')->all();
$client->getApi('user')->list();
$client->getApi('user')->listing();

$client->getApi('issue')->create([
Expand All @@ -319,7 +319,7 @@ $client->getApi('issue')->create([
'description' => 'a long description blablabla',
'assigned_to_id' => 123, // or 'assigned_to' => 'user1' OR 'groupXX'
]);
$client->getApi('issue')->all([
$client->getApi('issue')->list([
'limit' => 1000
]);
```
Expand Down
58 changes: 29 additions & 29 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,19 @@ To check for failed requests you can afterwards check the status code via `$clie
```php
// ----------------------------
// Trackers
$client->getApi('tracker')->all();
$client->getApi('tracker')->list();
$client->getApi('tracker')->listing();

// ----------------------------
// Issue statuses
$client->getApi('issue_status')->all();
$client->getApi('issue_status')->list();
$client->getApi('issue_status')->listing();
$client->getApi('issue_status')->getIdByName('New');

// ----------------------------
// Project
$client->getApi('project')->all();
$client->getApi('project')->all([
$client->getApi('project')->list();
$client->getApi('project')->list([
'limit' => 10,
]);
$client->getApi('project')->listing();
Expand All @@ -257,7 +257,7 @@ $client->getApi('project')->remove($projectId);

// ----------------------------
// Users
$client->getApi('user')->all();
$client->getApi('user')->list();
$client->getApi('user')->listing();
$client->getApi('user')->getCurrentUser([
'include' => [
Expand Down Expand Up @@ -290,15 +290,15 @@ $client->getApi('user')->create([
// ----------------------------
// Issues
$client->getApi('issue')->show($issueId);
$client->getApi('issue')->all([
$client->getApi('issue')->list([
'limit' => 100,
]);
$client->getApi('issue')->all(['category_id' => $categoryId]);
$client->getApi('issue')->all(['tracker_id' => $trackerId]);
$client->getApi('issue')->all(['status_id' => 'closed']);
$client->getApi('issue')->all(['assigned_to_id' => $userId]);
$client->getApi('issue')->all(['project_id' => 'test']);
$client->getApi('issue')->all([
$client->getApi('issue')->list(['category_id' => $categoryId]);
$client->getApi('issue')->list(['tracker_id' => $trackerId]);
$client->getApi('issue')->list(['status_id' => 'closed']);
$client->getApi('issue')->list(['assigned_to_id' => $userId]);
$client->getApi('issue')->list(['project_id' => 'test']);
$client->getApi('issue')->list([
'offset' => 100,
'limit' => 100,
'sort' => 'id',
Expand Down Expand Up @@ -375,7 +375,7 @@ $client->getApi('issue')->create([

// ----------------------------
// Issue categories
$client->getApi('issue_category')->all('project1');
$client->getApi('issue_category')->listByProject('project1');
$client->getApi('issue_category')->listing($projectId);
$client->getApi('issue_category')->show($categoryId);
$client->getApi('issue_category')->getIdByName($projectId, 'Administration');
Expand All @@ -392,7 +392,7 @@ $client->getApi('issue_category')->remove($categoryId, [

// ----------------------------
// Versions
$client->getApi('version')->all('test');
$client->getApi('version')->listByProject('test');
$client->getApi('version')->listing('test');
$client->getApi('version')->show($versionId);
$client->getApi('version')->getIdByName('test', 'v2');
Expand All @@ -413,24 +413,24 @@ file_put_contents('example.png', $file_content);

// ----------------------------
// News
$client->getApi('news')->all('test');
$client->getApi('news')->all();
$client->getApi('news')->list();
$client->getApi('news')->listByProject('test');

// ----------------------------
// Roles
$client->getApi('role')->all();
$client->getApi('role')->list();
$client->getApi('role')->show(1);
$client->getApi('role')->listing();

// ----------------------------
// Queries
$client->getApi('query')->all();
$client->getApi('query')->list();

// ----------------------------
// Time entries
$client->getApi('time_entry')->all();
$client->getApi('time_entry')->list();
$client->getApi('time_entry')->show($timeEntryId);
$client->getApi('time_entry')->all([
$client->getApi('time_entry')->list([
'issue_id' => 1234,
'project_id' => 1234,
'spent_on' => '2015-04-13',
Expand Down Expand Up @@ -470,17 +470,17 @@ $client->getApi('time_entry')->remove($timeEntryId);

// ----------------------------
// Time entry activities
$client->getApi('time_entry_activity')->all();
$client->getApi('time_entry_activity')->list();

// ----------------------------
// Issue relations
$client->getApi('issue_relation')->all($issueId);
$client->getApi('issue_relation')->listByIssueId($issueId);
$client->getApi('issue_relation')->show($issueRelationId);
$client->getApi('issue_relation')->remove($issueRelationId);

// ----------------------------
// Group (of members)
$client->getApi('group')->all();
$client->getApi('group')->list();
$client->getApi('group')->listing();
$client->getApi('group')->show($groupId, ['include' => 'users,memberships']);
$client->getApi('group')->remove($groupId);
Expand All @@ -493,7 +493,7 @@ $client->getApi('group')->create([

// ----------------------------
// Project memberships
$client->getApi('membership')->all($projectId);
$client->getApi('membership')->listByProject($projectId);
$client->getApi('membership')->create($projectId, [
'user_id' => null,
'role_ids' => [],
Expand All @@ -502,11 +502,11 @@ $client->getApi('membership')->remove($membershipId);

// ----------------------------
// Issue priorities
$client->getApi('issue_priority')->all();
$client->getApi('issue_priority')->list();

// ----------------------------
// Wiki
$client->getApi('wiki')->all('testProject');
$client->getApi('wiki')->listByProject('testProject');
$client->getApi('wiki')->show('testProject', 'about');
$client->getApi('wiki')->show('testProject', 'about', $version);
$client->getApi('wiki')->create('testProject', 'about', [
Expand All @@ -523,19 +523,19 @@ $client->getApi('wiki')->remove('testProject', 'about');

// ----------------------------
// Issues' stats (see https://github.com/kbsali/php-redmine-api/issues/44)
$issues['all'] = $client->getApi('issue')->all([
$issues['all'] = $client->getApi('issue')->list([
'limit' => 1,
'tracker_id' => 1,
'status_id' => '*',
])['total_count'];

$issues['opened'] = $client->getApi('issue')->all([
$issues['opened'] = $client->getApi('issue')->list([
'limit' => 1,
'tracker_id' => 1,
'status_id' => 'open',
])['total_count'];

$issues['closed'] = $client->getApi('issue')->all([
$issues['closed'] = $client->getApi('issue')->list([
'limit' => 1,
'tracker_id' => 1,
'status_id' => 'closed',
Expand Down
2 changes: 1 addition & 1 deletion src/Redmine/Api/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function all(array $params = [])
public function listing($forceUpdate = false, array $params = [])
{
if (empty($this->users) || $forceUpdate) {
$this->all($params);
$this->list($params);
}
$ret = [];
if (is_array($this->users) && isset($this->users['users'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Redmine/Api/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function all($project, array $params = [])
public function listing($project, $forceUpdate = false, $reverse = true, array $params = [])
{
if (true === $forceUpdate || empty($this->versions)) {
$this->all($project, $params);
$this->listByProject($project, $params);
}
$ret = [];
foreach ($this->versions['versions'] as $e) {
Expand Down

0 comments on commit 151d20e

Please sign in to comment.