- 
                Notifications
    You must be signed in to change notification settings 
- Fork 151
Description
I was working with pushing file changes to bitbucket and noticed that go-bitbucket only has one method for this - WriteFileBlob() - which requires a real file to send the request. However, Bitbucket API also supports URL-encoded format to send raw content without creating temporary files (which is useful when you don't have actual files, as in my case).
Current Workaround
Currently, to send raw content, you need to:
- Create a temporary file.
- Write content to it.
- Use WriteFileBlob().
- Clean up the temporary file.
This is inefficient and unnecessary when you already have raw content in memory.
Proposed Solution
The Bitbucket API supports URL-encoded format for sending raw content directly:
$ curl https://api.bitbucket.org/2.0/repositories/atlassian/bbql/src \
  --data-urlencode "/path/to/me.txt=Lorem ipsum." \
  --data-urlencode "message=Initial commit" \
  --data-urlencode "author=Erik van Zijst <[email protected]>"I've tested this via curl and it works well.
Suggestions:
Add a new method like WriteFileContent() or WriteFileRawContent() that accepts raw content as a parameter.
Alternative: Extend the existing WriteFileBlob() method to support both file paths and raw content.
Also WriteFileBlob() method currently has no documentation or test coverage, which makes it harder to discover and use correctly.
Thanks again for maintaining this project!