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
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "ac37b50", "specHash": "eaa9cf0", "version": "0.7.0" }
{ "engineHash": "ac37b50", "specHash": "c27c421", "version": "0.7.0" }
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ the SDK are available by topic:
* [Ai](ai.md)
* [Aistudio](aistudio.md)
* [Appitemassociations](appitemassociations.md)
* [Archives](archives.md)
* [Authorization](authorization.md)
* [Avatars](avatars.md)
* [Chunkeduploads](chunkeduploads.md)
Expand Down
85 changes: 85 additions & 0 deletions docs/archives.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# ArchivesManager


- [List archives](#list-archives)
- [Create archive](#create-archive)
- [Delete archive](#delete-archive)

## List archives

Retrieves archives for an enterprise.

This operation is performed by calling function `getArchivesV2025R0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/get-archives/).

*Currently we don't have an example for calling `getArchivesV2025R0` in integration tests*

### Arguments

- queryParams `GetArchivesV2025R0QueryParams`
- Query parameters of getArchivesV2025R0 method
- headers `GetArchivesV2025R0Headers`
- Headers of getArchivesV2025R0 method


### Returns

This function returns a value of type `ArchivesV2025R0`.

Returns a list of archives in the enterprise.


## Create archive

Creates an archive.

This operation is performed by calling function `createArchiveV2025R0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/post-archives/).

*Currently we don't have an example for calling `createArchiveV2025R0` in integration tests*

### Arguments

- requestBody `CreateArchiveV2025R0RequestBody`
- Request body of createArchiveV2025R0 method
- headers `CreateArchiveV2025R0Headers`
- Headers of createArchiveV2025R0 method


### Returns

This function returns a value of type `ArchiveV2025R0`.

Returns a new archive object.


## Delete archive

Permanently deletes an archive.

This operation is performed by calling function `deleteArchiveByIdV2025R0`.

See the endpoint docs at
[API Reference](https://developer.box.com/reference/v2025.0/delete-archives-id/).

*Currently we don't have an example for calling `deleteArchiveByIdV2025R0` in integration tests*

### Arguments

- archiveId `String`
- The ID of the archive. Example: "982312"
- headers `DeleteArchiveByIdV2025R0Headers`
- Headers of deleteArchiveByIdV2025R0 method


### Returns

This function returns a value of type `void`.

Returns an empty response when the archive has been deleted.


11 changes: 11 additions & 0 deletions src/main/java/com/box/sdkgen/client/BoxClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.box.sdkgen.managers.ai.AiManager;
import com.box.sdkgen.managers.aistudio.AiStudioManager;
import com.box.sdkgen.managers.appitemassociations.AppItemAssociationsManager;
import com.box.sdkgen.managers.archives.ArchivesManager;
import com.box.sdkgen.managers.authorization.AuthorizationManager;
import com.box.sdkgen.managers.avatars.AvatarsManager;
import com.box.sdkgen.managers.chunkeduploads.ChunkedUploadsManager;
Expand Down Expand Up @@ -253,6 +254,8 @@ public class BoxClient {

public final ShieldListsManager shieldLists;

public final ArchivesManager archives;

public BoxClient(Authentication auth) {
this.auth = auth;
this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build();
Expand Down Expand Up @@ -579,6 +582,8 @@ public BoxClient(Authentication auth) {
.auth(this.auth)
.networkSession(this.networkSession)
.build();
this.archives =
new ArchivesManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
}

protected BoxClient(Builder builder) {
Expand Down Expand Up @@ -907,6 +912,8 @@ protected BoxClient(Builder builder) {
.auth(this.auth)
.networkSession(this.networkSession)
.build();
this.archives =
new ArchivesManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
}

public FetchResponse makeRequest(FetchOptions fetchOptions) {
Expand Down Expand Up @@ -1288,6 +1295,10 @@ public ShieldListsManager getShieldLists() {
return shieldLists;
}

public ArchivesManager getArchives() {
return archives;
}

public static class Builder {

protected final Authentication auth;
Expand Down
164 changes: 164 additions & 0 deletions src/main/java/com/box/sdkgen/managers/archives/ArchivesManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package com.box.sdkgen.managers.archives;

import static com.box.sdkgen.internal.utils.UtilsManager.convertToString;
import static com.box.sdkgen.internal.utils.UtilsManager.entryOf;
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps;
import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams;

import com.box.sdkgen.networking.auth.Authentication;
import com.box.sdkgen.networking.fetchoptions.FetchOptions;
import com.box.sdkgen.networking.fetchoptions.ResponseFormat;
import com.box.sdkgen.networking.fetchresponse.FetchResponse;
import com.box.sdkgen.networking.network.NetworkSession;
import com.box.sdkgen.schemas.v2025r0.archivesv2025r0.ArchivesV2025R0;
import com.box.sdkgen.schemas.v2025r0.archivev2025r0.ArchiveV2025R0;
import com.box.sdkgen.serialization.json.JsonManager;
import java.util.Map;

public class ArchivesManager {

public Authentication auth;

public NetworkSession networkSession;

public ArchivesManager() {
this.networkSession = new NetworkSession();
}

protected ArchivesManager(Builder builder) {
this.auth = builder.auth;
this.networkSession = builder.networkSession;
}

public ArchivesV2025R0 getArchivesV2025R0() {
return getArchivesV2025R0(new GetArchivesV2025R0QueryParams(), new GetArchivesV2025R0Headers());
}

public ArchivesV2025R0 getArchivesV2025R0(GetArchivesV2025R0QueryParams queryParams) {
return getArchivesV2025R0(queryParams, new GetArchivesV2025R0Headers());
}

public ArchivesV2025R0 getArchivesV2025R0(GetArchivesV2025R0Headers headers) {
return getArchivesV2025R0(new GetArchivesV2025R0QueryParams(), headers);
}

public ArchivesV2025R0 getArchivesV2025R0(
GetArchivesV2025R0QueryParams queryParams, GetArchivesV2025R0Headers headers) {
Map<String, String> queryParamsMap =
prepareParams(
mapOf(
entryOf("limit", convertToString(queryParams.getLimit())),
entryOf("marker", convertToString(queryParams.getMarker()))));
Map<String, String> headersMap =
prepareParams(
mergeMaps(
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
headers.getExtraHeaders()));
FetchResponse response =
this.networkSession
.getNetworkClient()
.fetch(
new FetchOptions.Builder(
String.join(
"", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
"GET")
.params(queryParamsMap)
.headers(headersMap)
.responseFormat(ResponseFormat.JSON)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
return JsonManager.deserialize(response.getData(), ArchivesV2025R0.class);
}

public ArchiveV2025R0 createArchiveV2025R0(CreateArchiveV2025R0RequestBody requestBody) {
return createArchiveV2025R0(requestBody, new CreateArchiveV2025R0Headers());
}

public ArchiveV2025R0 createArchiveV2025R0(
CreateArchiveV2025R0RequestBody requestBody, CreateArchiveV2025R0Headers headers) {
Map<String, String> headersMap =
prepareParams(
mergeMaps(
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
headers.getExtraHeaders()));
FetchResponse response =
this.networkSession
.getNetworkClient()
.fetch(
new FetchOptions.Builder(
String.join(
"", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/archives"),
"POST")
.headers(headersMap)
.data(JsonManager.serialize(requestBody))
.contentType("application/json")
.responseFormat(ResponseFormat.JSON)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
return JsonManager.deserialize(response.getData(), ArchiveV2025R0.class);
}

public void deleteArchiveByIdV2025R0(String archiveId) {
deleteArchiveByIdV2025R0(archiveId, new DeleteArchiveByIdV2025R0Headers());
}

public void deleteArchiveByIdV2025R0(String archiveId, DeleteArchiveByIdV2025R0Headers headers) {
Map<String, String> headersMap =
prepareParams(
mergeMaps(
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
headers.getExtraHeaders()));
FetchResponse response =
this.networkSession
.getNetworkClient()
.fetch(
new FetchOptions.Builder(
String.join(
"",
this.networkSession.getBaseUrls().getBaseUrl(),
"/2.0/archives/",
convertToString(archiveId)),
"DELETE")
.headers(headersMap)
.responseFormat(ResponseFormat.NO_CONTENT)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
}

public Authentication getAuth() {
return auth;
}

public NetworkSession getNetworkSession() {
return networkSession;
}

public static class Builder {

protected Authentication auth;

protected NetworkSession networkSession;

public Builder() {
this.networkSession = new NetworkSession();
}

public Builder auth(Authentication auth) {
this.auth = auth;
return this;
}

public Builder networkSession(NetworkSession networkSession) {
this.networkSession = networkSession;
return this;
}

public ArchivesManager build() {
return new ArchivesManager(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.box.sdkgen.managers.archives;

import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;

import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0;
import com.box.sdkgen.serialization.json.EnumWrapper;
import java.util.Map;

public class CreateArchiveV2025R0Headers {

public EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;

public Map<String, String> extraHeaders;

public CreateArchiveV2025R0Headers() {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
this.extraHeaders = mapOf();
}

protected CreateArchiveV2025R0Headers(Builder builder) {
this.boxVersion = builder.boxVersion;
this.extraHeaders = builder.extraHeaders;
}

public EnumWrapper<BoxVersionHeaderV2025R0> getBoxVersion() {
return boxVersion;
}

public Map<String, String> getExtraHeaders() {
return extraHeaders;
}

public static class Builder {

protected EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;

protected Map<String, String> extraHeaders;

public Builder() {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
this.extraHeaders = mapOf();
}

public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(boxVersion);
return this;
}

public Builder boxVersion(EnumWrapper<BoxVersionHeaderV2025R0> boxVersion) {
this.boxVersion = boxVersion;
return this;
}

public Builder extraHeaders(Map<String, String> extraHeaders) {
this.extraHeaders = extraHeaders;
return this;
}

public CreateArchiveV2025R0Headers build() {
return new CreateArchiveV2025R0Headers(this);
}
}
}
Loading