1
+ using Box . Sdk . Gen ;
2
+ using System . Collections . Generic ;
3
+ using System . Collections . ObjectModel ;
4
+ using Box . Sdk . Gen . Internal ;
5
+ using Box . Sdk . Gen . Schemas ;
6
+ using Box . Sdk . Gen . Parameters ;
7
+
8
+ namespace Box . Sdk . Gen . Managers {
9
+ public class DocgenManager : IDocgenManager {
10
+ public IAuthentication ? Auth { get ; init ; }
11
+
12
+ public NetworkSession NetworkSession { get ; }
13
+
14
+ public DocgenManager ( NetworkSession ? networkSession = default ) {
15
+ NetworkSession = networkSession ?? new NetworkSession ( ) ;
16
+ }
17
+ /// <summary>
18
+ /// Get details of the Box Doc Gen job.
19
+ /// </summary>
20
+ /// <param name="jobId">
21
+ /// Box Doc Gen job ID.
22
+ /// Example: 123
23
+ /// </param>
24
+ /// <param name="headers">
25
+ /// Headers of getDocgenJobByIdV2025R0 method
26
+ /// </param>
27
+ /// <param name="cancellationToken">
28
+ /// Token used for request cancellation.
29
+ /// </param>
30
+ public async System . Threading . Tasks . Task < DocGenJobV2025R0 > GetDocgenJobByIdV2025R0Async ( string jobId , GetDocgenJobByIdV2025R0Headers ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
31
+ headers = headers ?? new GetDocgenJobByIdV2025R0Headers ( ) ;
32
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { { "box-version" , StringUtils . ToStringRepresentation ( headers . BoxVersion ) } } , headers . ExtraHeaders ) ) ;
33
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/docgen_jobs/" , StringUtils . ToStringRepresentation ( jobId ) ) , method : "GET" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
34
+ return SimpleJsonSerializer . Deserialize < DocGenJobV2025R0 > ( NullableUtils . Unwrap ( response . Data ) ) ;
35
+ }
36
+
37
+ /// <summary>
38
+ /// Lists all Box Doc Gen jobs for a user.
39
+ /// </summary>
40
+ /// <param name="queryParams">
41
+ /// Query parameters of getDocgenJobsV2025R0 method
42
+ /// </param>
43
+ /// <param name="headers">
44
+ /// Headers of getDocgenJobsV2025R0 method
45
+ /// </param>
46
+ /// <param name="cancellationToken">
47
+ /// Token used for request cancellation.
48
+ /// </param>
49
+ public async System . Threading . Tasks . Task < DocGenJobsFullV2025R0 > GetDocgenJobsV2025R0Async ( GetDocgenJobsV2025R0QueryParams ? queryParams = default , GetDocgenJobsV2025R0Headers ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
50
+ queryParams = queryParams ?? new GetDocgenJobsV2025R0QueryParams ( ) ;
51
+ headers = headers ?? new GetDocgenJobsV2025R0Headers ( ) ;
52
+ Dictionary < string , string > queryParamsMap = Utils . PrepareParams ( map : new Dictionary < string , string ? > ( ) { { "marker" , StringUtils . ToStringRepresentation ( queryParams . Marker ) } , { "limit" , StringUtils . ToStringRepresentation ( queryParams . Limit ) } } ) ;
53
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { { "box-version" , StringUtils . ToStringRepresentation ( headers . BoxVersion ) } } , headers . ExtraHeaders ) ) ;
54
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/docgen_jobs" ) , method : "GET" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Parameters = queryParamsMap , Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
55
+ return SimpleJsonSerializer . Deserialize < DocGenJobsFullV2025R0 > ( NullableUtils . Unwrap ( response . Data ) ) ;
56
+ }
57
+
58
+ /// <summary>
59
+ /// Lists Box Doc Gen jobs in a batch
60
+ /// </summary>
61
+ /// <param name="batchId">
62
+ /// Box Doc Gen batch ID.
63
+ /// Example: 123
64
+ /// </param>
65
+ /// <param name="queryParams">
66
+ /// Query parameters of getDocgenBatchJobByIdV2025R0 method
67
+ /// </param>
68
+ /// <param name="headers">
69
+ /// Headers of getDocgenBatchJobByIdV2025R0 method
70
+ /// </param>
71
+ /// <param name="cancellationToken">
72
+ /// Token used for request cancellation.
73
+ /// </param>
74
+ public async System . Threading . Tasks . Task < DocGenJobsV2025R0 > GetDocgenBatchJobByIdV2025R0Async ( string batchId , GetDocgenBatchJobByIdV2025R0QueryParams ? queryParams = default , GetDocgenBatchJobByIdV2025R0Headers ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
75
+ queryParams = queryParams ?? new GetDocgenBatchJobByIdV2025R0QueryParams ( ) ;
76
+ headers = headers ?? new GetDocgenBatchJobByIdV2025R0Headers ( ) ;
77
+ Dictionary < string , string > queryParamsMap = Utils . PrepareParams ( map : new Dictionary < string , string ? > ( ) { { "marker" , StringUtils . ToStringRepresentation ( queryParams . Marker ) } , { "limit" , StringUtils . ToStringRepresentation ( queryParams . Limit ) } } ) ;
78
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { { "box-version" , StringUtils . ToStringRepresentation ( headers . BoxVersion ) } } , headers . ExtraHeaders ) ) ;
79
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/docgen_batch_jobs/" , StringUtils . ToStringRepresentation ( batchId ) ) , method : "GET" , responseFormat : Box . Sdk . Gen . ResponseFormat . Json ) { Parameters = queryParamsMap , Headers = headersMap , Auth = this . Auth , NetworkSession = this . NetworkSession , CancellationToken = cancellationToken } ) . ConfigureAwait ( false ) ;
80
+ return SimpleJsonSerializer . Deserialize < DocGenJobsV2025R0 > ( NullableUtils . Unwrap ( response . Data ) ) ;
81
+ }
82
+
83
+ /// <summary>
84
+ /// Generates a document using a Box Doc Gen template.
85
+ /// </summary>
86
+ /// <param name="requestBody">
87
+ /// Request body of createDocgenBatchV2025R0 method
88
+ /// </param>
89
+ /// <param name="headers">
90
+ /// Headers of createDocgenBatchV2025R0 method
91
+ /// </param>
92
+ /// <param name="cancellationToken">
93
+ /// Token used for request cancellation.
94
+ /// </param>
95
+ public async System . Threading . Tasks . Task < DocGenBatchBaseV2025R0 > CreateDocgenBatchV2025R0Async ( DocGenBatchCreateRequestV2025R0 requestBody , CreateDocgenBatchV2025R0Headers ? headers = default , System . Threading . CancellationToken ? cancellationToken = null ) {
96
+ headers = headers ?? new CreateDocgenBatchV2025R0Headers ( ) ;
97
+ Dictionary < string , string > headersMap = Utils . PrepareParams ( map : DictionaryUtils . MergeDictionaries ( new Dictionary < string , string ? > ( ) { { "box-version" , StringUtils . ToStringRepresentation ( headers . BoxVersion ) } } , headers . ExtraHeaders ) ) ;
98
+ FetchResponse response = await this . NetworkSession . NetworkClient . FetchAsync ( options : new FetchOptions ( url : string . Concat ( this . NetworkSession . BaseUrls . BaseUrl , "/2.0/docgen_batches" ) , 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 ) ;
99
+ return SimpleJsonSerializer . Deserialize < DocGenBatchBaseV2025R0 > ( NullableUtils . Unwrap ( response . Data ) ) ;
100
+ }
101
+
102
+ }
103
+ }
0 commit comments