gitlabr icon indicating copy to clipboard operation
gitlabr copied to clipboard

Incorrect behaviour of gl_list_projects return projects by their ID?

Open RPanczak opened this issue 1 year ago • 2 comments

Hi @statnmap

Many thanks for great package!

I came across unusual behavior. I'm trying to retrieve information using gl_list_projects() function

I try to return inkscape as example that has Project ID: 3472737

Neither of the calls gets me anything useful, ie they all return default (?) 200 results:

gl_list_projects(project = "3472737")
gl_list_projects(id = "3472737")
gl_list_projects(project_id = "3472737")

Is there any way around it?

My sessionInfo():

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.7 (Ootpa)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] gitlabr_2.0.1.9000           knitr_1.43                   stringr_1.5.0               
[4] dplyr_1.1.2                  reprotools_0.0.4.45588.23765 pacman_0.5.1                

loaded via a namespace (and not attached):
 [1] pillar_1.9.0     compiler_4.2.1   arpr_0.1.2       base64enc_0.1-3  tools_4.2.1     
 [6] import_1.3.0     jsonlite_1.8.5   lubridate_1.9.2  lifecycle_1.0.3  tibble_3.2.1    
[11] timechange_0.2.0 pkgconfig_2.0.3  rlang_1.1.1      cli_3.6.1        rstudioapi_0.14 
[16] curl_5.0.1       yaml_2.3.7       xfun_0.39        withr_2.5.0      httr_1.4.6      
[21] generics_0.1.3   vctrs_0.6.3      sjmisc_2.8.9     sjlabelled_1.2.0 tidyselect_1.2.0
[26] glue_1.6.2       R6_2.5.1         fansi_1.0.4      purrr_1.0.1      tidyr_1.3.0     
[31] magrittr_2.0.3   insight_0.19.2   renv_0.17.3      utf8_1.2.3       stringi_1.7.12  

RPanczak avatar Jun 28 '23 15:06 RPanczak

Hi, gl_list_projects() does not take any kind of 'id' as input. It only downloads all projects you have access to. And you can decide whether you want all your projects, or all open projects at all.
I assume that what you are looking for is gl_get_project(project = "3472737") (without an s) to get general information of a unique project.

The documentation does not clearly state this use: https://thinkr-open.github.io/gitlabr/reference/gl_list_projects.html
I guess the details part could explain the differences between gl_get_project(project, ...) and the others. I regularly try to improve the documentation while I use the functions myself...

If you want to participate in improving this part of the documentation, a PR would be highly welcome. Would you like to try ? I'll guide you when needed. Thanks.

statnmap avatar Jun 28 '23 19:06 statnmap

Thanks Sébastien!

Ah, all clear now! Looking at it once again I have to admit it was more my mistake than the docs fault ;)

I could try to write something more detailed in the docs - I presume that would require tinkering with description of functions here right? https://github.com/ThinkR-open/gitlabr/blob/main/R/projects_and_repos.R

RPanczak avatar Jul 12 '23 19:07 RPanczak

Documentation is now updated, and messages are added to make it clearer for users. image

statnmap avatar May 15 '24 10:05 statnmap