Skip to content

Commit f50d4d2

Browse files
committed
docs: Modify Archive API (box/box-openapi#563)
1 parent 014c94a commit f50d4d2

File tree

11 files changed

+436
-12
lines changed

11 files changed

+436
-12
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "7c94f4f", "specHash": "a646ae6", "version": "5.0.0" }
1+
{ "engineHash": "7c94f4f", "specHash": "8b51a89", "version": "5.0.0" }

docs/sdkgen/archives.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [List archives](#list-archives)
55
- [Create archive](#create-archive)
66
- [Delete archive](#delete-archive)
7+
- [Update archive](#update-archive)
78

89
## List archives
910

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

100101

102+
## Update archive
103+
104+
Updates an archive.
105+
106+
To learn more about the archive APIs, see the [Archive API Guide](g://archives).
107+
108+
This operation is performed by calling function `updateArchiveByIdV2025R0`.
109+
110+
See the endpoint docs at
111+
[API Reference](https://developer.box.com/reference/v2025.0/put-archives-id/).
112+
113+
*Currently we don't have an example for calling `updateArchiveByIdV2025R0` in integration tests*
114+
115+
### Arguments
116+
117+
- archiveId `String`
118+
- The ID of the archive. Example: "982312"
119+
- requestBody `UpdateArchiveByIdV2025R0RequestBody`
120+
- Request body of updateArchiveByIdV2025R0 method
121+
- headers `UpdateArchiveByIdV2025R0Headers`
122+
- Headers of updateArchiveByIdV2025R0 method
123+
124+
125+
### Returns
126+
127+
This function returns a value of type `ArchiveV2025R0`.
128+
129+
Returns the updated archive object.
130+
131+

src/main/java/com/box/sdkgen/managers/archives/ArchivesManager.java

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,85 @@ public void deleteArchiveByIdV2025R0(String archiveId, DeleteArchiveByIdV2025R0H
186186
.build());
187187
}
188188

189+
/**
190+
* Updates an archive.
191+
*
192+
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
193+
*
194+
* @param archiveId The ID of the archive. Example: "982312"
195+
*/
196+
public ArchiveV2025R0 updateArchiveByIdV2025R0(String archiveId) {
197+
return updateArchiveByIdV2025R0(
198+
archiveId,
199+
new UpdateArchiveByIdV2025R0RequestBody(),
200+
new UpdateArchiveByIdV2025R0Headers());
201+
}
202+
203+
/**
204+
* Updates an archive.
205+
*
206+
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
207+
*
208+
* @param archiveId The ID of the archive. Example: "982312"
209+
* @param requestBody Request body of updateArchiveByIdV2025R0 method
210+
*/
211+
public ArchiveV2025R0 updateArchiveByIdV2025R0(
212+
String archiveId, UpdateArchiveByIdV2025R0RequestBody requestBody) {
213+
return updateArchiveByIdV2025R0(archiveId, requestBody, new UpdateArchiveByIdV2025R0Headers());
214+
}
215+
216+
/**
217+
* Updates an archive.
218+
*
219+
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
220+
*
221+
* @param archiveId The ID of the archive. Example: "982312"
222+
* @param headers Headers of updateArchiveByIdV2025R0 method
223+
*/
224+
public ArchiveV2025R0 updateArchiveByIdV2025R0(
225+
String archiveId, UpdateArchiveByIdV2025R0Headers headers) {
226+
return updateArchiveByIdV2025R0(archiveId, new UpdateArchiveByIdV2025R0RequestBody(), headers);
227+
}
228+
229+
/**
230+
* Updates an archive.
231+
*
232+
* <p>To learn more about the archive APIs, see the [Archive API Guide](g://archives).
233+
*
234+
* @param archiveId The ID of the archive. Example: "982312"
235+
* @param requestBody Request body of updateArchiveByIdV2025R0 method
236+
* @param headers Headers of updateArchiveByIdV2025R0 method
237+
*/
238+
public ArchiveV2025R0 updateArchiveByIdV2025R0(
239+
String archiveId,
240+
UpdateArchiveByIdV2025R0RequestBody requestBody,
241+
UpdateArchiveByIdV2025R0Headers headers) {
242+
Map<String, String> headersMap =
243+
prepareParams(
244+
mergeMaps(
245+
mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))),
246+
headers.getExtraHeaders()));
247+
FetchResponse response =
248+
this.networkSession
249+
.getNetworkClient()
250+
.fetch(
251+
new FetchOptions.Builder(
252+
String.join(
253+
"",
254+
this.networkSession.getBaseUrls().getBaseUrl(),
255+
"/2.0/archives/",
256+
convertToString(archiveId)),
257+
"PUT")
258+
.headers(headersMap)
259+
.data(JsonManager.serialize(requestBody))
260+
.contentType("application/json")
261+
.responseFormat(ResponseFormat.JSON)
262+
.auth(this.auth)
263+
.networkSession(this.networkSession)
264+
.build());
265+
return JsonManager.deserialize(response.getData(), ArchiveV2025R0.class);
266+
}
267+
189268
public Authentication getAuth() {
190269
return auth;
191270
}

src/main/java/com/box/sdkgen/managers/archives/CreateArchiveV2025R0RequestBody.java

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.box.sdkgen.managers.archives;
22

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

15+
/** The description of the archive. */
16+
protected String description;
17+
18+
/** The ID of the storage policy that the archive is assigned to. */
19+
@JsonProperty("storage_policy_id")
20+
protected String storagePolicyId;
21+
1422
public CreateArchiveV2025R0RequestBody(@JsonProperty("name") String name) {
1523
super();
1624
this.name = name;
1725
}
1826

27+
protected CreateArchiveV2025R0RequestBody(Builder builder) {
28+
super();
29+
this.name = builder.name;
30+
this.description = builder.description;
31+
this.storagePolicyId = builder.storagePolicyId;
32+
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
33+
}
34+
1935
public String getName() {
2036
return name;
2137
}
2238

39+
public String getDescription() {
40+
return description;
41+
}
42+
43+
public String getStoragePolicyId() {
44+
return storagePolicyId;
45+
}
46+
2347
@Override
2448
public boolean equals(Object o) {
2549
if (this == o) {
@@ -29,16 +53,58 @@ public boolean equals(Object o) {
2953
return false;
3054
}
3155
CreateArchiveV2025R0RequestBody casted = (CreateArchiveV2025R0RequestBody) o;
32-
return Objects.equals(name, casted.name);
56+
return Objects.equals(name, casted.name)
57+
&& Objects.equals(description, casted.description)
58+
&& Objects.equals(storagePolicyId, casted.storagePolicyId);
3359
}
3460

3561
@Override
3662
public int hashCode() {
37-
return Objects.hash(name);
63+
return Objects.hash(name, description, storagePolicyId);
3864
}
3965

4066
@Override
4167
public String toString() {
42-
return "CreateArchiveV2025R0RequestBody{" + "name='" + name + '\'' + "}";
68+
return "CreateArchiveV2025R0RequestBody{"
69+
+ "name='"
70+
+ name
71+
+ '\''
72+
+ ", "
73+
+ "description='"
74+
+ description
75+
+ '\''
76+
+ ", "
77+
+ "storagePolicyId='"
78+
+ storagePolicyId
79+
+ '\''
80+
+ "}";
81+
}
82+
83+
public static class Builder extends NullableFieldTracker {
84+
85+
protected final String name;
86+
87+
protected String description;
88+
89+
protected String storagePolicyId;
90+
91+
public Builder(String name) {
92+
super();
93+
this.name = name;
94+
}
95+
96+
public Builder description(String description) {
97+
this.description = description;
98+
return this;
99+
}
100+
101+
public Builder storagePolicyId(String storagePolicyId) {
102+
this.storagePolicyId = storagePolicyId;
103+
return this;
104+
}
105+
106+
public CreateArchiveV2025R0RequestBody build() {
107+
return new CreateArchiveV2025R0RequestBody(this);
108+
}
43109
}
44110
}
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.box.sdkgen.managers.archives;
2+
3+
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;
4+
5+
import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0;
6+
import com.box.sdkgen.serialization.json.EnumWrapper;
7+
import java.util.Map;
8+
9+
public class UpdateArchiveByIdV2025R0Headers {
10+
11+
/** Version header. */
12+
public EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
13+
14+
/** Extra headers that will be included in the HTTP request. */
15+
public Map<String, String> extraHeaders;
16+
17+
public UpdateArchiveByIdV2025R0Headers() {
18+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
19+
this.extraHeaders = mapOf();
20+
}
21+
22+
protected UpdateArchiveByIdV2025R0Headers(Builder builder) {
23+
this.boxVersion = builder.boxVersion;
24+
this.extraHeaders = builder.extraHeaders;
25+
}
26+
27+
public EnumWrapper<BoxVersionHeaderV2025R0> getBoxVersion() {
28+
return boxVersion;
29+
}
30+
31+
public Map<String, String> getExtraHeaders() {
32+
return extraHeaders;
33+
}
34+
35+
public static class Builder {
36+
37+
protected EnumWrapper<BoxVersionHeaderV2025R0> boxVersion;
38+
39+
protected Map<String, String> extraHeaders;
40+
41+
public Builder() {
42+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(BoxVersionHeaderV2025R0._2025_0);
43+
this.extraHeaders = mapOf();
44+
}
45+
46+
public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) {
47+
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2025R0>(boxVersion);
48+
return this;
49+
}
50+
51+
public Builder boxVersion(EnumWrapper<BoxVersionHeaderV2025R0> boxVersion) {
52+
this.boxVersion = boxVersion;
53+
return this;
54+
}
55+
56+
public Builder extraHeaders(Map<String, String> extraHeaders) {
57+
this.extraHeaders = extraHeaders;
58+
return this;
59+
}
60+
61+
public UpdateArchiveByIdV2025R0Headers build() {
62+
return new UpdateArchiveByIdV2025R0Headers(this);
63+
}
64+
}
65+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
package com.box.sdkgen.managers.archives;
2+
3+
import com.box.sdkgen.internal.NullableFieldTracker;
4+
import com.box.sdkgen.internal.SerializableObject;
5+
import com.fasterxml.jackson.annotation.JsonFilter;
6+
import java.util.Objects;
7+
8+
@JsonFilter("nullablePropertyFilter")
9+
public class UpdateArchiveByIdV2025R0RequestBody extends SerializableObject {
10+
11+
/** The name of the archive. */
12+
protected String name;
13+
14+
/** The description of the archive. */
15+
protected String description;
16+
17+
public UpdateArchiveByIdV2025R0RequestBody() {
18+
super();
19+
}
20+
21+
protected UpdateArchiveByIdV2025R0RequestBody(Builder builder) {
22+
super();
23+
this.name = builder.name;
24+
this.description = builder.description;
25+
markNullableFieldsAsSet(builder.getExplicitlySetNullableFields());
26+
}
27+
28+
public String getName() {
29+
return name;
30+
}
31+
32+
public String getDescription() {
33+
return description;
34+
}
35+
36+
@Override
37+
public boolean equals(Object o) {
38+
if (this == o) {
39+
return true;
40+
}
41+
if (o == null || getClass() != o.getClass()) {
42+
return false;
43+
}
44+
UpdateArchiveByIdV2025R0RequestBody casted = (UpdateArchiveByIdV2025R0RequestBody) o;
45+
return Objects.equals(name, casted.name) && Objects.equals(description, casted.description);
46+
}
47+
48+
@Override
49+
public int hashCode() {
50+
return Objects.hash(name, description);
51+
}
52+
53+
@Override
54+
public String toString() {
55+
return "UpdateArchiveByIdV2025R0RequestBody{"
56+
+ "name='"
57+
+ name
58+
+ '\''
59+
+ ", "
60+
+ "description='"
61+
+ description
62+
+ '\''
63+
+ "}";
64+
}
65+
66+
public static class Builder extends NullableFieldTracker {
67+
68+
protected String name;
69+
70+
protected String description;
71+
72+
public Builder name(String name) {
73+
this.name = name;
74+
return this;
75+
}
76+
77+
public Builder description(String description) {
78+
this.description = description;
79+
return this;
80+
}
81+
82+
public UpdateArchiveByIdV2025R0RequestBody build() {
83+
return new UpdateArchiveByIdV2025R0RequestBody(this);
84+
}
85+
}
86+
}

0 commit comments

Comments
 (0)