JetBrains / plugin-repository-rest-client

Apache License 2.0
21 stars 15 forks source link

Support uploading screenshots #10

Open shiraji opened 7 years ago

shiraji commented 7 years ago

Hi,

This might be wrong place to open this issue, but I'm not sure here or https://github.com/JetBrains/gradle-intellij-plugin for this issue.

I want to upload screenshots of the plugins using gradle-intellij-plugin.

What I did

I add a method for uploading screenshots

    @Multipart
    @POST("/plugin/uploadScreenshot")
    fun uploadScreenshot(@Part("userName") username: TypedString, @Part("password") password: TypedString,
                         @Part("pluginId") pluginId: TypedString, @Part("channel") channel: TypedString?,
                         @Part("file") file: TypedFile): Response // I don't think parameter name `file` is correct. It should be `files[0]`

This gave me 400 error saying Parameter csrfToken must be defined.

Here is the source code. https://github.com/shiraji/plugin-repository-rest-client/tree/upload_screenshots

Question

Could you tell me how I can upload screenshots without csrf token? like what uploading plugin module did.

Thanks in advance.

mikhailvink commented 7 years ago

Hi,

Uploading screenshots without the CSRF token via the REST API is not possible at this moment and will require some implementation from our side which we are ready to make, but the question is - what behavior would you expect from uploadScreenshot if there are existing screenshots for the plugin? Options are: remove all current screenshots and upload new ones; add new screenshots to existing ones; replace existing if the name is the same + upload new ones; some other scenario?

Thanks!

shiraji commented 7 years ago

Either way is fine (if you guys give us a doc 😉 ). If it's possible, I would like to have 2 features.