Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace listing() methods with consistent solution #338

Closed
10 tasks done
Art4 opened this issue Dec 21, 2023 · 1 comment
Closed
10 tasks done

Replace listing() methods with consistent solution #338

Art4 opened this issue Dec 21, 2023 · 1 comment
Assignees
Milestone

Comments

@Art4
Copy link
Collaborator

Art4 commented Dec 21, 2023

The listing() methods returns an array as name => id or id => name. These methods are inconsistent implemented and are based on a cache filled up by a previous call of list() what can be confusing.

We have to find a consistent solution for this problem.

Todo

@Art4 Art4 added enhancement pending: help wanted help and PRs are welcome labels Dec 21, 2023
@Art4 Art4 changed the title Replace listing() methods with consistent solution Replace listing() methods with consistent solution Jan 3, 2024
@Art4
Copy link
Collaborator Author

Art4 commented Jan 19, 2024

Proposal

I've looked into every Api class and would like to propose replacing all listing() methods with methods like listNames(): array, listNamesByProject(): array and listLogins(): array. The response should be always an array with the int ids as keys and the names as value. This methods will be the base for a future replacement or drop of the getIdByName() methods. The nomenclature will allow us to add further methods such as Project::listIdentifiers() or User::listEmails() in the future.

The $reverse argument was introduced because of name collisions and can be dropped. The result will always have the int IDs as array key, so collisions should be avoided.

The $params argument to filter the entries will no longer supported. Instead all entries should be loaded by using multiple requests with 'limit' => 100 if necessary. The result will be cached in the api class in a special property, separated from the properties using by the all() methods.

The $forceUpdate argument can be dropped as well, because "deleting the cache" could be realized by dropping and reinstantiate the api class.

All in all, it looks like this:

mid-level API listing() arguments listing() returns replacement
Attachment - - -
CustomField $forceUpdate, $params ['name' => id] listNames(): [id => 'name']
Group $forceUpdate ['name' => id] listNames(): [id => 'name']
Issue - - -
IssueCategory $projectIdentifier, $forceUpdate ['name' => id] listNamesByProject($projectIdentifier): [id => 'name']
IssuePriority - - -
IssueRelation - - -
IssueStatus $forceUpdate ['name' => id] listNames(): [id => 'name']
Membership - - -
News - - -
Project $forceUpdate, $reverse, $params [id => 'name'], ['name' => id] listNames(): [id => 'name']
Query - - -
Role $forceUpdate ['name' => id] listNames(): [id => 'name']
Search - - -
TimeEntry - - -
TimeEntryActivity $forceUpdate ['name' => id] listNames(): [id => 'name']
Tracker $forceUpdate ['name' => id] listNames(): [id => 'name']
User $forceUpdate, $params ['login' => id] listLogins(): [id => 'login']
Version $projectIdentifier, $forceUpdate, $reverse, $params [id => 'name'], ['name' => id] listNamesByProject($projectIdentifier): [id => 'name']
Wiki - - -

@Art4 Art4 added this to the v2.6.0 milestone Jan 19, 2024
@Art4 Art4 modified the milestones: v2.6.0, v2.7.0 Feb 16, 2024
@Art4 Art4 self-assigned this Mar 25, 2024
@Art4 Art4 removed the pending: help wanted help and PRs are welcome label Mar 25, 2024
@Art4 Art4 added the pending: help wanted help and PRs are welcome label Apr 9, 2024
@Art4 Art4 removed the pending: help wanted help and PRs are welcome label Jul 5, 2024
@Art4 Art4 closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant