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

API client: refactoring #42

Closed
cdboer opened this issue May 9, 2021 · 1 comment · Fixed by #55
Closed

API client: refactoring #42

cdboer opened this issue May 9, 2021 · 1 comment · Fixed by #55
Assignees
Labels
refactoring Code refactorings.
Milestone

Comments

@cdboer
Copy link
Collaborator

cdboer commented May 9, 2021

No description provided.

@onyame onyame added the refactoring Code refactorings. label May 14, 2021
@cdboer cdboer added this to the 0.5 milestone May 16, 2021
cdboer added a commit that referenced this issue May 16, 2021
Rename GitlabAPIClient to GitlabClient
Export URL building into its own method in GitlabClient
Rework URL building, splitting path and query building into their own methods
Rename alru_cache to just cache as it does not represent an asynchronous least recently used cache and is used as a "one time store" cache
Add the ability to change the project path of the GitlabClient without having to reinstantiate the URLBuilder
Rely on the group_by function to sort results added to gitlab2prov/utils/__init__.py
cdboer added a commit that referenced this issue May 16, 2021
The group_by function is used to match page results back to their appropriate request url's.

It is also used to regroup request results such as issue note awards.
For example: The GitlabClient is supposed to return a list of issue note awards for each issue of a project, but it can only request a list of awards for each issue note. To regroup the awards such that there is a list of awards for each issue and not for each issue note, one can use the group_by function and pass a group_size_index that reflects how many issue notes there are on each inbdividual issue.
cdboer added a commit that referenced this issue May 16, 2021
cdboer added a commit that referenced this issue May 16, 2021
Rewrite of RequestHandler:

Requests are now queued on demand.
Added pagination fallback to the key 'x-next-page' to not solely rely on 'x-total-pages'.
Add initial exception system, see TODO notes. Exceptions are supposed to be handled in the GitlabClient methods.
@onyame onyame modified the milestones: 0.5, 0.6 May 17, 2021
cdboer added a commit that referenced this issue May 27, 2021
Makes it more obvious that the request queue does not hold request urls but rather request coroutines that have to be awaited to be executed. The queued coroutines are awaited in a asyncio.gather statement.
@cdboer
Copy link
Collaborator Author

cdboer commented Feb 13, 2022

Issue will be closed, when v1.0 is merged into main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Code refactorings.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants