acc_sdk 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
acc_sdk-0.5.0/PKG-INFO ADDED
@@ -0,0 +1,754 @@
1
+ Metadata-Version: 2.3
2
+ Name: acc_sdk
3
+ Version: 0.5.0
4
+ Summary: An Unofficial Python Implementation of the Autodesk Construction Cloud API SDK
5
+ License: MIT
6
+ Author: Daniel Byrne
7
+ Author-email: realdanielbyrne@icloud.com
8
+ Maintainer: Daniel Byrne
9
+ Maintainer-email: realdanielbyrne@icloud.com
10
+ Requires-Python: >= 3.12
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Dist: argparse (>=1.4.0,<2.0.0)
16
+ Requires-Dist: flask (>=3.1.0,<4.0.0)
17
+ Requires-Dist: ipython (>=9.0.1,<10.0.0)
18
+ Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
19
+ Requires-Dist: requests (>=2.32.3,<3.0.0)
20
+ Project-URL: Repository, https://github.com/realdanielbyrne/acc_sdk
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Autodesk Construction Cloud SDK
24
+
25
+ ## Introduction
26
+ The Autodesk Construction Cloud, ACC, API for Python helps developers create applications that leverage
27
+ ACC API. This API grew out of my company's need to automate certain aspects of ACC that are not currently
28
+ supported by the ACC web application. The API is a work in progress and will be updated with more services
29
+ as the features are implemented. I am working on adding more services to the `ACC` class, but you can also
30
+ contribute to the project by adding more services.
31
+
32
+ I've currently implemented the following APIs:
33
+
34
+ - The Account Admin API automates creating and managing projects, assigning and managing project users, and managing
35
+ member and partner company directories with teh following APIs:
36
+
37
+ - The Projects API provides methods to create, read, update, and delete projects.
38
+ - The Accoount Users API allows you to add and update groups of users to your account.
39
+ - The Business Units API allows you to createe, update, or get business units in your account.
40
+ - The Companies API provides methods to manage companies, such as adding and updating companies.
41
+ - The Project Users API provides methods to manage project users, such as adding, updating, deleting, and patching permissions for users on a project.
42
+
43
+ - The Forms API provides methods to securely create forms from a template, fill out, modify, and retrieve form data.
44
+ - The Sheets API provides methods to manage sheets and version sets, as well as uploading, publishing, and exporting sheets as pdfs.
45
+ - The Authentication helper class provides methods to authenticate with the ACC using the OAuth2 2-legged
46
+ client credential flow and/or the 3-legged authorization code flows. This class also maintains
47
+ the validity of the Bearer tokens, by refreshing the tokens as they expire, and manages both 2-legged and
48
+ 3-legged tokens at the same time to give you full access to the API services.
49
+
50
+ - The Data Management API allows you to manage files and folders in the project. You can upload, download, and
51
+ delete files, create folders, and move files between folders. The API also provides access to the data stored
52
+ in the ACC Data Management module.
53
+
54
+ - The User Profile API provides an endpoint for gathering profile information from the logged in user.
55
+
56
+ ## Contributing
57
+
58
+ This project is a work in progress and will be updated with more services as the features are implemented. I am
59
+ working on adding more services to the `ACC` class, but you can also contribute to the project by helping me add
60
+ more services.
61
+
62
+ To contribute to the project, please follow the steps below:
63
+
64
+ 1. Fork the repository
65
+ 2. Clone the repository
66
+ 3. Create a new branch
67
+ 4. Make your changes
68
+ 5. Push your changes to your fork
69
+ 6. Create a pull request
70
+
71
+
72
+ The following services are planned for future implementation:
73
+
74
+ - The AutoSpecs API
75
+ - The Assets API
76
+ - The Cost Management API
77
+ - The Data Connector API
78
+ - The Files (Document Management) API
79
+ - The Issues API
80
+ - The Model Coordination API
81
+ - The Locations API
82
+ - The Photos API
83
+ - The Relationships API
84
+ - The RFIs API (beta)
85
+ - The Submittals API
86
+ - The Takeoff API
87
+
88
+
89
+ ## Installation
90
+
91
+ ```bash
92
+ pip install acc_sdk
93
+ poetry install
94
+ ```
95
+
96
+ ## Usage
97
+
98
+ ### Authentication
99
+
100
+ To use the ACC API, you need to create an instance of the `ACC` class. The `ACC` class provides access to the various
101
+ services provided by the ACC API. However, first you need to authenticate with the ACC API.
102
+
103
+ The ACC API uses the OAuth2 2 legged client credential flow and/or the 3 legged authorization code flow. Various API services require
104
+ one or the other flows. The Authentication OAuth helper class provides the necessary methods to
105
+
106
+ - Authenticate with the ACC API using either
107
+ - 2 legged client credential flow
108
+ - 3 legged authorization code flow
109
+ - Maintains the validity of the Bearer tokens, by refreshing the tokens as they expire
110
+ - Manages both 2-legged and 3-legged tokens at the same time to give you full access to the API services
111
+
112
+ The following code snippet shows how to authenticate with the ACC API using the 2 legged client credential flow.
113
+
114
+ ```python
115
+ import os
116
+ from accapi import Authentication, Acc
117
+ from dotenv import load_dotenv
118
+ load_dotenv()
119
+
120
+ # Load your environment variables
121
+ ACCOUNT_ID = os.environ.get('AUTODESK_ACCOUNT_ID')
122
+ CLIENT_ID = os.environ.get('AUTODESK_CLIENT_ID_WEB_APP'),
123
+ CLIENT_SECRET = os.environ.get('AUTODESK_CLIENT_SECRET_WEB_APP')
124
+ ADMIN_EMAIL = os.environ.get("ADMIN_EMAIL")
125
+
126
+ # Define the scopes
127
+ scopes = [
128
+ "user-profile:read",
129
+ "user:read",
130
+ "user:write",
131
+ "viewables:read",
132
+ "data:read",
133
+ "data:write",
134
+ "data:create",
135
+ "data:search",
136
+ "bucket:create",
137
+ "bucket:read",
138
+ "bucket:update",
139
+ "bucket:delete",
140
+ "code:all",
141
+ "account:read",
142
+ "account:write"
143
+ ]
144
+
145
+ # Initalize the class
146
+ auth_client = Authentication(
147
+ session={},
148
+ client_id=CLIENT_ID,
149
+ client_secret=CLIENT_SECRET,
150
+ admin_email="youremail@adomain.com"
151
+ )
152
+
153
+ # Request the 2 legged token
154
+ auth_client.request_2legged_token(scopes=scopes)
155
+ assert auth_client._session["accapi_2legged"]
156
+ ```
157
+
158
+ The following code snippet shows how to authenticate with the ACC API using the 3 legged authorization code flow.
159
+
160
+ ```python
161
+ import os
162
+ from flask import Flask, request, render_template, redirect, url_for, session, jsonify
163
+ from accapi import Authentication, Acc
164
+ from dotenv import load_dotenv
165
+ load_dotenv()
166
+
167
+ app = Flask(__name__)
168
+ app.secret_key = os.environ.get("FLASK_SESSION_KEY") # Required for session usage
169
+ CLIENT_ID = os.environ.get("AUTODESK_CLIENT_ID_WEB_APP")
170
+ CLIENT_SECRET = os.environ.get("AUTODESK_CLIENT_SECRET_WEB_APP")
171
+ ADMIN_EMAIL = os.environ.get("ADMIN_EMAIL")
172
+ CALLBACK_URL = "http://127.0.0.1:5000/callback"
173
+ ACCOUNT_ID = os.environ.get("AUTODESK_ACCOUNT_ID")
174
+ SCOPES = [
175
+ "user-profile:read",
176
+ "user:read",
177
+ "user:write",
178
+ "viewables:read",
179
+ "data:read",
180
+ "data:write",
181
+ "data:create",
182
+ "account:read",
183
+ "account:write",
184
+ ]
185
+ @app.route("/", methods=["GET"])
186
+ def index():
187
+ session.clear()
188
+ return render_template("index.html")
189
+
190
+ @app.route("/login", methods=["POST"])
191
+ def login():
192
+ """Called from form submission on index.html. Initiates OAuth2 flow.
193
+ Redirects to callback URL if successful, or an error message if not.
194
+ """
195
+ email = request.form.get("email")
196
+ session["user_email"] = email
197
+ auth = Authentication(session,CLIENT_ID,CLIENT_SECRET, session["user_email"], CALLBACK_URL)
198
+
199
+ authorization_url = auth.get_authorization_url(scopes=SCOPES)
200
+ return redirect(authorization_url)
201
+
202
+ @app.route("/callback", methods=["GET"])
203
+ def callback():
204
+ """Second step in the OAuth2 flow. Exchanges auth code for access token.
205
+ Redirects to dashboard if successful, or an error message if not.
206
+ """
207
+ code = request.args.get("code")
208
+ if not code:
209
+ return "No authorization code received.", 400
210
+
211
+ # Rebuild the Authentication object from the session
212
+ auth = Authentication(session,CLIENT_ID,CLIENT_SECRET, session["user_email"], CALLBACK_URL)
213
+ token_data = auth.request_authcode_access_token(code=code, scopes=SCOPES)
214
+ if not token_data:
215
+ return "Failed to exchange code for token", 400
216
+
217
+ return redirect(url_for("dashboard"))
218
+
219
+ @app.route("/dashboard", methods=["GET"])
220
+ def dashboard():
221
+ """ Final destination of 3 legged Authenticatin flow. """
222
+
223
+ # Rebuild the Authentication object from the session
224
+ auth = Authentication(session,CLIENT_ID,CLIENT_SECRET, session["user_email"], CALLBACK_URL)
225
+
226
+ # Build an ACC instance (accapi) with the user’s authentication context
227
+ acc = Acc(auth_client=auth, account_id=ACCOUNT_ID)
228
+ return render_template("dashboard.html")
229
+
230
+ def run():
231
+ app.run(debug=True)
232
+
233
+ if __name__ == "__main__":
234
+ run()
235
+
236
+ ```
237
+
238
+
239
+ ### Initialization
240
+
241
+ Once you have authenticated with the ACC API, you can create an instance of the `ACC` class. The `ACC` class provides access to the various services provided by the ACC API.
242
+ The account id is an optional argument. If you do not provide the account id, the class will attempt to get the Account Id from the 2-legged token. Not providing the account
243
+ id will not limit the services you can access if you have both the 2-legged and 3-legged tokens and the appropriate scopes.
244
+
245
+
246
+ ```python
247
+ from accapi import Acc
248
+ acc = Acc(auth_client=auth_client, account_id=ACCOUNT_ID)
249
+ ```
250
+
251
+ The account id is an optional argument. If you do not provide the account id, the class will attempt to get the Account Id from the 2-legged token. Not providing the account
252
+ id will not limit the APIs you can access. Best is to provide both 2-legged and 3-legged tokens in the Authentication class with and the appropriate scopes so that
253
+ you can access all the APIs.
254
+
255
+
256
+ ## Making API Requests
257
+
258
+ Making API requests is simple. You can access the various services provided by the ACC API by calling the appropriate method on the `ACC` class. The following code snippets shows a few common examples of making API calls with the library.
259
+
260
+ ### Managing Projects
261
+
262
+ The `AccProjectsApi` provides methods to manage projects within Autodesk Construction Cloud (ACC), including creating new projects, fetching project details, and updating project information.
263
+
264
+ #### Get All Active Projects
265
+
266
+ Gets all projects that are active in the account.
267
+
268
+ ```python
269
+ projects = acc.projects.get_all_active_projects()
270
+ ```
271
+
272
+ #### Get Active Projects With Pagination
273
+
274
+ Gets all projects that are active in the account but limits the number of projects returned.
275
+
276
+ ```python
277
+ projects = acc.projects.get_active_projects(filter_params={'limit': 10, 'offset': 0})
278
+ ```
279
+
280
+ #### Get All Projects
281
+
282
+ Gets all projects in the account.
283
+
284
+ ```python
285
+ projects = acc.projects.get_projects()
286
+ ```
287
+
288
+ #### Get Limited Project Details
289
+
290
+ Get Projects and limit the metadata fields returned.
291
+ ```python
292
+ projects = acc.projects.get_projects(filter_params={'fields':"accountId,name,jobNumber"})
293
+ print(projects[0])
294
+ ```
295
+
296
+ #### Get Projects Filtered
297
+
298
+ Here we show how to get active projects with a specific status, and limit the metadata fields returned.
299
+
300
+ ```python
301
+ active_build_projects_params = {
302
+ 'fields': 'name,jobNumber,type,status',
303
+ 'filter[status]': 'active',
304
+ 'filterTextMatch': 'equals'
305
+ }
306
+ projects = acc.projects.get_projects(filter_params=active_build_projects_params)
307
+ ```
308
+
309
+ #### Create a project
310
+
311
+ Creates a new project. You can create the project directly,
312
+ or clone it from a project template.
313
+
314
+ The project dictionary needs at least name and type fields defined,l and the
315
+ name must be unique even among deleted projects since they are not actually deleted.
316
+
317
+ ```python
318
+ test_project = {
319
+ "jobNumber": "9999W",
320
+ "name": "My unique project name",
321
+ "type": "Wall Construction",
322
+ "latitude": "34.7749",
323
+ "longitude": "-125.4194",
324
+ "timezone":"America/Chicago"
325
+ }
326
+ new_project = acc.projects.post_project(test_project)
327
+ ```
328
+
329
+ #### Create a list of projects
330
+
331
+ ```python
332
+ def get_active_projects():
333
+ jobs_dict = get_active_jobs_from_your_db()
334
+
335
+ # map project types to template ids
336
+ template_mapping = {
337
+ 'ProjectType1': {'projectId': 'c506442f-0ba5-4d9d-9ff8-70e0b02935b1'},
338
+ 'ProjectType2': {'projectId': '38c0c641-d6ba-4772-873d-7740c5bdf8f1'},
339
+ 'ProjectType3': {'projectId': '5758b3a0-36a4-41e9-8143-8fde80419eb6'},
340
+ 'ProjectType4': {'projectId': '636cfcf8-cd99-4086-af74-4c7384653d40'}
341
+ }
342
+ for project in result:
343
+ project['template'] = template_mapping.get(project['type'])
344
+
345
+ return result
346
+
347
+ def create_projects(projects):
348
+ if projects is None or len(projects) == 0:
349
+ return
350
+ for project in projects:
351
+ project['id'] = acc.projects.post_project(project)
352
+ return projects
353
+
354
+ jobs = get_active_projects()
355
+ new_projects = create_projects(jobs)
356
+ ```
357
+
358
+ ### Managing Account Users
359
+
360
+ The `AccAccountUsersApi` provides comprehensive methods to manage users within your Autodesk Construction Cloud (ACC) account, including fetching user details, searching users, creating new users, bulk importing users, and updating user status or associations.
361
+
362
+ #### Get All Account Users
363
+
364
+ Retrieve a complete list of users associated with the account.
365
+
366
+ ```python
367
+ users = acc.account_users.get_users()
368
+ print(users)
369
+ ```
370
+
371
+ #### Get User by Email
372
+
373
+ Fetch details of a specific user using their email address.
374
+
375
+ ```python
376
+ user_email = "user@example.com"
377
+ user = acc.account_users.get_user_by_email(user_email)
378
+ print(user)
379
+ ```
380
+
381
+ #### Search Users by Name
382
+
383
+ Search for users within the account by their name.
384
+
385
+ ```python
386
+ users_named_daniel = acc.account_users.get_users_search(name="Daniel")
387
+ print(users_named_daniel)
388
+ ```
389
+
390
+ #### Create a Single User
391
+
392
+ Add a new user to the account by providing at least an email and a company ID.
393
+
394
+ ```python
395
+ new_user = {
396
+ "email": "newuser@example.com",
397
+ "company_id": "company123"
398
+ }
399
+ created_user = acc.account_users.post_user(new_user)
400
+ print(created_user)
401
+ ```
402
+
403
+ #### Bulk Import Users
404
+
405
+ Import multiple users at once by providing a list of user details.
406
+
407
+ ```python
408
+ users_to_import = [
409
+ {"email": "user1@example.com", "company_id": "company123"},
410
+ {"email": "user2@example.com", "company_id": "company123"},
411
+ ]
412
+ import_result = acc.account_users.post_users(users_to_import)
413
+ print(import_result)
414
+ ```
415
+
416
+ #### Update User Status or Company Association
417
+
418
+ Modify an existing user's status or assign them to a different company.
419
+
420
+ ```python
421
+ updated_user = acc.account_users.patch_user(
422
+ user_email="existinguser@example.com",
423
+ status="active",
424
+ company_id="newcompany123"
425
+ )
426
+ print(updated_user)
427
+ ```
428
+
429
+ ### Managing Project Users
430
+
431
+ The `AccProjectUsersApi` provides extensive methods to manage users within your Autodesk Construction Cloud (ACC) projects, including retrieving user details, adding new users individually or in bulk, updating permissions, and removing users.
432
+
433
+ #### Get Users from a Project
434
+
435
+ Retrieve all or a filtered subset of users from a specific project.
436
+
437
+ ```python
438
+ project_id = "your_project_uuid"
439
+ users = acc.project_users.get_users(project_id)
440
+ print(users)
441
+ ```
442
+
443
+ To paginate through results or apply filters:
444
+
445
+ ```python
446
+ filtered_users = acc.project_users.get_users(project_id, query_params={"limit": 50}, follow_pagination=True)
447
+ ```
448
+
449
+ #### Get Detailed User Information
450
+
451
+ Fetch detailed information for a specific user in a project.
452
+
453
+ ```python
454
+ user_info = acc.project_users.get_user(project_id="your_project_uuid", user_id="user_uuid")
455
+ print(user_info)
456
+ ```
457
+
458
+ #### Add a Single User to a Project
459
+
460
+ Add a new user by specifying their email and product access.
461
+
462
+ ```python
463
+ new_user = {
464
+ "email": "user@example.com",
465
+ "products": AccProjectUsersApi.productmember
466
+ }
467
+ created_user = acc.project_users.add_user(project_id="your_project_uuid", user=new_user)
468
+ print(created_user)
469
+ ```
470
+
471
+ #### Import Users to a Project (Bulk)
472
+
473
+ Efficiently add multiple users at once. Provide a list of users with their email and desired products.
474
+
475
+ ```python
476
+ bulk_users = [
477
+ {"email": "user1@example.com", "products": AccProjectUsersApi.productmember},
478
+ {"email": "user2@example.com", "products": AccProjectUsersApi.productadmin}
479
+ ]
480
+
481
+ acc.project_users.import_users(project_id="your_project_uuid", users=bulk_users)
482
+ ```
483
+
484
+ #### Update User Permissions
485
+
486
+ Update permissions or product access for a specific user.
487
+
488
+ ```python
489
+ update_data = {"products": AccProjectUsersApi.productadmin}
490
+ updated_user = acc.project_users.patch(project_id="your_project_uuid", target_user_id="user_uuid", data=update_data)
491
+ print(updated_user)
492
+ ```
493
+
494
+ #### Batch Update Users Across Multiple Projects
495
+
496
+ Apply product or permission updates to multiple users across several projects.
497
+
498
+ ```python
499
+ projects = acc.projects.get_all_active_projects()
500
+ users = [
501
+ {"email": "user@example.com", "products": AccProjectUsersApi.productadmin},
502
+ {"email": "anotheruser@example.com", "products": AccProjectUsersApi.productmember}
503
+ ]
504
+
505
+ acc.project_users.patch_project_users(projects=projects, users=users)
506
+ ```
507
+
508
+ #### Delete a User from a Project
509
+
510
+ Remove an individual user from a specific project.
511
+
512
+ ```python
513
+ acc.project_users.delete(project_id="your_project_uuid", target_user_id="user_uuid")
514
+ ```
515
+
516
+ #### Bulk Delete Users from a Project
517
+
518
+ Remove multiple users by specifying their email addresses.
519
+
520
+ ```python
521
+ users_to_remove = [
522
+ {"email": "user1@example.com"},
523
+ {"email": "user2@example.com"}
524
+ ]
525
+
526
+ acc.project_users.delete_users(project_id="your_project_uuid", users=users_to_remove)
527
+ ```
528
+
529
+
530
+ ### Managing Forms
531
+
532
+ The `AccFormsApi` provides methods to interact with forms within Autodesk Construction Cloud (ACC), allowing users to retrieve, create, and modify form data.
533
+
534
+ #### Retrieve Forms
535
+
536
+ Fetch forms from a project with optional filtering and pagination.
537
+
538
+ ```python
539
+ forms = acc.forms.get_forms(project_id="your_project_id", limit=10)
540
+ print(forms)
541
+ ```
542
+
543
+ #### Retrieve Form Templates
544
+
545
+ Get available form templates for a project.
546
+
547
+ ```python
548
+ templates = acc.forms.get_templates(project_id="your_project_id")
549
+ print(templates)
550
+ ```
551
+
552
+ #### Get Forms from the Past 30 Days
553
+
554
+ Fetch forms created within the last 30 days.
555
+
556
+ ```python
557
+ recent_forms = acc.forms.get_forms_for_past30(project_id="your_project_id")
558
+ print(recent_forms)
559
+ ```
560
+
561
+ #### Create a New Form
562
+
563
+ Create a form based on a template.
564
+
565
+ ```python
566
+ form_data = {"customValues": {"field1": "value1"}}
567
+ new_form = acc.forms.post_form(project_id="your_project_id", template_id="template_id", data=form_data)
568
+ print(new_form)
569
+ ```
570
+
571
+ #### Update Form Details
572
+
573
+ Update existing form details.
574
+
575
+ ```python
576
+ update_data = {"customValues": {"field1": "updated_value"}}
577
+ updated_form = acc.forms.patch_form(project_id="your_project_id", template_id="template_id", form_id="form_id", data=update_data)
578
+ print(updated_form)
579
+ ```
580
+
581
+ #### Update Form Fields
582
+
583
+ Batch update form fields, both tabular and non-tabular.
584
+
585
+ ```python
586
+ batch_data = {"customValues": {"field1": "new_value"}}
587
+ updated_fields = acc.forms.put_form(project_id="your_project_id", form_id="form_id", data=batch_data)
588
+ print(updated_fields)
589
+ ```
590
+
591
+ ### Using the Sheets API
592
+
593
+ The `AccSheetsApi` class provides methods to manage sheets, version sets, uploads, exports, and collections within Autodesk Construction Cloud (ACC).
594
+ Ensure your `Authentication` instance has a 3-legged token with scopes `data:read` and `data:write` to use these methods.
595
+
596
+ Below are the main functionalities, along with usage examples:
597
+
598
+ #### Managing Version Sets
599
+
600
+ Version sets group sheets by their issuance date.
601
+
602
+ **Create a Version Set**
603
+
604
+ ```python
605
+ from datetime import datetime
606
+ version_set = acc.sheets.create_version_set(
607
+ project_id="your_project_id",
608
+ issuance_date="2024-03-25",
609
+ name="Version Set 1"
610
+ )
611
+ ```
612
+
613
+ **Get All Version Sets**
614
+
615
+ ```python
616
+ version_sets = acc.sheets.get_version_sets(project_id="your_project_id")
617
+ ```
618
+
619
+ **Update a Version Set**
620
+
621
+ ```python
622
+ acc.sheets.patch_version_set(
623
+ project_id="your_project_id",
624
+ version_set_id="version_set_id",
625
+ issuance_date="2024-03-26",
626
+ name="Updated Version Set"
627
+ )
628
+ ```
629
+
630
+ **Delete a Version Set**
631
+
632
+ ```python
633
+ acc.sheets.delete_version_set(
634
+ project_id="your_project_id",
635
+ version_set_id="version_set_id"
636
+ )
637
+ ```
638
+
639
+ #### Uploading Sheets
640
+
641
+ Upload sheets to Autodesk using Object Storage Service (OSS).
642
+
643
+ **Upload PDF to Autodesk**
644
+
645
+ ```python
646
+ bucket_key, object_key = acc.sheets.upload_file_to_autodesk("project_id", "sheet.pdf")
647
+ signed_url_info = acc.sheets.get_signed_s3_upload(bucket_key, object_key)
648
+ status_code = acc.sheets.upload_pdf_to_signed_url(signed_url_info["url"], "path/to/sheet.pdf")
649
+ upload_response = acc.sheets.complete_s3_upload(bucket_key, object_key, signed_url_info["uploadKey"])
650
+ ```
651
+
652
+ #### Managing Sheets
653
+
654
+ **Retrieve Sheets**
655
+
656
+ ```python
657
+ sheets = acc.sheets.get_sheets(project_id="your_project_id", follow_pagination=True)
658
+ ```
659
+
660
+ **Batch Update Sheets**
661
+
662
+ ```python
663
+ updated_sheets = acc.sheets.batch_update_sheets(
664
+ project_id="your_project_id",
665
+ ids=["sheet_id_1", "sheet_id_2"],
666
+ updates={"versionSetId": "new_version_set_id"}
667
+ )
668
+ ```
669
+
670
+ **Batch Delete Sheets**
671
+
672
+ ```python
673
+ acc.sheets.batch_delete_sheets(
674
+ project_id="your_project_id",
675
+ ids=["sheet_id_1", "sheet_id_2"]
676
+ )
677
+ ```
678
+
679
+ #### Exporting Sheets
680
+
681
+ Export sheets as PDF files.
682
+
683
+ **Create Export Job**
684
+
685
+ ```python
686
+ export_job = acc.sheets.export_sheets(
687
+ project_id="your_project_id",
688
+ options={"outputFileName": "sheets_export.pdf"},
689
+ sheets=["sheet_id_1", "sheet_id_2"]
690
+ )
691
+ ```
692
+
693
+ **Check Export Status**
694
+
695
+ ```python
696
+ export_status = acc.sheets.get_export_status(
697
+ project_id="your_project_id",
698
+ export_id=export_job["id"]
699
+ )
700
+ ```
701
+
702
+ #### Managing Collections
703
+
704
+ Collections organize sheets within a project.
705
+
706
+ **Retrieve All Collections**
707
+
708
+ ```python
709
+ collections = acc.sheets.get_collections(project_id="your_project_id", follow_pagination=True)
710
+ ```
711
+
712
+ **Retrieve a Specific Collection**
713
+
714
+ ```python
715
+ collection = acc.sheets.get_collection(
716
+ project_id="your_project_id",
717
+ collection_id="collection_id"
718
+ )
719
+ ```
720
+
721
+ ## Required Scopes and Token Types
722
+
723
+ The scopes and token types needed by API:
724
+
725
+ - AccProjectUsersApi
726
+ - Requires the `data:read` scope for GET and `data:write` scope for POST and PATCH
727
+ - Requires either a 2-legged or 3-legged token
728
+ - AccProjectsApi
729
+ - Requires the `account:read` scope for GET and `account:write` scope for POST and PATCH
730
+ - Requires either a 2-legged or 3-legged token
731
+ - AccSheetsApi
732
+ - Requires the `data:read` and `data:write` scopes
733
+ - Requires a 3-legged token
734
+ - AccDataManagementApi
735
+ - Requires the `data:read` and `data:write` scopes
736
+ - AccBusinessUnitsApi
737
+ - Requires the `account:read` and `account:write` scopes
738
+ - Requires either a 2-legged token
739
+ - AccCompaniesApi
740
+ - Requires the `account:read` and `account:write` scopes
741
+ - Requires a 2-legged token for POST and PATCH requests, and a 2 or 3-legged token for GET requests.
742
+ - AccFormsApi
743
+ - Requires the `data:read` and `data:write` scopes and a 3-legged token
744
+ - Requires a 3-legged token
745
+ - AccAccountUsersApi
746
+ - Requires the `account:read` and `account:write` scopes
747
+ - AccSheetsApi
748
+ - Requires the `data:read` and `data:write` scopes
749
+ - Requires a 3-legged token
750
+ - AccUserProfileApi
751
+ - Requires the `user-profile:read` scope
752
+ - Requires a 3-legged token
753
+
754
+