Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 66 additions & 20 deletions core/api/core.api

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -274,130 +274,4 @@ public ListFolderResult listFolderContinue(String cursor) throws ListFolderConti
ListFolderContinueArg _arg = new ListFolderContinueArg(cursor);
return listFolderContinue(_arg);
}

//
// route 2/files/search_v2
//

/**
* Searches for files and folders. Note: {@link
* DbxAppFilesRequests#searchV2(String)} along with {@link
* DbxAppFilesRequests#searchContinueV2(String)} can only be used to
* retrieve a maximum of 10,000 matches. Recent changes may not immediately
* be reflected in search results due to a short delay in indexing.
* Duplicate results may be returned across pages. Some results may not be
* returned.
*
*/
SearchV2Result searchV2(SearchV2Arg arg) throws SearchErrorException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/files/search_v2",
arg,
false,
SearchV2Arg.Serializer.INSTANCE,
SearchV2Result.Serializer.INSTANCE,
SearchError.Serializer.INSTANCE);
}
catch (DbxWrappedException ex) {
throw new SearchErrorException("2/files/search_v2", ex.getRequestId(), ex.getUserMessage(), (SearchError) ex.getErrorValue());
}
}

/**
* Searches for files and folders. Note: {@link
* DbxAppFilesRequests#searchV2(String)} along with {@link
* DbxAppFilesRequests#searchContinueV2(String)} can only be used to
* retrieve a maximum of 10,000 matches. Recent changes may not immediately
* be reflected in search results due to a short delay in indexing.
* Duplicate results may be returned across pages. Some results may not be
* returned.
*
* @param query The string to search for. May match across multiple fields
* based on the request arguments. Must have length of at most 1000 and
* not be {@code null}.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public SearchV2Result searchV2(String query) throws SearchErrorException, DbxException {
SearchV2Arg _arg = new SearchV2Arg(query);
return searchV2(_arg);
}

/**
* Searches for files and folders. Note: {@link
* DbxAppFilesRequests#searchV2(String)} along with {@link
* DbxAppFilesRequests#searchContinueV2(String)} can only be used to
* retrieve a maximum of 10,000 matches. Recent changes may not immediately
* be reflected in search results due to a short delay in indexing.
* Duplicate results may be returned across pages. Some results may not be
* returned.
*
* @param query The string to search for. May match across multiple fields
* based on the request arguments. Must have length of at most 1000 and
* not be {@code null}.
*
* @return Request builder for configuring request parameters and completing
* the request.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public DbxAppSearchV2Builder searchV2Builder(String query) {
SearchV2Arg.Builder argBuilder_ = SearchV2Arg.newBuilder(query);
return new DbxAppSearchV2Builder(this, argBuilder_);
}

//
// route 2/files/search/continue_v2
//

/**
* Fetches the next page of search results returned from {@link
* DbxAppFilesRequests#searchV2(String)}. Note: {@link
* DbxAppFilesRequests#searchV2(String)} along with {@link
* DbxAppFilesRequests#searchContinueV2(String)} can only be used to
* retrieve a maximum of 10,000 matches. Recent changes may not immediately
* be reflected in search results due to a short delay in indexing.
* Duplicate results may be returned across pages. Some results may not be
* returned.
*
*/
SearchV2Result searchContinueV2(SearchV2ContinueArg arg) throws SearchErrorException, DbxException {
try {
return this.client.rpcStyle(this.client.getHost().getApi(),
"2/files/search/continue_v2",
arg,
false,
SearchV2ContinueArg.Serializer.INSTANCE,
SearchV2Result.Serializer.INSTANCE,
SearchError.Serializer.INSTANCE);
}
catch (DbxWrappedException ex) {
throw new SearchErrorException("2/files/search/continue_v2", ex.getRequestId(), ex.getUserMessage(), (SearchError) ex.getErrorValue());
}
}

/**
* Fetches the next page of search results returned from {@link
* DbxAppFilesRequests#searchV2(String)}. Note: {@link
* DbxAppFilesRequests#searchV2(String)} along with {@link
* DbxAppFilesRequests#searchContinueV2(String)} can only be used to
* retrieve a maximum of 10,000 matches. Recent changes may not immediately
* be reflected in search results due to a short delay in indexing.
* Duplicate results may be returned across pages. Some results may not be
* returned.
*
* @param cursor The cursor returned by your last call to {@link
* DbxAppFilesRequests#searchV2(String)}. Used to fetch the next page of
* results. Must have length of at least 1 and not be {@code null}.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public SearchV2Result searchContinueV2(String cursor) throws SearchErrorException, DbxException {
SearchV2ContinueArg _arg = new SearchV2ContinueArg(cursor);
return searchContinueV2(_arg);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ public DbxAppListFolderBuilder withIncludeNonDownloadableFiles(Boolean includeNo
return this;
}

/**
* Set value for optional field.
*
* <p> If left unset or set to {@code null}, defaults to {@code false}. </p>
*
* @param includeRestorableInfo If true, each returned deleted entry will
* include whether that entry can be restored. Defaults to {@code false}
* when set to {@code null}.
*
* @return this builder
*/
public DbxAppListFolderBuilder withIncludeRestorableInfo(Boolean includeRestorableInfo) {
this._builder.withIncludeRestorableInfo(includeRestorableInfo);
return this;
}

/**
* Issues the request.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3601,9 +3601,9 @@ public SearchV2Result searchV2(String query) throws SearchErrorException, DbxExc
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public DbxUserSearchV2Builder searchV2Builder(String query) {
public SearchV2Builder searchV2Builder(String query) {
SearchV2Arg.Builder argBuilder_ = SearchV2Arg.newBuilder(query);
return new DbxUserSearchV2Builder(this, argBuilder_);
return new SearchV2Builder(this, argBuilder_);
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ public DbxUserListFolderBuilder withIncludeNonDownloadableFiles(Boolean includeN
return this;
}

/**
* Set value for optional field.
*
* <p> If left unset or set to {@code null}, defaults to {@code false}. </p>
*
* @param includeRestorableInfo If true, each returned deleted entry will
* include whether that entry can be restored. Defaults to {@code false}
* when set to {@code null}.
*
* @return this builder
*/
public DbxUserListFolderBuilder withIncludeRestorableInfo(Boolean includeRestorableInfo) {
this._builder.withIncludeRestorableInfo(includeRestorableInfo);
return this;
}

/**
* Issues the request.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.fasterxml.jackson.core.JsonToken;

import java.io.IOException;
import java.util.Arrays;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
Expand All @@ -25,6 +26,8 @@
public class DeletedMetadata extends Metadata {
// struct files.DeletedMetadata (files.stone)

@Nullable
protected final Boolean isRestorable;

/**
* Indicates that there used to be a file or folder at this path, but it no
Expand All @@ -50,12 +53,15 @@ public class DeletedMetadata extends Metadata {
* FolderSharingInfo#getParentSharedFolderId} instead. Must match
* pattern "{@code [-_0-9a-zA-Z:]+}".
* @param previewUrl The preview URL of the file.
* @param isRestorable If present, indicates whether this deleted entry can
* be restored.
*
* @throws IllegalArgumentException If any argument does not meet its
* preconditions.
*/
public DeletedMetadata(@Nonnull String name, @Nullable String pathLower, @Nullable String pathDisplay, @Nullable String parentSharedFolderId, @Nullable String previewUrl) {
public DeletedMetadata(@Nonnull String name, @Nullable String pathLower, @Nullable String pathDisplay, @Nullable String parentSharedFolderId, @Nullable String previewUrl, @Nullable Boolean isRestorable) {
super(name, pathLower, pathDisplay, parentSharedFolderId, previewUrl);
this.isRestorable = isRestorable;
}

/**
Expand All @@ -71,7 +77,7 @@ public DeletedMetadata(@Nonnull String name, @Nullable String pathLower, @Nullab
* preconditions.
*/
public DeletedMetadata(@Nonnull String name) {
this(name, null, null, null, null);
this(name, null, null, null, null, null);
}

/**
Expand Down Expand Up @@ -137,6 +143,16 @@ public String getPreviewUrl() {
return previewUrl;
}

/**
* If present, indicates whether this deleted entry can be restored.
*
* @return value for this field, or {@code null} if not present.
*/
@Nullable
public Boolean getIsRestorable() {
return isRestorable;
}

/**
* Returns a new builder for creating an instance of this class.
*
Expand All @@ -157,8 +173,24 @@ public static Builder newBuilder(String name) {
*/
public static class Builder extends Metadata.Builder {

protected Boolean isRestorable;

protected Builder(String name) {
super(name);
this.isRestorable = null;
}

/**
* Set value for optional field.
*
* @param isRestorable If present, indicates whether this deleted entry
* can be restored.
*
* @return this builder
*/
public Builder withIsRestorable(Boolean isRestorable) {
this.isRestorable = isRestorable;
return this;
}

/**
Expand Down Expand Up @@ -234,14 +266,17 @@ public Builder withPreviewUrl(String previewUrl) {
* @return new instance of {@link DeletedMetadata}
*/
public DeletedMetadata build() {
return new DeletedMetadata(name, pathLower, pathDisplay, parentSharedFolderId, previewUrl);
return new DeletedMetadata(name, pathLower, pathDisplay, parentSharedFolderId, previewUrl, isRestorable);
}
}

@Override
public int hashCode() {
// attempt to deal with inheritance
return getClass().toString().hashCode();
int hash = Arrays.hashCode(new Object [] {
this.isRestorable
});
hash = (31 * super.hashCode()) + hash;
return hash;
}

@Override
Expand All @@ -260,6 +295,7 @@ else if (obj.getClass().equals(this.getClass())) {
&& ((this.pathDisplay == other.pathDisplay) || (this.pathDisplay != null && this.pathDisplay.equals(other.pathDisplay)))
&& ((this.parentSharedFolderId == other.parentSharedFolderId) || (this.parentSharedFolderId != null && this.parentSharedFolderId.equals(other.parentSharedFolderId)))
&& ((this.previewUrl == other.previewUrl) || (this.previewUrl != null && this.previewUrl.equals(other.previewUrl)))
&& ((this.isRestorable == other.isRestorable) || (this.isRestorable != null && this.isRestorable.equals(other.isRestorable)))
;
}
else {
Expand Down Expand Up @@ -314,6 +350,10 @@ public void serialize(DeletedMetadata value, JsonGenerator g, boolean collapse)
g.writeFieldName("preview_url");
StoneSerializers.nullable(StoneSerializers.string()).serialize(value.previewUrl, g);
}
if (value.isRestorable != null) {
g.writeFieldName("is_restorable");
StoneSerializers.nullable(StoneSerializers.boolean_()).serialize(value.isRestorable, g);
}
if (!collapse) {
g.writeEndObject();
}
Expand All @@ -336,6 +376,7 @@ public DeletedMetadata deserialize(JsonParser p, boolean collapsed) throws IOExc
String f_pathDisplay = null;
String f_parentSharedFolderId = null;
String f_previewUrl = null;
Boolean f_isRestorable = null;
while (p.getCurrentToken() == JsonToken.FIELD_NAME) {
String field = p.getCurrentName();
p.nextToken();
Expand All @@ -354,14 +395,17 @@ else if ("parent_shared_folder_id".equals(field)) {
else if ("preview_url".equals(field)) {
f_previewUrl = StoneSerializers.nullable(StoneSerializers.string()).deserialize(p);
}
else if ("is_restorable".equals(field)) {
f_isRestorable = StoneSerializers.nullable(StoneSerializers.boolean_()).deserialize(p);
}
else {
skipValue(p);
}
}
if (f_name == null) {
throw new JsonParseException(p, "Required field \"name\" missing.");
}
value = new DeletedMetadata(f_name, f_pathLower, f_pathDisplay, f_parentSharedFolderId, f_previewUrl);
value = new DeletedMetadata(f_name, f_pathLower, f_pathDisplay, f_parentSharedFolderId, f_previewUrl, f_isRestorable);
}
else {
throw new JsonParseException(p, "No subtype found that matches tag: \"" + tag + "\"");
Expand Down
Loading
Loading