Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 5047b8b

Browse files
SynapticloopSynapticloop
authored andcommitted
added in minimumPartSize
1 parent 6487cf3 commit 5047b8b

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

src/main/java/synapticloop/b2/response/B2AuthorizeAccountResponse.java

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class B2AuthorizeAccountResponse extends BaseB2Response {
4444
private final String apiUrl;
4545
private final String authorizationToken;
4646
private final String downloadUrl;
47-
47+
private final int minimumPartSize;
4848
/**
4949
* Instantiate an authorize account response with the JSON response as a
5050
* string from the API call. This response is then parsed into the
@@ -61,6 +61,7 @@ public B2AuthorizeAccountResponse(String json) throws B2ApiException {
6161
this.apiUrl = this.readString(B2ResponseProperties.KEY_API_URL);
6262
this.authorizationToken = this.readString(B2ResponseProperties.KEY_AUTHORIZATION_TOKEN);
6363
this.downloadUrl = this.readString(B2ResponseProperties.KEY_DOWNLOAD_URL);
64+
this.minimumPartSize = this.readInt(B2ResponseProperties.KEY_MINIMUM_PART_SIZE);
6465

6566
this.warnOnMissedKeys(LOGGER);
6667
}
@@ -95,13 +96,31 @@ public B2AuthorizeAccountResponse(String json) throws B2ApiException {
9596
*/
9697
public String getDownloadUrl() { return this.downloadUrl; }
9798

99+
/**
100+
* The minimum size for each part of a large file (except the last one). This
101+
* will always be 100,000,000, but we recommend that you write your code to
102+
* get the number here, rather than use a hard-coded constant.
103+
*
104+
* @return the minimum part size for downloads
105+
*/
106+
public int getMinimumPartSize() {return this.minimumPartSize; }
107+
98108
@Override
99109
public String toString() {
100-
final StringBuilder sb = new StringBuilder("B2AuthorizeAccountResponse{");
101-
sb.append("accountId='").append(accountId).append('\'');
102-
sb.append(", apiUrl='").append(apiUrl).append('\'');
103-
sb.append(", downloadUrl='").append(downloadUrl).append('\'');
104-
sb.append('}');
105-
return sb.toString();
110+
StringBuilder stringBuilder = new StringBuilder();
111+
stringBuilder.append("B2AuthorizeAccountResponse [accountId=");
112+
stringBuilder.append(this.accountId);
113+
stringBuilder.append(", apiUrl=");
114+
stringBuilder.append(this.apiUrl);
115+
stringBuilder.append(", authorizationToken=");
116+
stringBuilder.append(this.authorizationToken);
117+
stringBuilder.append(", downloadUrl=");
118+
stringBuilder.append(this.downloadUrl);
119+
stringBuilder.append(", minimumPartSize=");
120+
stringBuilder.append(this.minimumPartSize);
121+
stringBuilder.append("]");
122+
return stringBuilder.toString();
106123
}
124+
125+
107126
}

src/main/java/synapticloop/b2/response/B2ResponseProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,5 @@ public final class B2ResponseProperties {
4040
public static final String KEY_BUCKETS = "buckets";
4141
public static final String KEY_UPLOAD_AUTH_TOKEN = "uploadAuthToken";
4242
public static final String KEY_UPLOAD_URLS = "uploadUrls";
43+
public static final String KEY_MINIMUM_PART_SIZE = "minimumPartSize";
4344
}

0 commit comments

Comments
 (0)