JCLOUDS-1452: Add new v2 fields

Some of these only give consistency with similar requests.
This commit is contained in:
Andrew Gaul 2018-09-28 13:55:10 -07:00
parent a0f496e5ec
commit 9524383e49
10 changed files with 41 additions and 12 deletions

View File

@ -19,6 +19,7 @@ package org.jclouds.b2.domain;
import com.google.common.base.CaseFormat;
public enum Action {
START,
FOLDER,
UPLOAD,
HIDE;

View File

@ -39,6 +39,8 @@ public abstract class B2ObjectList {
@AutoValue
public abstract static class Entry {
public abstract Action action();
public abstract String accountId();
public abstract String bucketId();
@Nullable public abstract String fileId();
public abstract String fileName();
public abstract long contentLength();
@ -48,9 +50,9 @@ public abstract class B2ObjectList {
}
public abstract Date uploadTimestamp();
@SerializedNames({"action", "fileId", "fileName", "contentLength", "uploadTimestamp"})
public static Entry create(Action action, @Nullable String fileId, String fileName, long contentLength, long uploadTimestamp) {
return new AutoValue_B2ObjectList_Entry(action, fileId, fileName, contentLength, new Date(uploadTimestamp));
@SerializedNames({"action", "accountId", "bucketId", "fileId", "fileName", "contentLength", "uploadTimestamp"})
public static Entry create(Action action, String accountId, String bucketId, @Nullable String fileId, String fileName, long contentLength, long uploadTimestamp) {
return new AutoValue_B2ObjectList_Entry(action, accountId, bucketId, fileId, fileName, contentLength, new Date(uploadTimestamp));
}
}
}

View File

@ -26,12 +26,14 @@ import com.google.auto.value.AutoValue;
public abstract class HideFileResponse {
/** Always "hide". */
public abstract Action action();
public abstract String accountId();
public abstract String bucketId();
public abstract String fileId();
public abstract String fileName();
public abstract Date uploadTimestamp();
@SerializedNames({"action", "fileId", "fileName", "uploadTimestamp"})
public static HideFileResponse create(Action action, String fileId, String fileName, long uploadTimestamp) {
return new AutoValue_HideFileResponse(action, fileId, fileName, new Date(uploadTimestamp));
@SerializedNames({"action", "accountId", "bucketId", "fileId", "fileName", "uploadTimestamp"})
public static HideFileResponse create(Action action, String accountId, String bucketId, String fileId, String fileName, long uploadTimestamp) {
return new AutoValue_HideFileResponse(action, accountId, bucketId, fileId, fileName, new Date(uploadTimestamp));
}
}

View File

@ -40,16 +40,22 @@ public abstract class ListUnfinishedLargeFilesResponse {
@AutoValue
public abstract static class Entry {
public abstract String accountId();
/** Always "upload". */
public abstract Action action();
public abstract String bucketId();
/** Always null. */
@Nullable public abstract Long contentLength();
/** Always null. */
@Nullable public abstract String contentSha1();
public abstract String contentType();
public abstract String fileId();
public abstract Map<String, String> fileInfo();
public abstract String fileName();
public abstract Date uploadTimestamp();
@SerializedNames({"accountId", "bucketId", "contentType", "fileId", "fileInfo", "fileName", "uploadTimestamp"})
public static Entry create(String accountId, String bucketId, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) {
return new AutoValue_ListUnfinishedLargeFilesResponse_Entry(accountId, bucketId, contentType, fileId, ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp));
@SerializedNames({"accountId", "action", "bucketId", "contentLength", "contentSha1", "contentType", "fileId", "fileInfo", "fileName", "uploadTimestamp"})
public static Entry create(String accountId, Action action, String bucketId, @Nullable Long contentLength, @Nullable String contentSha1, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) {
return new AutoValue_ListUnfinishedLargeFilesResponse_Entry(accountId, action, bucketId, contentLength, contentSha1, contentType, fileId, ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp));
}
}
}

View File

@ -26,6 +26,8 @@ import com.google.common.collect.ImmutableMap;
@AutoValue
public abstract class MultipartUploadResponse {
/** Always "upload". */
public abstract Action action();
public abstract String accountId();
public abstract String bucketId();
public abstract String contentType();
@ -34,8 +36,8 @@ public abstract class MultipartUploadResponse {
public abstract String fileName();
public abstract Date uploadTimestamp();
@SerializedNames({"accountId", "bucketId", "contentType", "fileId", "fileInfo", "fileName", "uploadTimestamp"})
public static MultipartUploadResponse create(String accountId, String bucketId, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) {
return new AutoValue_MultipartUploadResponse(accountId, bucketId, contentType, fileId, ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp));
@SerializedNames({"action", "accountId", "bucketId", "contentType", "fileId", "fileInfo", "fileName", "uploadTimestamp"})
public static MultipartUploadResponse create(Action action, String accountId, String bucketId, String contentType, String fileId, Map<String, String> fileInfo, String fileName, long uploadTimestamp) {
return new AutoValue_MultipartUploadResponse(action, accountId, bucketId, contentType, fileId, ImmutableMap.copyOf(fileInfo), fileName, new Date(uploadTimestamp));
}
}

View File

@ -1,5 +1,7 @@
{
"action" : "hide",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId" : "4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104",
"fileName" : "typing_test.txt",
"uploadTimestamp" : 1437815673000

View File

@ -2,6 +2,8 @@
"files": [
{
"action": "upload",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6b_d20150809_m012853_c100_v0009990_t0000",
"fileName": "files/hello.txt",
"contentLength": 6,
@ -9,6 +11,8 @@
},
{
"action": "upload",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId": "4_z27c88f1d182b150646ff0b16_f1004ba650fe24e6c_d20150809_m012854_c100_v0009990_t0000",
"fileName": "files/world.txt",
"contentLength": 6,

View File

@ -2,6 +2,8 @@
"files": [
{
"action": "upload",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886245_d20150809_m232316_c100_v0009990_t0003",
"fileName": "files/hello.txt",
"contentLength": 6,
@ -9,6 +11,8 @@
},
{
"action": "hide",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886247_d20150809_m232323_c100_v0009990_t0005",
"fileName": "files/world.txt",
"contentLength": 0,
@ -16,6 +20,8 @@
},
{
"action": "upload",
"accountId" : "d522aa47a10f",
"bucketId" : "4a48fe8875c6214145260818",
"fileId": "4_z27c88f1d182b150646ff0b16_f100920ddab886246_d20150809_m232316_c100_v0009990_t0003",
"fileName": "files/world.txt",
"contentLength": 6,

View File

@ -1,4 +1,5 @@
{
"action": "upload",
"files": [
{
"accountId": "YOUR_ACCOUNT_ID",

View File

@ -1,6 +1,9 @@
{
"action": "upload",
"accountId": "YOUR_ACCOUNT_ID",
"bucketId": "e73ede9c9c8412db49f60715",
"contentLength": null,
"contentSha1": null,
"contentType": "b2/x-auto",
"fileId": "4_za71f544e781e6891531b001a_f200ec353a2184825_d20160409_m004829_c000_v0001016_t0028",
"fileInfo": {