Skip to content
Open
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
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public class MyActivity extends AppCompatActivity {

#### 5.3) **WebDAV**

Currently the following `WebDAV` Methods are supported: `PROPFIND` / `MKCOL`
Currently the following `WebDAV` Methods are supported: `PROPFIND`, `MKCOL`, `MOVE`.

The following examples shows how to use the `PROPFIND` method with a depth of 0.

Expand All @@ -251,6 +251,24 @@ final var nextcloudRequest = new NextcloudRequest.Builder()
.build();
```

For the `MOVE` method, the `Destination` and `Overwrite` params must be added:

```
final var nextcloudRequest = new NextcloudRequest.Builder()
.setMethod("MOVE")
.setUrl(Uri.encode("/remote.php/webdav/" + remotePath, "/"))
.setAdditionalParameter(
NextcloudRequest.ADDITIONAL_PARAMETER_MOVE_DESTINATION,
"/remote.php/webdav/" + destinationPath
)
.setAdditionalParameter(
NextcloudRequest.ADDITIONAL_PARAMETER_MOVE_OVERWRITE,
true
)
.build();
```


## Additional info

In case that you require some SSO features that were introduced in a specific Nextcloud Files app version, you can run a simple version check using the following helper method:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ public class NextcloudRequest implements Serializable {

private static final long serialVersionUID = 215521212534240L; //assign a long value

public static final String ADDITIONAL_PARAMETER_MOVE_DESTINATION = "Destination";
public static final String ADDITIONAL_PARAMETER_MOVE_OVERWRITE = "Overwrite";


private String method;
private Map<String, List<String>> header = new HashMap<>();
private Map<String, String> parameter = new HashMap<>();
private Map<String, String> additionalParameter = new HashMap<>();

private String requestBody;
private String url;
private String token;
Expand Down Expand Up @@ -123,6 +129,16 @@ public Builder addParameter(QueryParam parameter) {
return this;
}


public Builder setAdditionalParameters(Map<String, String> ap) {
ncr.additionalParameter = ap;
return this;
}
public Builder setAdditionalParameter(String key, String value) {
ncr.additionalParameter.put(key, value);
return this;
}

private static void nullCheck(Object o) {
if (o == null) {
throw new IllegalArgumentException("null is not allowed here");
Expand Down Expand Up @@ -209,6 +225,13 @@ public Map<String, List<String>> getHeader() {
return this.header;
}

public Map<String, String> getAdditionalParameters() {
return this.additionalParameter;
}
public String getAdditionalParameter(String key) {
return this.additionalParameter.get(key);
}

public Collection<QueryParam> getParameterV2() {
return this.parameterV2;
}
Expand Down
Loading