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": "7c94f4f", "specHash": "a646ae6", "version": "5.0.0" }
{ "engineHash": "7c94f4f", "specHash": "8b51a89", "version": "5.0.0" }
31 changes: 31 additions & 0 deletions docs/sdkgen/archives.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [List archives](#list-archives)
- [Create archive](#create-archive)
- [Delete archive](#delete-archive)
- [Update archive](#update-archive)

## List archives

Expand Down Expand Up @@ -98,3 +99,33 @@ This function returns a value of type `void`.
Returns an empty response when the archive has been deleted.


## Update archive

Updates an archive.

To learn more about the archive APIs, see the [Archive API Guide](g://archives).

This operation is performed by calling function `updateArchiveByIdV2025R0`.

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

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

### Arguments

- archiveId `String`
- The ID of the archive. Example: "982312"
- requestBody `UpdateArchiveByIdV2025R0RequestBody`
- Request body of updateArchiveByIdV2025R0 method
- headers `UpdateArchiveByIdV2025R0Headers`
- Headers of updateArchiveByIdV2025R0 method


### Returns

This function returns a value of type `ArchiveV2025R0`.

Returns the updated archive object.


Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,85 @@ public void deleteArchiveByIdV2025R0(String archiveId, DeleteArchiveByIdV2025R0H
.build());
}

/**
* Updates an archive.
*
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
*
* @param archiveId The ID of the archive. Example: "982312"
*/
public ArchiveV2025R0 updateArchiveByIdV2025R0(String archiveId) {
return updateArchiveByIdV2025R0(
archiveId,
new UpdateArchiveByIdV2025R0RequestBody(),
new UpdateArchiveByIdV2025R0Headers());
}

/**
* Updates an archive.
*
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
*
* @param archiveId The ID of the archive. Example: "982312"
* @param requestBody Request body of updateArchiveByIdV2025R0 method
*/
public ArchiveV2025R0 updateArchiveByIdV2025R0(
String archiveId, UpdateArchiveByIdV2025R0RequestBody requestBody) {
return updateArchiveByIdV2025R0(archiveId, requestBody, new UpdateArchiveByIdV2025R0Headers());
}

/**
* Updates an archive.
*
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
*
* @param archiveId The ID of the archive. Example: "982312"
* @param headers Headers of updateArchiveByIdV2025R0 method
*/
public ArchiveV2025R0 updateArchiveByIdV2025R0(
String archiveId, UpdateArchiveByIdV2025R0Headers headers) {
return updateArchiveByIdV2025R0(archiveId, new UpdateArchiveByIdV2025R0RequestBody(), headers);
}

/**
* Updates an archive.
*
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
*
* @param archiveId The ID of the archive. Example: "982312"
* @param requestBody Request body of updateArchiveByIdV2025R0 method
* @param headers Headers of updateArchiveByIdV2025R0 method
*/
public ArchiveV2025R0 updateArchiveByIdV2025R0(
String archiveId,
UpdateArchiveByIdV2025R0RequestBody requestBody,
UpdateArchiveByIdV2025R0Headers 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)),
"PUT")
.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 Authentication getAuth() {
return auth;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.box.sdkgen.managers.archives;

import com.box.sdkgen.internal.NullableFieldTracker;
import com.box.sdkgen.internal.SerializableObject;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -11,15 +12,38 @@ public class CreateArchiveV2025R0RequestBody extends SerializableObject {
/** The name of the archive. */
protected final String name;

/** The description of the archive. */
protected String description;

/** The ID of the storage policy that the archive is assigned to. */
@JsonProperty("storage_policy_id")
protected String storagePolicyId;

public CreateArchiveV2025R0RequestBody(@JsonProperty("name") String name) {
super();
this.name = name;
}

protected CreateArchiveV2025R0RequestBody(Builder builder) {
super();
this.name = builder.name;
this.description = builder.description;
this.storagePolicyId = builder.storagePolicyId;
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

public String getStoragePolicyId() {
return storagePolicyId;
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -29,16 +53,58 @@ public boolean equals(Object o) {
return false;
}
CreateArchiveV2025R0RequestBody casted = (CreateArchiveV2025R0RequestBody) o;
return Objects.equals(name, casted.name);
return Objects.equals(name, casted.name)
&& Objects.equals(description, casted.description)
&& Objects.equals(storagePolicyId, casted.storagePolicyId);
}

@Override
public int hashCode() {
return Objects.hash(name);
return Objects.hash(name, description, storagePolicyId);
}

@Override
public String toString() {
return "CreateArchiveV2025R0RequestBody{" + "name='" + name + '\'' + "}";
return "CreateArchiveV2025R0RequestBody{"
+ "name='"
+ name
+ '\''
+ ", "
+ "description='"
+ description
+ '\''
+ ", "
+ "storagePolicyId='"
+ storagePolicyId
+ '\''
+ "}";
}

public static class Builder extends NullableFieldTracker {

protected final String name;

protected String description;

protected String storagePolicyId;

public Builder(String name) {
super();
this.name = name;
}

public Builder description(String description) {
this.description = description;
return this;
}

public Builder storagePolicyId(String storagePolicyId) {
this.storagePolicyId = storagePolicyId;
return this;
}

public CreateArchiveV2025R0RequestBody build() {
return new CreateArchiveV2025R0RequestBody(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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 UpdateArchiveByIdV2025R0Headers {

/** Version header. */
public EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;

/** Extra headers that will be included in the HTTP request. */
public Map<String, String> extraHeaders;

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

protected UpdateArchiveByIdV2025R0Headers(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 UpdateArchiveByIdV2025R0Headers build() {
return new UpdateArchiveByIdV2025R0Headers(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package com.box.sdkgen.managers.archives;

import com.box.sdkgen.internal.NullableFieldTracker;
import com.box.sdkgen.internal.SerializableObject;
import com.fasterxml.jackson.annotation.JsonFilter;
import java.util.Objects;

@JsonFilter("nullablePropertyFilter")
public class UpdateArchiveByIdV2025R0RequestBody extends SerializableObject {

/** The name of the archive. */
protected String name;

/** The description of the archive. */
protected String description;

public UpdateArchiveByIdV2025R0RequestBody() {
super();
}

protected UpdateArchiveByIdV2025R0RequestBody(Builder builder) {
super();
this.name = builder.name;
this.description = builder.description;
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
}

public String getName() {
return name;
}

public String getDescription() {
return description;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
UpdateArchiveByIdV2025R0RequestBody casted = (UpdateArchiveByIdV2025R0RequestBody) o;
return Objects.equals(name, casted.name) && Objects.equals(description, casted.description);
}

@Override
public int hashCode() {
return Objects.hash(name, description);
}

@Override
public String toString() {
return "UpdateArchiveByIdV2025R0RequestBody{"
+ "name='"
+ name
+ '\''
+ ", "
+ "description='"
+ description
+ '\''
+ "}";
}

public static class Builder extends NullableFieldTracker {

protected String name;

protected String description;

public Builder name(String name) {
this.name = name;
return this;
}

public Builder description(String description) {
this.description = description;
return this;
}

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