Skip to content

Commit 68679c0

Browse files
author
liora
committed
add publish rest api that wait for the maximum timeout allowed
1 parent 28c7270 commit 68679c0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

api/src/main/java/com/jfrog/bintray/client/api/handle/VersionHandle.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public interface VersionHandle extends Handle<Version> {
4040

4141
VersionHandle publish() throws BintrayCallException;
4242

43+
VersionHandle publishSync() throws BintrayCallException
44+
4345
VersionHandle discard() throws BintrayCallException;
4446

4547
VersionHandle sign(String passphrase, int fileCount) throws BintrayCallException;

impl/src/main/java/com/jfrog/bintray/client/impl/handle/VersionHandleImpl.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ public VersionHandle publish() throws BintrayCallException {
153153
return this;
154154
}
155155

156+
157+
@Override
158+
public VersionHandle publishSync() throws BintrayCallException {
159+
Map<String, String> headers = new HashMap<>();
160+
BintrayImpl.addContentTypeJsonHeader(headers);
161+
int timeout = -1;
162+
String wait = "{\n\"publish_wait_for_secs\":" + timeout + "\n}";
163+
bintrayHandle.post(getCurrentVersionContentUri() + API_PUBLISH, null, IOUtils.toInputStream(wait));
164+
return this;
165+
}
166+
156167
@Override
157168
public VersionHandle discard() throws BintrayCallException {
158169
Map<String, String> headers = new HashMap<>();

0 commit comments

Comments
 (0)