Skip to content

Commit

Permalink
Add file request support (#869)
Browse files Browse the repository at this point in the history
  • Loading branch information
sujaygarlanka authored Feb 22, 2021
1 parent c7bb1fe commit c3cd6c3
Show file tree
Hide file tree
Showing 8 changed files with 768 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog

## Next Release

__New Features and Enhancements:__

- Add file request support ([#869](https://github.com/box/box-java-sdk/pull/869))

## 2.53.0 [2021-01-08]

__New Features and Enhancements:__

- Add offset and limit parameters to `BoxFolder.getChildren` ([#861]https://github.com/box/box-java-sdk/pull/861)
- Add offset and limit parameters to `BoxFolder.getChildren` ([#861](https://github.com/box/box-java-sdk/pull/861))

## 2.52.0 [2020-11-24]

Expand Down
73 changes: 73 additions & 0 deletions doc/file_requests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
File Requests
=============

File request objects represent a file request associated with a folder.

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Get a File Request's Information](#get-a-file-requests-information)
- [Copy a File Request's Information](#copy-a-file-requests-information)
- [Update a File Request's Information](#update-a-file-requests-information)
- [Delete a File Request](#delete-a-file-request)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Get a File Request's Information
------------------------

Calling [`getInfo()`][get-info] returns information on a file request.

```java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
BoxFileRequest.Info fileRequestInfo = fileRequest.getInfo();
```

[get-info]: http://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxFileRequest.html#getInfo

Copy a File Request's Information
---------------------------

Calling [`copyInfo(String folderId)`][copy-info] copies an existing file request that is already present
on one folder, and applies it to another folder. If you want to set certain fields of the newly copied file request when it is created,
set those fields in the `BoxFileRequest.Info` that you pass into this method [`copyInfo(BoxFileRequest.Info info, String folderId)`][copy-info].

```java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
BoxFileRequest.Info fileRequestInfo = fileRequest.new Info();
fileRequestInfo.setDescription("Following documents are requested for your process");
fileRequestInfo.setIsDescriptionRequired(true);
fileRequestInfo.setStatus(BoxFileRequest.Status.ACTIVE);
fileRequestInfo = fileRequest.copyInfo(fileRequestInfo, "folderId");
```

[copy-info]: http://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxTask.html#copyInfo

Update a File Request's Information
---------------------------

Calling [`updateInfo(BoxFileRequest.Info info)`][update-info] updates a file request. This can be used to activate
or deactivate a file request.

```java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
BoxFileRequest.Info fileRequestInfo = fileRequest.new Info();
fileRequestInfo.setDescription("Following documents are requested for your process");
fileRequestInfo.setIsDescriptionRequired(true);
fileRequestInfo.setStatus(BoxFileRequest.Status.ACTIVE);
fileRequestInfo = fileRequest.updateInfo(fileRequestInfo);
```

[update-info]: http://opensource.box.com/box-java-sdk/javadoc/com/box/sdk/BoxFileRequest.html#updateInfo

Delete a File Request
-------------

Calling [`delete()`][delete] deletes a file request permanently.

```java
BoxFileRequest fileRequest = new BoxFileRequest(api, "id");
fileRequest.delete();
```

[delete]: https://box.github.io/box-java-sdk/javadoc/com/box/sdk/BoxFileRequest.html#delete
Loading

0 comments on commit c3cd6c3

Please sign in to comment.