1
+ using Box . Sdk . Gen ;
2
+ using System ;
3
+ using System . Collections . ObjectModel ;
4
+ using System . Collections . Generic ;
5
+ using Box . Sdk . Gen . Internal ;
6
+ using Box . Sdk . Gen . Schemas ;
7
+
8
+ namespace Box . Sdk . Gen . Managers {
9
+ public class AiStudioManager : IAiStudioManager {
10
+ public IAuthentication ? Auth { get ; init ; }
11
+
12
+ public NetworkSession NetworkSession { get ; }
13
+
14
+ public AiStudioManager ( NetworkSession ? networkSession = default ) {
15
+ NetworkSession = networkSession ?? new NetworkSession ( ) ;
16
+ }
17
+ /// <summary>
18
+ /// Lists AI agents based on the provided parameters.
19
+ /// </summary>
20
+ /// <param name="queryParams">
21
+ /// Query parameters of getAiAgents method
22
+ /// </param>
23
+ /// <param name="headers">
24
+ /// Headers of getAiAgents method
25
+ /// </param>
26
+ /// <param name="cancellationToken">
27
+ /// Token used for request cancellation.
28
+ /// </param>
29
+ public async System . Threading . Tasks . Task < AiMultipleAgentResponse > GetAiAgentsAsync ( GetAiAgentsQueryParams ? queryParams = default , GetAiAgentsHeaders ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
30
+ queryParams = queryParams ?? new GetAiAgentsQueryParams ( ) ;
31
+ headers = headers ?? new GetAiAgentsHeaders ( ) ;
32
+ Dictionary < string , string > queryParamsMap = Utils . PrepareParams ( map : new Dictionary < string , string ? > ( ) { { "mode" , StringUtils . ToStringRepresentation ( queryParams . Mode ) } , { "fields" , StringUtils . ToStringRepresentation ( queryParams . Fields ) } , { "agent_state" , StringUtils . ToStringRepresentation ( queryParams . AgentState ) } , { "include_box_default" , StringUtils . ToStringRepresentation ( queryParams . IncludeBoxDefault ) } , { "marker" , StringUtils . ToStringRepresentation ( queryParams . Marker ) } , { "limit" , StringUtils . ToStringRepresentation ( queryParams . Limit ) } } ) ;
33
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { } , headers . ExtraHeaders ) ) ;
34
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/ai_agents" ) , method : "GET" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Parameters = queryParamsMap , Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
35
+ return SimpleJsonSerializer . Deserialize < AiMultipleAgentResponse > ( NullableUtils . Unwrap ( response . Data ) ) ;
36
+ }
37
+
38
+ /// <summary>
39
+ /// Creates an AI agent. At least one of the following capabilities must be provided: `ask`, `text_gen`, `extract`.
40
+ /// </summary>
41
+ /// <param name="requestBody">
42
+ /// Request body of createAiAgent method
43
+ /// </param>
44
+ /// <param name="headers">
45
+ /// Headers of createAiAgent method
46
+ /// </param>
47
+ /// <param name="cancellationToken">
48
+ /// Token used for request cancellation.
49
+ /// </param>
50
+ public async System . Threading . Tasks . Task < AiSingleAgentResponseFull > CreateAiAgentAsync ( CreateAiAgent requestBody , CreateAiAgentHeaders ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
51
+ headers = headers ?? new CreateAiAgentHeaders ( ) ;
52
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { } , headers . ExtraHeaders ) ) ;
53
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/ai_agents" ) , method : "POST" , contentType : "application/json" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Headers = headersMap , Data = SimpleJsonSerializer . Serialize ( requestBody ) , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
54
+ return SimpleJsonSerializer . Deserialize < AiSingleAgentResponseFull > ( NullableUtils . Unwrap ( response . Data ) ) ;
55
+ }
56
+
57
+ /// <summary>
58
+ /// Updates an AI agent.
59
+ /// </summary>
60
+ /// <param name="agentId">
61
+ /// The ID of the agent to update.
62
+ /// Example: "1234"
63
+ /// </param>
64
+ /// <param name="requestBody">
65
+ /// Request body of updateAiAgentById method
66
+ /// </param>
67
+ /// <param name="headers">
68
+ /// Headers of updateAiAgentById method
69
+ /// </param>
70
+ /// <param name="cancellationToken">
71
+ /// Token used for request cancellation.
72
+ /// </param>
73
+ public async System . Threading . Tasks . Task < AiSingleAgentResponseFull > UpdateAiAgentByIdAsync ( string agentId , CreateAiAgent requestBody , UpdateAiAgentByIdHeaders ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
74
+ headers = headers ?? new UpdateAiAgentByIdHeaders ( ) ;
75
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { } , headers . ExtraHeaders ) ) ;
76
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/ai_agents/" , StringUtils . ToStringRepresentation ( agentId ) ) , method : "PUT" , contentType : "application/json" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Headers = headersMap , Data = SimpleJsonSerializer . Serialize ( requestBody ) , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
77
+ return SimpleJsonSerializer . Deserialize < AiSingleAgentResponseFull > ( NullableUtils . Unwrap ( response . Data ) ) ;
78
+ }
79
+
80
+ /// <summary>
81
+ /// Gets an AI Agent using the `agent_id` parameter.
82
+ /// </summary>
83
+ /// <param name="agentId">
84
+ /// The agent id to get.
85
+ /// Example: "1234"
86
+ /// </param>
87
+ /// <param name="queryParams">
88
+ /// Query parameters of getAiAgentById method
89
+ /// </param>
90
+ /// <param name="headers">
91
+ /// Headers of getAiAgentById method
92
+ /// </param>
93
+ /// <param name="cancellationToken">
94
+ /// Token used for request cancellation.
95
+ /// </param>
96
+ public async System . Threading . Tasks . Task < AiSingleAgentResponseFull > GetAiAgentByIdAsync ( string agentId , GetAiAgentByIdQueryParams ? queryParams = default , GetAiAgentByIdHeaders ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
97
+ queryParams = queryParams ?? new GetAiAgentByIdQueryParams ( ) ;
98
+ headers = headers ?? new GetAiAgentByIdHeaders ( ) ;
99
+ Dictionary < string , string > queryParamsMap = Utils . PrepareParams ( map : new Dictionary < string , string ? > ( ) { { "fields" , StringUtils . ToStringRepresentation ( queryParams . Fields ) } } ) ;
100
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { } , headers . ExtraHeaders ) ) ;
101
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/ai_agents/" , StringUtils . ToStringRepresentation ( agentId ) ) , method : "GET" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Parameters = queryParamsMap , Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
102
+ return SimpleJsonSerializer . Deserialize < AiSingleAgentResponseFull > ( NullableUtils . Unwrap ( response . Data ) ) ;
103
+ }
104
+
105
+ /// <summary>
106
+ /// Deletes an AI agent using the provided parameters.
107
+ /// </summary>
108
+ /// <param name="agentId">
109
+ /// The ID of the agent to delete.
110
+ /// Example: "1234"
111
+ /// </param>
112
+ /// <param name="headers">
113
+ /// Headers of deleteAiAgentById method
114
+ /// </param>
115
+ /// <param name="cancellationToken">
116
+ /// Token used for request cancellation.
117
+ /// </param>
118
+ public async System . Threading . Tasks . Task DeleteAiAgentByIdAsync ( string agentId , DeleteAiAgentByIdHeaders ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
119
+ headers = headers ?? new DeleteAiAgentByIdHeaders ( ) ;
120
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { } , headers . ExtraHeaders ) ) ;
121
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/ai_agents/" , StringUtils . ToStringRepresentation ( agentId ) ) , method : "DELETE" , responseFormat : Box . Sdk . Gen . ResponseFormat . NoContent ) { Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
122
+ }
123
+
124
+ }
125
+ }
0 commit comments