Skip to content

Commit 0e2d24f

Browse files
authored
Merge pull request #103 from rogers-obrien-rad/feature/drawings
Feature/drawings
2 parents 7e2af9d + 496694e commit 0e2d24f

18 files changed

Lines changed: 218899 additions & 93 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,5 @@ replay_pid*
225225
# snippet testing files
226226
*snippets_*
227227
specs/
228-
sample_responses/
228+
sample_responses/
229+
.DS_Store

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [0.7.1] - 2025-06-19
4+
5+
### Added
6+
* `submittals`: add `get_types()` method with snippets in `submittals.ipynb`
7+
8+
### Changed
9+
* `submittals`: add `types` parameter to `get()` method
10+
311
## [0.7.0] - 2025-06-18
412

513
### Added

ProPyCore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
from .exceptions import *
44
from .procore import Procore
55

6-
__version__ = "0.7.0"
6+
__version__ = "0.8.0"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from .sets import Sets
2+
from .revisions import Revisions
3+
from .uploads import Uploads
4+
from .tiles import Tiles
5+
6+
7+
class Drawings:
8+
def __init__(self, access_token, server_url):
9+
self.sets = Sets(access_token, server_url)
10+
self.revisions = Revisions(access_token, server_url)
11+
self.uploads = Uploads(access_token, server_url)
12+
self.tiles = Tiles(access_token, server_url)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
from ..base import Base
2+
from ...exceptions import NotFoundItemError
3+
4+
class Revisions(Base):
5+
def __init__(self, access_token, server_url) -> None:
6+
super().__init__(access_token, server_url)
7+
8+
self.endpoint = "/rest/v1.0"
9+
10+
def get(self, company_id, project_id, per_page=100):
11+
"""
12+
Gets all the available drawing revisions
13+
14+
Parameters
15+
----------
16+
company_id : int
17+
unique identifier for the company
18+
project_id : int
19+
unique identifier for the project
20+
per_page : int, default 100
21+
number of drawing revisions to include per page
22+
23+
Returns
24+
-------
25+
drawing_revisions : list
26+
available drawing revisions data
27+
"""
28+
headers = {
29+
"Procore-Company-Id": f"{company_id}"
30+
}
31+
32+
n_revisions = 1
33+
page = 1
34+
drawing_revisions = []
35+
36+
while n_revisions > 0:
37+
params = {
38+
"page": page,
39+
"per_page": per_page
40+
}
41+
42+
revision_selection = self.get_request(
43+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions",
44+
additional_headers=headers,
45+
params=params
46+
)
47+
48+
n_revisions = len(revision_selection)
49+
drawing_revisions += revision_selection
50+
page += 1
51+
52+
return drawing_revisions
53+
54+
def show(self, company_id, project_id, drawing_revision_id):
55+
"""
56+
Shows a specific drawing revision
57+
58+
Parameters
59+
----------
60+
company_id : int
61+
unique identifier for the company
62+
project_id : int
63+
unique identifier for the project
64+
drawing_revision_id : int
65+
unique identifier for the drawing revision
66+
67+
Returns
68+
-------
69+
drawing_revision_info : dict
70+
specific drawing revision information
71+
"""
72+
headers = {
73+
"Procore-Company-Id": f"{company_id}"
74+
}
75+
76+
drawing_revision_info = self.get_request(
77+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions/{drawing_revision_id}",
78+
additional_headers=headers
79+
)
80+
81+
return drawing_revision_info

ProPyCore/access/drawings/sets.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
from ..base import Base
2+
from ...exceptions import NotFoundItemError
3+
4+
class Sets(Base):
5+
def __init__(self, access_token, server_url) -> None:
6+
super().__init__(access_token, server_url)
7+
8+
self.endpoint = "/rest/v1.0"
9+
10+
def get(self, company_id, project_id, per_page=100):
11+
"""
12+
Gets all the available drawing sets
13+
14+
Parameters
15+
----------
16+
company_id : int
17+
unique identifier for the company
18+
project_id : int
19+
unique identifier for the project
20+
per_page : int, default 100
21+
number of drawing sets to include per page
22+
23+
Returns
24+
-------
25+
drawing_sets : list
26+
available drawing sets data
27+
"""
28+
headers = {
29+
"Procore-Company-Id": f"{company_id}"
30+
}
31+
32+
n_sets = 1
33+
page = 1
34+
drawing_sets = []
35+
36+
while n_sets > 0:
37+
params = {
38+
"page": page,
39+
"per_page": per_page
40+
}
41+
42+
set_selection = self.get_request(
43+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_sets",
44+
additional_headers=headers,
45+
params=params
46+
)
47+
48+
n_sets = len(set_selection)
49+
drawing_sets += set_selection
50+
page += 1
51+
52+
return drawing_sets

ProPyCore/access/drawings/tiles.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
from ..base import Base
2+
3+
class Tiles(Base):
4+
def __init__(self, access_token, server_url) -> None:
5+
super().__init__(access_token, server_url)
6+
7+
self.endpoint = "/rest/v1.0"
8+
9+
def get(self, company_id, project_id, drawing_revision_id, page=1, per_page=100):
10+
"""
11+
Gets all the available drawing tiles for a specific drawing revision
12+
13+
Parameters
14+
----------
15+
company_id : int
16+
unique identifier for the company
17+
project_id : int
18+
unique identifier for the project
19+
drawing_revision_id : int
20+
unique identifier for the drawing revision
21+
page : int, default 1
22+
page number
23+
per_page : int, default 100
24+
number of drawing tiles to include per page
25+
26+
Returns
27+
-------
28+
drawing_tiles : list
29+
available drawing tiles data
30+
"""
31+
headers = {
32+
"Procore-Company-Id": f"{company_id}"
33+
}
34+
35+
params = {
36+
"project_id": project_id,
37+
"page": page,
38+
"per_page": per_page
39+
}
40+
41+
drawing_tiles = self.get_request(
42+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_revisions/{drawing_revision_id}/drawing_tiles",
43+
additional_headers=headers,
44+
params=params
45+
)
46+
47+
return drawing_tiles
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
from ..base import Base
2+
from ...exceptions import NotFoundItemError
3+
4+
class Uploads(Base):
5+
def __init__(self, access_token, server_url) -> None:
6+
super().__init__(access_token, server_url)
7+
8+
self.endpoint = "/rest/v1.1"
9+
10+
def get(self, company_id, project_id, per_page=100):
11+
"""
12+
Gets all the available drawing uploads
13+
14+
Parameters
15+
----------
16+
company_id : int
17+
unique identifier for the company
18+
project_id : int
19+
unique identifier for the project
20+
per_page : int, default 100
21+
number of drawing uploads to include per page
22+
23+
Returns
24+
-------
25+
drawing_uploads : list
26+
available drawing uploads data
27+
"""
28+
headers = {
29+
"Procore-Company-Id": f"{company_id}"
30+
}
31+
32+
n_uploads = 1
33+
page = 1
34+
drawing_uploads = []
35+
36+
while n_uploads > 0:
37+
params = {
38+
"page": page,
39+
"per_page": per_page
40+
}
41+
42+
upload_selection = self.get_request(
43+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_uploads",
44+
additional_headers=headers,
45+
params=params
46+
)
47+
48+
n_uploads = len(upload_selection)
49+
drawing_uploads += upload_selection
50+
page += 1
51+
52+
return drawing_uploads
53+
54+
def show(self, company_id, project_id, drawing_upload_id):
55+
"""
56+
Shows a specific drawing upload
57+
58+
Parameters
59+
----------
60+
company_id : int
61+
unique identifier for the company
62+
project_id : int
63+
unique identifier for the project
64+
drawing_upload_id : int
65+
unique identifier for the drawing upload
66+
67+
Returns
68+
-------
69+
drawing_upload_info : dict
70+
specific drawing upload information
71+
"""
72+
headers = {
73+
"Procore-Company-Id": f"{company_id}"
74+
}
75+
76+
drawing_upload_info = self.get_request(
77+
api_url=f"{self.endpoint}/projects/{project_id}/drawing_uploads/{drawing_upload_id}",
78+
additional_headers=headers
79+
)
80+
81+
return drawing_upload_info

ProPyCore/access/projects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def __init__(self, access_token, server_url) -> None:
1111

1212
self.endpoint = "/rest/v1.1/projects"
1313

14-
def get(self, company_id, status="All",per_page=300):
14+
def get(self, company_id, status="All", region=None, per_page=300):
1515
"""
1616
Gets a list of all the projects from a certain company
1717
https://developers.procore.com/reference/rest/projects?version=latest#list-projects
@@ -24,6 +24,8 @@ def get(self, company_id, status="All",per_page=300):
2424
number of companies to include. Max is 300 per v1.1 API.
2525
status : str enum, default "All"
2626
status of the projects to get must be one of: ["Active", "Inactive", "All"]
27+
region : str or list of str, default None - NOT IMPLMENTED
28+
region of the projects to get
2729
2830
Returns
2931
-------

ProPyCore/access/quality/punch.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,34 @@ def show(self, company_id, project_id, punch_id):
8585
params=params
8686
)
8787

88-
return punch_info
88+
return punch_info
89+
90+
def get_assignment(self, company_id, project_id, assignment_id):
91+
"""
92+
Gets a specific punch item assignment
93+
94+
Parameters
95+
----------
96+
company_id : int
97+
unique identifier for the company
98+
project_id : int
99+
unique identifier for the project
100+
assignment_id : int
101+
unique identifier for the punch item assignment
102+
103+
Returns
104+
-------
105+
assignment_info : dict
106+
specific punch item assignment information
107+
"""
108+
109+
headers = {
110+
"Procore-Company-Id": f"{company_id}"
111+
}
112+
113+
assignment_info = self.get_request(
114+
api_url=f"/rest/v1.0/projects/{project_id}/punch_item_assignments/{assignment_id}",
115+
additional_headers=headers
116+
)
117+
118+
return assignment_info

0 commit comments

Comments
 (0)