Skip to content
Open
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": "0d1694f", "specHash": "7f8494a", "version": "10.21.0" }
{ "engineHash": "0d1694f", "specHash": "7cec401", "version": "10.21.0" }
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ General explanations of the available functionality and examples of how to use
the SDK are available by topic:

* [Ai](ai.md)
* [Aisessions](aisessions.md)
* [Aistudio](aistudio.md)
* [Appitemassociations](appitemassociations.md)
* [Archives](archives.md)
Expand Down
74 changes: 74 additions & 0 deletions docs/aisessions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# AiSessionsManager


- [List AI sessions](#list-ai-sessions)
- [Delete AI session](#delete-ai-session)

## List AI sessions

Returns a marker-paginated list of the AI sessions that the authenticated
user can read and that were created through the Box public API. Entries are
ordered by `sort` and `direction`, defaulting to `updated_at` descending so
the most recently active session appears first.

The access token must have both the `ai.readwrite` and `root_readwrite`
scopes.

A page may contain fewer than `limit` entries while further pages remain.
Treat a non-null `next_marker` as the only signal that more results exist.

This operation is performed by calling function `getAiSessionsV2026R0`.

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

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

### Arguments

- queryParams `GetAiSessionsV2026R0QueryParams`
- Query parameters of getAiSessionsV2026R0 method
- headers `GetAiSessionsV2026R0Headers`
- Headers of getAiSessionsV2026R0 method


### Returns

This function returns a value of type `AiSessionsV2026R0`.

Returns a paginated list of AI sessions.


## Delete AI session

Deletes an AI session created through the Box public API, together with its
agent tasks. The session's agent-generated files and uploaded files are
moved to the trash. Files attached as sources from elsewhere in Box are not
affected. Deleting a session does not stop a running task or notify the
agent.

The access token must have both the `ai.readwrite` and `root_readwrite`
scopes.

This operation is performed by calling function `deleteAiSessionByIdV2026R0`.

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

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

### Arguments

- aiSessionId `String`
- The unique identifier of the AI session. This is the same value returned as `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723"
- headers `DeleteAiSessionByIdV2026R0Headers`
- Headers of deleteAiSessionByIdV2026R0 method


### Returns

This function returns a value of type `void`.

Returns an empty response when the AI session was successfully 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 @@ -4,6 +4,7 @@
import static com.box.sdkgen.internal.utils.UtilsManager.mapOf;

import com.box.sdkgen.managers.ai.AiManager;
import com.box.sdkgen.managers.aisessions.AiSessionsManager;
import com.box.sdkgen.managers.aistudio.AiStudioManager;
import com.box.sdkgen.managers.appitemassociations.AppItemAssociationsManager;
import com.box.sdkgen.managers.archives.ArchivesManager;
Expand Down Expand Up @@ -285,6 +286,8 @@ public class BoxClient {

public final ShuttleManager shuttle;

public final AiSessionsManager aiSessions;

public BoxClient(Authentication auth) {
this.auth = auth;
this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build();
Expand Down Expand Up @@ -649,6 +652,8 @@ public BoxClient(Authentication auth) {
new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
this.shuttle =
new ShuttleManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
this.aiSessions =
new AiSessionsManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
}

protected BoxClient(Builder builder) {
Expand Down Expand Up @@ -1015,6 +1020,8 @@ protected BoxClient(Builder builder) {
new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
this.shuttle =
new ShuttleManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
this.aiSessions =
new AiSessionsManager.Builder().auth(this.auth).networkSession(this.networkSession).build();
}

/**
Expand Down Expand Up @@ -1490,6 +1497,10 @@ public ShuttleManager getShuttle() {
return shuttle;
}

public AiSessionsManager getAiSessions() {
return aiSessions;
}

public static class Builder {

protected final Authentication auth;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
package com.box.sdkgen.managers.aisessions;

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.v2026r0.aisessionsv2026r0.AiSessionsV2026R0;
import com.box.sdkgen.serialization.json.JsonManager;
import java.util.Map;

public class AiSessionsManager {

public Authentication auth;

public NetworkSession networkSession;

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

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

/**
* Returns a marker-paginated list of the AI sessions that the authenticated user can read and
* that were created through the Box public API. Entries are ordered by `sort` and `direction`,
* defaulting to `updated_at` descending so the most recently active session appears first.
*
* <p>The access token must have both the `ai.readwrite` and `root_readwrite` scopes.
*
* <p>A page may contain fewer than `limit` entries while further pages remain. Treat a non-null
* `next_marker` as the only signal that more results exist.
*
* @param queryParams Query parameters of getAiSessionsV2026R0 method
*/
public AiSessionsV2026R0 getAiSessionsV2026R0(GetAiSessionsV2026R0QueryParams queryParams) {
return getAiSessionsV2026R0(queryParams, new GetAiSessionsV2026R0Headers());
}

/**
* Returns a marker-paginated list of the AI sessions that the authenticated user can read and
* that were created through the Box public API. Entries are ordered by `sort` and `direction`,
* defaulting to `updated_at` descending so the most recently active session appears first.
*
* <p>The access token must have both the `ai.readwrite` and `root_readwrite` scopes.
*
* <p>A page may contain fewer than `limit` entries while further pages remain. Treat a non-null
* `next_marker` as the only signal that more results exist.
*
* @param queryParams Query parameters of getAiSessionsV2026R0 method
* @param headers Headers of getAiSessionsV2026R0 method
*/
public AiSessionsV2026R0 getAiSessionsV2026R0(
GetAiSessionsV2026R0QueryParams queryParams, GetAiSessionsV2026R0Headers headers) {
Map<String, String> queryParamsMap =
prepareParams(
mapOf(
entryOf("source", convertToString(queryParams.getSource())),
entryOf("marker", convertToString(queryParams.getMarker())),
entryOf("sort", convertToString(queryParams.getSort())),
entryOf("direction", convertToString(queryParams.getDirection())),
entryOf("limit", convertToString(queryParams.getLimit())),
entryOf("client_ids", convertToString(queryParams.getClientIds()))));
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/ai_sessions"),
"GET")
.params(queryParamsMap)
.headers(headersMap)
.responseFormat(ResponseFormat.JSON)
.auth(this.auth)
.networkSession(this.networkSession)
.build());
return JsonManager.deserialize(response.getData(), AiSessionsV2026R0.class);
}

/**
* Deletes an AI session created through the Box public API, together with its agent tasks. The
* session's agent-generated files and uploaded files are moved to the trash. Files attached as
* sources from elsewhere in Box are not affected. Deleting a session does not stop a running task
* or notify the agent.
*
* <p>The access token must have both the `ai.readwrite` and `root_readwrite` scopes.
*
* @param aiSessionId The unique identifier of the AI session. This is the same value returned as
* `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723"
*/
public void deleteAiSessionByIdV2026R0(String aiSessionId) {
deleteAiSessionByIdV2026R0(aiSessionId, new DeleteAiSessionByIdV2026R0Headers());
}

/**
* Deletes an AI session created through the Box public API, together with its agent tasks. The
* session's agent-generated files and uploaded files are moved to the trash. Files attached as
* sources from elsewhere in Box are not affected. Deleting a session does not stop a running task
* or notify the agent.
*
* <p>The access token must have both the `ai.readwrite` and `root_readwrite` scopes.
*
* @param aiSessionId The unique identifier of the AI session. This is the same value returned as
* `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723"
* @param headers Headers of deleteAiSessionByIdV2026R0 method
*/
public void deleteAiSessionByIdV2026R0(
String aiSessionId, DeleteAiSessionByIdV2026R0Headers 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/ai_sessions/",
convertToString(aiSessionId)),
"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() {}

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

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

public AiSessionsManager build() {
if (this.networkSession == null) {
this.networkSession = new NetworkSession();
}
return new AiSessionsManager(this);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package com.box.sdkgen.managers.aisessions;

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

import com.box.sdkgen.parameters.v2026r0.boxversionheaderv2026r0.BoxVersionHeaderV2026R0;
import com.box.sdkgen.serialization.json.EnumWrapper;
import java.util.Map;

public class DeleteAiSessionByIdV2026R0Headers {

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

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

public DeleteAiSessionByIdV2026R0Headers() {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(BoxVersionHeaderV2026R0._2026_0);
this.extraHeaders = mapOf();
}

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

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

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

public static class Builder {

protected EnumWrapper<BoxVersionHeaderV2026R0> boxVersion;

protected Map<String, String> extraHeaders;

public Builder() {}

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

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

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

public DeleteAiSessionByIdV2026R0Headers build() {
if (this.boxVersion == null) {
this.boxVersion = new EnumWrapper<BoxVersionHeaderV2026R0>(BoxVersionHeaderV2026R0._2026_0);
}
if (this.extraHeaders == null) {
this.extraHeaders = mapOf();
}
return new DeleteAiSessionByIdV2026R0Headers(this);
}
}
}
Loading
Loading