Skip to content

Conversation

@danielrs
Copy link
Contributor

Adds the ability to create forks and fixes the "is_private" parameter (it's supposed to be boolean and not a string).

Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you contribution. And I left some comments. Would you see these? @danielrs

go.mod Outdated

require (
github.com/golang/protobuf v1.0.0
github.com/golang/protobuf v1.0.0 // indirect
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you remove the line if it is not a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it

//}
if ro.IsPrivate != "" {
body["is_private"] = ro.IsPrivate
body["is_private"] = strings.ToLower(strings.TrimSpace(ro.IsPrivate)) != "false"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the below was the right one, and do you think?

Suggested change
body["is_private"] = strings.ToLower(strings.TrimSpace(ro.IsPrivate)) != "false"
body["is_private"] = strings.ToLower(strings.TrimSpace(ro.IsPrivate))

Copy link
Contributor Author

@danielrs danielrs Jul 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktrysmt Bitbucket expects a boolean value in the payload for the is_private field. If you try and submit a request with the previous code you get the error:

{"type": "error", "error": {"fields": {"is_private": "expected bool"}, "message": "Bad request"}}

The new condition of != makes the value a real boolean, which is what Bitbucket expects. Check the schema here.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
I understood that is_private: boolean is detected at the site.

Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! LGTM.

//}
if ro.IsPrivate != "" {
body["is_private"] = ro.IsPrivate
body["is_private"] = strings.ToLower(strings.TrimSpace(ro.IsPrivate)) != "false"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see.
I understood that is_private: boolean is detected at the site.

@ktrysmt ktrysmt merged commit c020169 into ktrysmt:master Jul 18, 2020
@ktrysmt
Copy link
Owner

ktrysmt commented Jul 18, 2020

Please see the new release at https://github.com/ktrysmt/go-bitbucket/releases/tag/v0.6.2
Thank you @danielrs .

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.

2 participants