Skip to content

Commit 0d3bc18

Browse files
feat: Support Box Doc Gen API (box/box-codegen#644) (#486)
1 parent 0592f7b commit 0d3bc18

31 files changed

+4350
-1
lines changed

.codegen.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "engineHash": "7a56da0", "specHash": "091b558", "version": "1.10.0" }
1+
{ "engineHash": "ead925a", "specHash": "091b558", "version": "1.10.0" }

docs/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ the SDK are available by topic:
1616
- [Collections](collections.md)
1717
- [Comments](comments.md)
1818
- [Device pinners](devicePinners.md)
19+
- [Docgen](docgen.md)
20+
- [Docgen template](docgenTemplate.md)
1921
- [Downloads](downloads.md)
2022
- [Email aliases](emailAliases.md)
2123
- [Events](events.md)

docs/docgen.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# DocgenManager
2+
3+
- [Get Box Doc Gen job by ID](#get-box-doc-gen-job-by-id)
4+
- [List all Box Doc Gen jobs](#list-all-box-doc-gen-jobs)
5+
- [Get Box Doc Gen jobs in a batch with a specific ID](#get-box-doc-gen-jobs-in-a-batch-with-a-specific-id)
6+
- [Generate document using a Box Doc Gen template](#generate-document-using-a-box-doc-gen-template)
7+
8+
## Get Box Doc Gen job by ID
9+
10+
Get details of the Box Doc Gen job.
11+
12+
This operation is performed by calling function `getDocgenJobByIdV2025R0`.
13+
14+
See the endpoint docs at
15+
[API Reference](https://developer.box.com/reference/get-docgen-jobs-id-v2025.0/).
16+
17+
<!-- sample get_docgen_jobs_id_v2025.0 -->
18+
19+
```ts
20+
await client.docgen.getDocgenJobByIdV2025R0(docgenJobs.entries![0].id);
21+
```
22+
23+
### Arguments
24+
25+
- jobId `string`
26+
- Box Doc Gen job ID. Example: 123
27+
- optionalsInput `GetDocgenJobByIdV2025R0OptionalsInput`
28+
-
29+
30+
### Returns
31+
32+
This function returns a value of type `DocGenJobV2025R0`.
33+
34+
Details of the Box Doc Gen job.
35+
36+
## List all Box Doc Gen jobs
37+
38+
Lists all Box Doc Gen jobs for a user.
39+
40+
This operation is performed by calling function `getDocgenJobsV2025R0`.
41+
42+
See the endpoint docs at
43+
[API Reference](https://developer.box.com/reference/get-docgen-jobs-v2025.0/).
44+
45+
<!-- sample get_docgen_jobs_v2025.0 -->
46+
47+
```ts
48+
await client.docgen.getDocgenJobsV2025R0();
49+
```
50+
51+
### Arguments
52+
53+
- queryParams `GetDocgenJobsV2025R0QueryParams`
54+
- Query parameters of getDocgenJobsV2025R0 method
55+
- headersInput `GetDocgenJobsV2025R0HeadersInput`
56+
- Headers of getDocgenJobsV2025R0 method
57+
- cancellationToken `undefined | CancellationToken`
58+
- Token used for request cancellation.
59+
60+
### Returns
61+
62+
This function returns a value of type `DocGenJobsFullV2025R0`.
63+
64+
A list of Box Doc Gen jobs.
65+
66+
## Get Box Doc Gen jobs in a batch with a specific ID
67+
68+
Lists Box Doc Gen jobs in a batch
69+
70+
This operation is performed by calling function `getDocgenBatchJobByIdV2025R0`.
71+
72+
See the endpoint docs at
73+
[API Reference](https://developer.box.com/reference/get-docgen-batch-jobs-id-v2025.0/).
74+
75+
<!-- sample get_docgen_batch_jobs_id_v2025.0 -->
76+
77+
```ts
78+
await client.docgen.getDocgenBatchJobByIdV2025R0(docgenBatch.id);
79+
```
80+
81+
### Arguments
82+
83+
- batchId `string`
84+
- Box Doc Gen batch ID. Example: 123
85+
- optionalsInput `GetDocgenBatchJobByIdV2025R0OptionalsInput`
86+
-
87+
88+
### Returns
89+
90+
This function returns a value of type `DocGenJobsV2025R0`.
91+
92+
Returns a list of Box Doc Gen jobs in a Box Doc Gen batch.
93+
94+
## Generate document using a Box Doc Gen template
95+
96+
Generates a document using a Box Doc Gen template.
97+
98+
This operation is performed by calling function `createDocgenBatchV2025R0`.
99+
100+
See the endpoint docs at
101+
[API Reference](https://developer.box.com/reference/post-docgen-batches-v2025.0/).
102+
103+
<!-- sample post_docgen_batches_v2025.0 -->
104+
105+
```ts
106+
await client.docgen.createDocgenBatchV2025R0({
107+
file: new FileReferenceV2025R0({ id: uploadedFile.id }),
108+
inputSource: 'api',
109+
destinationFolder: new DocGenBatchCreateRequestV2025R0DestinationFolderField({
110+
id: folder.id,
111+
}),
112+
outputType: 'pdf',
113+
documentGenerationData: [
114+
{
115+
generatedFileName: 'test',
116+
userInput: { ['abc']: 'xyz' },
117+
} satisfies DocGenDocumentGenerationDataV2025R0,
118+
],
119+
} satisfies DocGenBatchCreateRequestV2025R0);
120+
```
121+
122+
### Arguments
123+
124+
- requestBody `DocGenBatchCreateRequestV2025R0`
125+
- Request body of createDocgenBatchV2025R0 method
126+
- optionalsInput `CreateDocgenBatchV2025R0OptionalsInput`
127+
-
128+
129+
### Returns
130+
131+
This function returns a value of type `DocGenBatchBaseV2025R0`.
132+
133+
The created Batch ID.

docs/docgenTemplate.md

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
# DocgenTemplateManager
2+
3+
- [Create a Box Doc Gen template](#create-a-box-doc-gen-template)
4+
- [List Box Doc Gen templates](#list-box-doc-gen-templates)
5+
- [Delete Box Doc Gen template](#delete-box-doc-gen-template)
6+
- [Get Box Doc Gen template by ID](#get-box-doc-gen-template-by-id)
7+
- [List all Box Doc Gen template tags in template](#list-all-box-doc-gen-template-tags-in-template)
8+
- [Get list of all Box Doc Gen jobs for template](#get-list-of-all-box-doc-gen-jobs-for-template)
9+
10+
## Create a Box Doc Gen template
11+
12+
Marks a file as a Box Doc Gen template.
13+
14+
This operation is performed by calling function `createDocgenTemplateV2025R0`.
15+
16+
See the endpoint docs at
17+
[API Reference](https://developer.box.com/reference/post-docgen-templates-v2025.0/).
18+
19+
<!-- sample post_docgen_templates_v2025.0 -->
20+
21+
```ts
22+
await client.docgenTemplate.createDocgenTemplateV2025R0({
23+
file: new FileReferenceV2025R0({ id: uploadedFile.id }),
24+
} satisfies DocGenTemplateCreateRequestV2025R0);
25+
```
26+
27+
### Arguments
28+
29+
- requestBody `DocGenTemplateCreateRequestV2025R0`
30+
- Request body of createDocgenTemplateV2025R0 method
31+
- optionalsInput `CreateDocgenTemplateV2025R0OptionalsInput`
32+
-
33+
34+
### Returns
35+
36+
This function returns a value of type `DocGenTemplateBaseV2025R0`.
37+
38+
The file which has now been marked as a Box Doc Gen template.
39+
40+
## List Box Doc Gen templates
41+
42+
Lists Box Doc Gen templates on which the user is a collaborator.
43+
44+
This operation is performed by calling function `getDocgenTemplatesV2025R0`.
45+
46+
See the endpoint docs at
47+
[API Reference](https://developer.box.com/reference/get-docgen-templates-v2025.0/).
48+
49+
<!-- sample get_docgen_templates_v2025.0 -->
50+
51+
```ts
52+
await client.docgenTemplate.getDocgenTemplatesV2025R0();
53+
```
54+
55+
### Arguments
56+
57+
- queryParams `GetDocgenTemplatesV2025R0QueryParams`
58+
- Query parameters of getDocgenTemplatesV2025R0 method
59+
- headersInput `GetDocgenTemplatesV2025R0HeadersInput`
60+
- Headers of getDocgenTemplatesV2025R0 method
61+
- cancellationToken `undefined | CancellationToken`
62+
- Token used for request cancellation.
63+
64+
### Returns
65+
66+
This function returns a value of type `DocGenTemplatesV2025R0`.
67+
68+
Returns a collection of templates.
69+
70+
## Delete Box Doc Gen template
71+
72+
Unmarks file as Box Doc Gen template
73+
74+
This operation is performed by calling function `deleteDocgenTemplateByIdV2025R0`.
75+
76+
See the endpoint docs at
77+
[API Reference](https://developer.box.com/reference/delete-docgen-templates-id-v2025.0/).
78+
79+
<!-- sample delete_docgen_templates_id_v2025.0 -->
80+
81+
```ts
82+
await client.docgenTemplate.deleteDocgenTemplateByIdV2025R0(
83+
createdDocgenTemplate.file!.id,
84+
);
85+
```
86+
87+
### Arguments
88+
89+
- templateId `string`
90+
- ID of the file which will no longer be marked as a Box Doc Gen template. Example: "123"
91+
- optionalsInput `DeleteDocgenTemplateByIdV2025R0OptionalsInput`
92+
-
93+
94+
### Returns
95+
96+
This function returns a value of type `undefined`.
97+
98+
Returns an empty response when a file is no longer marked as a Box Doc Gen template.
99+
100+
## Get Box Doc Gen template by ID
101+
102+
Lists details of a specific Box Doc Gen template.
103+
104+
This operation is performed by calling function `getDocgenTemplateByIdV2025R0`.
105+
106+
See the endpoint docs at
107+
[API Reference](https://developer.box.com/reference/get-docgen-templates-id-v2025.0/).
108+
109+
<!-- sample get_docgen_templates_id_v2025.0 -->
110+
111+
```ts
112+
await client.docgenTemplate.getDocgenTemplateByIdV2025R0(
113+
createdDocgenTemplate.file!.id,
114+
);
115+
```
116+
117+
### Arguments
118+
119+
- templateId `string`
120+
- The ID of a Box Doc Gen template. Example: 123
121+
- optionalsInput `GetDocgenTemplateByIdV2025R0OptionalsInput`
122+
-
123+
124+
### Returns
125+
126+
This function returns a value of type `DocGenTemplateV2025R0`.
127+
128+
Returns a template.
129+
130+
## List all Box Doc Gen template tags in template
131+
132+
Lists all tags in a Box Doc Gen template.
133+
134+
This operation is performed by calling function `getDocgenTemplateTagsV2025R0`.
135+
136+
See the endpoint docs at
137+
[API Reference](https://developer.box.com/reference/get-docgen-templates-id-tags-v2025.0/).
138+
139+
<!-- sample get_docgen_templates_id_tags_v2025.0 -->
140+
141+
```ts
142+
await client.docgenTemplate.getDocgenTemplateTagsV2025R0(
143+
fetchedDocgenTemplate.file!.id,
144+
);
145+
```
146+
147+
### Arguments
148+
149+
- templateId `string`
150+
- ID of template. Example: 123
151+
- optionalsInput `GetDocgenTemplateTagsV2025R0OptionalsInput`
152+
-
153+
154+
### Returns
155+
156+
This function returns a value of type `DocGenTagsV2025R0`.
157+
158+
A list of document generation template tags.Processing tags for the file.
159+
160+
## Get list of all Box Doc Gen jobs for template
161+
162+
Lists the users jobs which use this template.
163+
164+
This operation is performed by calling function `getDocgenTemplateJobByIdV2025R0`.
165+
166+
See the endpoint docs at
167+
[API Reference](https://developer.box.com/reference/get-docgen-template-jobs-id-v2025.0/).
168+
169+
<!-- sample get_docgen_template_jobs_id_v2025.0 -->
170+
171+
```ts
172+
await client.docgenTemplate.getDocgenTemplateJobByIdV2025R0(
173+
fetchedDocgenTemplate.file!.id,
174+
);
175+
```
176+
177+
### Arguments
178+
179+
- templateId `string`
180+
- Id of template to fetch jobs for. Example: 123
181+
- optionalsInput `GetDocgenTemplateJobByIdV2025R0OptionalsInput`
182+
-
183+
184+
### Returns
185+
186+
This function returns a value of type `DocGenJobsV2025R0`.
187+
188+
A single Box Doc Gen template.

src/client.generated.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ import { WorkflowsManager } from './managers/workflows.generated.js';
7272
import { SignTemplatesManager } from './managers/signTemplates.generated.js';
7373
import { IntegrationMappingsManager } from './managers/integrationMappings.generated.js';
7474
import { AiManager } from './managers/ai.generated.js';
75+
import { DocgenTemplateManager } from './managers/docgenTemplate.generated.js';
76+
import { DocgenManager } from './managers/docgen.generated.js';
7577
import { Authentication } from './networking/auth.generated.js';
7678
import { NetworkSession } from './networking/network.generated.js';
7779
import { BoxSdkError } from './box/errors.js';
@@ -163,6 +165,8 @@ export class BoxClient {
163165
readonly signTemplates: SignTemplatesManager;
164166
readonly integrationMappings: IntegrationMappingsManager;
165167
readonly ai: AiManager;
168+
readonly docgenTemplate: DocgenTemplateManager;
169+
readonly docgen: DocgenManager;
166170
constructor(
167171
fields: Omit<
168172
BoxClient,
@@ -236,6 +240,8 @@ export class BoxClient {
236240
| 'signTemplates'
237241
| 'integrationMappings'
238242
| 'ai'
243+
| 'docgenTemplate'
244+
| 'docgen'
239245
| 'networkSession'
240246
| 'makeRequest'
241247
| 'withAsUserHeader'
@@ -540,6 +546,14 @@ export class BoxClient {
540546
auth: this.auth,
541547
networkSession: this.networkSession,
542548
});
549+
this.docgenTemplate = new DocgenTemplateManager({
550+
auth: this.auth,
551+
networkSession: this.networkSession,
552+
});
553+
this.docgen = new DocgenManager({
554+
auth: this.auth,
555+
networkSession: this.networkSession,
556+
});
543557
}
544558
/**
545559
* Make a custom http request using the client authentication and network session.

0 commit comments

Comments
 (0)