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

Close #53 - Add PUT multipart support #54

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

g0tmi1k
Copy link
Contributor

@g0tmi1k g0tmi1k commented Jan 2, 2023

To use GitLab's API v4, in order to change a project's avatar, the request needs to be submitted via PUT with Content-Type: multipart/form-data header.

REF: https://docs.gitlab.com/ee/api/projects.html#upload-a-project-avatar


  • Opt'd not to include content-type: in the request, in order to reduce the amount of libraries needed
    • This logic should be done on the server side to validate the request
  • Opt'd to use sub edit_project, rather than making its a new one (to keep the naming convention)
  • Re-used as much logic which was already there as there was support already already upload a single file (just via a different method)
    • Upon uploading a file, it would replace any other content being submitted (aka the JSON)
    • Which is why _call_rest_client happens twice

@g0tmi1k
Copy link
Contributor Author

g0tmi1k commented Jan 3, 2023

devscripts's salsa support ~ https://salsa.debian.org/debian/devscripts/-/merge_requests/311

Using GitLab's API v4, it is possible to change a project's avatar.
However the request needs to be submitted via PUT with `Content-Type: multipart/form-data` header set.

REF: https://docs.gitlab.com/ee/api/projects.html#upload-a-project-avatar
@g0tmi1k
Copy link
Contributor Author

g0tmi1k commented Jan 23, 2023

Split edit_project -> edit_project_multipart

$ perl generate.pl > ../lib/GitLab/API/v4.pm

To me, this doesn't align with the function naming convention, but I couldn't see an elegant way of handling it with generate.pl

@g0tmi1k
Copy link
Contributor Author

g0tmi1k commented Jan 23, 2023

$ perl generate.pl > ../lib/GitLab/API/v4.pm

To me, this doesn't align with the function naming convention,
but I couldn't see an elegant way of handling it with generate.pl
@bluefeet
Copy link
Owner

bluefeet commented Jun 7, 2023

Sorry for very late reply to this. I'm going to have to review this a bit closer since this is not a straightforward change. For now going to get all the other queued up PRs out then I'll address this one last PR and the open issues for a potential future release in the coming days.

@g0tmi1k
Copy link
Contributor Author

g0tmi1k commented Jul 25, 2023

Thanks for getting back to me @bluefeet - all good and I totally understand!

Is there anything I can do to help?

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

Successfully merging this pull request may close these issues.

None yet

2 participants