2323 */
2424package com .cloudbees .jenkins .plugins .bitbucket .api ;
2525
26+ import com .cloudbees .jenkins .plugins .bitbucket .impl .util .JsonParser ;
2627import edu .umd .cs .findbugs .annotations .CheckForNull ;
2728import edu .umd .cs .findbugs .annotations .NonNull ;
2829import java .io .IOException ;
@@ -60,7 +61,11 @@ public interface BitbucketAuthenticatedClient extends AutoCloseable {
6061 * @return the JSON string of the response
6162 * @throws IOException in case of connection failures
6263 */
63- String post (@ NonNull String path , @ CheckForNull String payload ) throws IOException ;
64+ String post (@ NonNull String path , @ NonNull String payload ) throws IOException ;
65+
66+ default String post (@ NonNull String path , @ NonNull Object payload ) throws IOException {
67+ return post (path , JsonParser .toString (payload ));
68+ }
6469
6570 /**
6671 * Perform an HTTP PUT to the configured endpoint.
@@ -72,7 +77,11 @@ public interface BitbucketAuthenticatedClient extends AutoCloseable {
7277 * @return the JSON string of the response
7378 * @throws IOException in case of connection failures
7479 */
75- String put (@ NonNull String path , @ CheckForNull String payload ) throws IOException ;
80+ String put (@ NonNull String path , @ NonNull String payload ) throws IOException ;
81+
82+ default String put (@ NonNull String path , @ NonNull Object payload ) throws IOException {
83+ return put (path , JsonParser .toString (payload ));
84+ }
7685
7786 /**
7887 * Perform an HTTP DELETE to the configured endpoint.
0 commit comments