-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from qld-gov-au/provideHelperClassThatWrappsApi…
…ObjectsWithWithObject add KiteworksApiHelper and Builder beans
- Loading branch information
Showing
7 changed files
with
946 additions
and
0 deletions.
There are no files selected for viewing
139 changes: 139 additions & 0 deletions
139
...orks-native-client/src/main/java/au/gov/qld/ssq/kiteworks/helpers/KiteworksApiHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
package au.gov.qld.ssq.kiteworks.helpers; | ||
|
||
import au.gov.qld.ssq.kiteworks.model.RestFilesidVersionsGetWithHttpInfoRequestBuilder; | ||
import au.gov.qld.ssq.kiteworks.model.RestFoldersIdActionsFilePostRequestBuilder; | ||
import au.gov.qld.ssq.kiteworks.model.RestFoldersIdActivitiesGetRequestBuilder; | ||
import au.gov.qld.ssq.kiteworks.model.RestFoldersParentFilesGetRequestBuilder; | ||
import com.kiteworks.client.ApiException; | ||
import com.kiteworks.client.ApiResponse; | ||
import com.kiteworks.client.api.FilesApi; | ||
import com.kiteworks.client.api.FoldersApi; | ||
import com.kiteworks.client.model.ActivityList; | ||
import com.kiteworks.client.model.FolderChildrenFiles; | ||
import com.kiteworks.client.model.Version; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
|
||
public class KiteworksApiHelper { | ||
|
||
private FoldersApi foldersApi; | ||
private FilesApi filesApi; | ||
|
||
public KiteworksApiHelper(FoldersApi foldersApi, FilesApi filesApi) { | ||
this.foldersApi = foldersApi; | ||
this.filesApi = filesApi; | ||
} | ||
|
||
// Get a list of files in a folder | ||
// %s/rest/folders/{parent}/files | ||
public ApiResponse<FolderChildrenFiles> getFolderFileNames(RestFoldersParentFilesGetRequestBuilder builder) throws ApiException { | ||
|
||
return foldersApi.restFoldersParentFilesGetWithHttpInfo( | ||
builder.getParent(), | ||
builder.getUserId(), | ||
builder.getReturnEntity(), | ||
builder.getModifiedColonLte(), | ||
builder.getModifiedColonLt(), | ||
builder.getDeleted(), | ||
builder.getCreatedColonLt(), | ||
builder.getOrderBy(), | ||
builder.getOffset(), | ||
builder.getLimit(), | ||
builder.getNameColonContains(), | ||
builder.getCreatedColonGte(), | ||
builder.getMode(), | ||
builder.getModifiedColonGte(), | ||
builder.getCreated(), | ||
builder.getCreatedColonLte(), | ||
builder.getModifiedColonGt(), | ||
builder.getExpireColonLte(), | ||
builder.getModified(), | ||
builder.getUserIdColonIn(), | ||
builder.getExpireColonLt(), | ||
builder.getExpireColonGte(), | ||
builder.getCreatedColonGt(), | ||
builder.getWith(), | ||
builder.getName(), | ||
builder.getIsPushed(), | ||
builder.getExpireColonGt(), | ||
builder.getExpire() | ||
); | ||
} | ||
|
||
// %s/rest/files/%s (method DELETE) | ||
public void doFileDelete(String fileId) throws ApiException { | ||
filesApi.restFilesIdDeleteWithHttpInfo(fileId); | ||
} | ||
|
||
// %s/folders/%%s/actions/file | ||
public ApiResponse<Void> doUpload(RestFoldersIdActionsFilePostRequestBuilder builder) throws ApiException { | ||
return filesApi.restFoldersIdActionsFilePostWithHttpInfo( | ||
builder.getId(), | ||
builder.getBody(), | ||
builder.getReturnEntity(), | ||
builder.getMode(), | ||
builder.getClientCreated(), | ||
builder.getClientModified(), | ||
builder.getDisableAutoVersion(), | ||
builder.getNote() | ||
); | ||
} | ||
|
||
// %s/files/%%s/content | ||
/** | ||
* List versions | ||
* Returns a list of versions for a given file | ||
**/ | ||
public ApiResponse<File> getFilesContent(String fileId) throws ApiException { | ||
return filesApi.restFilesIdContentGetWithHttpInfo(fileId); | ||
} | ||
|
||
// "%s/files/%%s/versions | ||
public ApiResponse<List<Version>> restFilesIdVersionsGetWithHttpInfo(RestFilesidVersionsGetWithHttpInfoRequestBuilder builder) throws ApiException { | ||
return filesApi.restFilesIdVersionsGetWithHttpInfo( | ||
builder.getId(), | ||
builder.getCreated(), | ||
builder.getCreatedColonGt(), | ||
builder.getCreatedColonGte(), | ||
builder.getCreatedColonLt(), | ||
builder.getCreatedColonLte(), | ||
builder.getOrderBy(), | ||
builder.getOffset(), | ||
builder.getLimit(), | ||
builder.getLocateId(), | ||
builder.getWith(), | ||
builder.getMode() | ||
); | ||
} | ||
|
||
// %s/files/%%s/versions/%%s/content | ||
public ApiResponse<Void> restFilesIdVersionsVersionIdContentGetWithHttpInfo(String id, String versionId, String range) throws ApiException { | ||
return filesApi.restFilesIdVersionsVersionIdContentGetWithHttpInfo(id, versionId, range); | ||
} | ||
|
||
// %s/folders/%%s/activities?limit=%s | ||
public ApiResponse<ActivityList> restFoldersIdActivitiesGetWithHttpInfo(RestFoldersIdActivitiesGetRequestBuilder builder) throws ApiException { | ||
return foldersApi.restFoldersIdActivitiesGetWithHttpInfo( | ||
builder.getId(), | ||
builder.getFilter(), | ||
builder.getType(), | ||
builder.getStartTime(), | ||
builder.getWith(), | ||
builder.getOffset(), | ||
builder.getEndTime(), | ||
builder.getReturnEntity(), | ||
builder.getEndDate(), | ||
builder.getSearch(), | ||
builder.getOrderBy(), | ||
builder.getMode(), | ||
builder.getStartDate(), | ||
builder.getTransactionId(), | ||
builder.getFileId(), | ||
builder.getLimit(), | ||
builder.getNested(), | ||
builder.getNoDayBack() | ||
); | ||
} | ||
|
||
} |
135 changes: 135 additions & 0 deletions
135
...java/au/gov/qld/ssq/kiteworks/model/RestFilesidVersionsGetWithHttpInfoRequestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
package au.gov.qld.ssq.kiteworks.model; | ||
|
||
import java.util.List; | ||
|
||
public class RestFilesidVersionsGetWithHttpInfoRequestBuilder { | ||
private String id; | ||
private Integer created; | ||
private Integer createdColonGt; | ||
private Integer createdColonGte; | ||
private Integer createdColonLt; | ||
private Integer createdColonLte; | ||
private List<String> orderBy; | ||
private Integer offset; | ||
private Integer limit; | ||
private Integer locateId; | ||
private String with; | ||
private String mode; | ||
|
||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withId(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withCreated(Integer created) { | ||
this.created = created; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withCreatedColonGt(Integer createdColonGt) { | ||
this.createdColonGt = createdColonGt; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withCreatedColonGte(Integer createdColonGte) { | ||
this.createdColonGte = createdColonGte; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withCreatedColonLt(Integer createdColonLt) { | ||
this.createdColonLt = createdColonLt; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withCreatedColonLte(Integer createdColonLte) { | ||
this.createdColonLte = createdColonLte; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withOrderBy(List<String> orderBy) { | ||
this.orderBy = orderBy; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withOffset(Integer offset) { | ||
this.offset = offset; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withLimit(Integer limit) { | ||
this.limit = limit; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withLocateId(Integer locateId) { | ||
this.locateId = locateId; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withWith(String with) { | ||
this.with = with; | ||
return this; | ||
} | ||
|
||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder withMode(String mode) { | ||
this.mode = mode; | ||
return this; | ||
} | ||
|
||
// Add build method to return the built object | ||
public RestFilesidVersionsGetWithHttpInfoRequestBuilder build() { | ||
return this; | ||
} | ||
|
||
// Getter methods for each field (if needed) | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public Integer getCreated() { | ||
return created; | ||
} | ||
|
||
public Integer getCreatedColonGt() { | ||
return createdColonGt; | ||
} | ||
|
||
public Integer getCreatedColonGte() { | ||
return createdColonGte; | ||
} | ||
|
||
public Integer getCreatedColonLt() { | ||
return createdColonLt; | ||
} | ||
|
||
public Integer getCreatedColonLte() { | ||
return createdColonLte; | ||
} | ||
|
||
public List<String> getOrderBy() { | ||
return orderBy; | ||
} | ||
|
||
public Integer getOffset() { | ||
return offset; | ||
} | ||
|
||
public Integer getLimit() { | ||
return limit; | ||
} | ||
|
||
public Integer getLocateId() { | ||
return locateId; | ||
} | ||
|
||
public String getWith() { | ||
return with; | ||
} | ||
|
||
public String getMode() { | ||
return mode; | ||
} | ||
} | ||
|
93 changes: 93 additions & 0 deletions
93
.../main/java/au/gov/qld/ssq/kiteworks/model/RestFoldersIdActionsFilePostRequestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package au.gov.qld.ssq.kiteworks.model; | ||
|
||
import java.io.File; | ||
import java.time.LocalDate; | ||
|
||
public class RestFoldersIdActionsFilePostRequestBuilder { | ||
private String id; | ||
private File body; | ||
private Boolean returnEntity; | ||
private String mode; | ||
private LocalDate clientCreated; | ||
private LocalDate clientModified; | ||
private Boolean disableAutoVersion; | ||
private Boolean note; | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withId(String id) { | ||
this.id = id; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withBody(File body) { | ||
this.body = body; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withReturnEntity(Boolean returnEntity) { | ||
this.returnEntity = returnEntity; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withMode(String mode) { | ||
this.mode = mode; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withClientCreated(LocalDate clientCreated) { | ||
this.clientCreated = clientCreated; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withClientModified(LocalDate clientModified) { | ||
this.clientModified = clientModified; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withDisableAutoVersion(Boolean disableAutoVersion) { | ||
this.disableAutoVersion = disableAutoVersion; | ||
return this; | ||
} | ||
|
||
public RestFoldersIdActionsFilePostRequestBuilder withNote(Boolean note) { | ||
this.note = note; | ||
return this; | ||
} | ||
|
||
// Add build method to return the built object | ||
public RestFoldersIdActionsFilePostRequestBuilder build() { | ||
return this; | ||
} | ||
|
||
// Getter methods for each field (if needed) | ||
public String getId() { | ||
return id; | ||
} | ||
|
||
public File getBody() { | ||
return body; | ||
} | ||
|
||
public Boolean getReturnEntity() { | ||
return returnEntity; | ||
} | ||
|
||
public String getMode() { | ||
return mode; | ||
} | ||
|
||
public LocalDate getClientCreated() { | ||
return clientCreated; | ||
} | ||
|
||
public LocalDate getClientModified() { | ||
return clientModified; | ||
} | ||
|
||
public Boolean getDisableAutoVersion() { | ||
return disableAutoVersion; | ||
} | ||
|
||
public Boolean getNote() { | ||
return note; | ||
} | ||
} |
Oops, something went wrong.