Skip to content

Commit 05aea23

Browse files
jpyliselasjkaliski
authored andcommitted
Review link methods (#11)
* minor * add review link methods * minor fix / link items * minor * minor
1 parent 8c2962a commit 05aea23

2 files changed

Lines changed: 87 additions & 11 deletions

File tree

frameioclient/client.py

Lines changed: 86 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self, token, host='https://api.frame.io'):
88

99
def _api_call(self, method, endpoint, payload={}):
1010
url = '{}/v2{}'.format(self.host, endpoint)
11-
11+
1212
headers = {
1313
'Authorization': 'Bearer {}'.format(self.token)
1414
}
@@ -19,8 +19,8 @@ def _api_call(self, method, endpoint, payload={}):
1919
json=payload,
2020
headers=headers,
2121
)
22-
23-
if r.ok:
22+
23+
if r.ok:
2424
return r.json()
2525
return r.raise_for_status()
2626

@@ -39,7 +39,7 @@ def get_teams(self, account_id):
3939
"""
4040
endpoint = '/accounts/{}/teams'.format(account_id)
4141
return self._api_call('get', endpoint)
42-
42+
4343
def get_projects(self, team_id):
4444
"""
4545
Get projects owned by the team.
@@ -49,7 +49,7 @@ def get_projects(self, team_id):
4949
"""
5050
endpoint = '/teams/{}/projects'.format(team_id)
5151
return self._api_call('get', endpoint)
52-
52+
5353
def create_project(self, team_id, **kwargs):
5454
"""
5555
Create a project.
@@ -78,7 +78,7 @@ def get_project(self, project_id):
7878
"""
7979
endpoint = '/projects/{}'.format(project_id)
8080
return self._api_call('get', endpoint)
81-
81+
8282
def get_asset(self, asset_id):
8383
"""
8484
Get an asset by id.
@@ -88,7 +88,7 @@ def get_asset(self, asset_id):
8888
"""
8989
endpoint = '/assets/{}'.format(asset_id)
9090
return self._api_call('get', endpoint)
91-
91+
9292
def get_asset_children(self, asset_id):
9393
"""
9494
Get an asset's children.
@@ -128,14 +128,14 @@ def upload(self, asset, file):
128128
:Args:
129129
asset (object): The asset object.
130130
file (file): The file to upload.
131-
131+
132132
Example::
133133
134134
client.upload(asset, open('example.mp4'))
135135
"""
136136
uploader = FrameioUploader(asset, file)
137137
uploader.upload()
138-
138+
139139
def get_comments(self, asset_id):
140140
"""
141141
Get an asset's comments.
@@ -164,7 +164,7 @@ def create_comment(self, asset_id, **kwargs):
164164
"""
165165
endpoint = '/assets/{}/comments'.format(asset_id)
166166
return self._api_call('post', endpoint, payload=kwargs)
167-
167+
168168
def update_comment(self, comment_id, **kwargs):
169169
"""
170170
Update a comment.
@@ -183,7 +183,7 @@ def update_comment(self, comment_id, **kwargs):
183183
"""
184184
endpoint = '/comments/{}'.format(comment_id)
185185
return self._api_call('post', endpoint, payload=kwargs)
186-
186+
187187
def delete_comment(self, comment_id):
188188
"""
189189
Delete a comment.
@@ -193,3 +193,78 @@ def delete_comment(self, comment_id):
193193
"""
194194
endpoint = '/comments/{}'.format(comment_id)
195195
return self._api_call('delete', endpoint)
196+
197+
def get_review_links(self, project_id):
198+
"""
199+
Get the review links of a project
200+
201+
:Args:
202+
asset_id (string): The asset id.
203+
"""
204+
endpoint = '/projects/{}/review_links'.format(project_id)
205+
return self._api_call('get', endpoint)
206+
207+
def create_review_link(self, project_id, **kwargs):
208+
"""
209+
Create a review link.
210+
211+
:Args:
212+
project_id (string): The project id.
213+
:Kwargs:
214+
kwargs: additional request parameters.
215+
216+
Example::
217+
218+
client.create_review_link(
219+
project_id="123",
220+
name="My Review Link",
221+
password="abc123"
222+
)
223+
"""
224+
endpoint = '/projects/{}/review_links'.format(project_id)
225+
return self._api_call('post', endpoint, payload=kwargs)
226+
227+
def get_review_link(self, link_id, **kwargs):
228+
"""
229+
Get a single review link
230+
231+
:Args:
232+
link_id (string): The review link id.
233+
"""
234+
endpoint = '/review_links/{}'.format(link_id)
235+
return self._api_call('get', endpoint, payload=kwargs)
236+
237+
def update_review_link_assets(self, link_id, **kwargs):
238+
"""
239+
Add or update assets for a review link.
240+
241+
:Args:
242+
link_id (string): The review link id.
243+
:Kwargs:
244+
kwargs: additional request parameters.
245+
246+
Example::
247+
248+
client.update_review_link_assets(
249+
link_id="123",
250+
asset_ids=["abc","def"]
251+
)
252+
"""
253+
endpoint = '/review_links/{}/assets'.format(link_id)
254+
return self._api_call('post', endpoint, payload=kwargs)
255+
256+
def get_review_link_items(self, link_id):
257+
"""
258+
Get items from a single review link.
259+
260+
:Args:
261+
link_id (string): The review link id.
262+
263+
Example::
264+
265+
client.get_review_link_items(
266+
link_id="123"
267+
)
268+
"""
269+
endpoint = '/review_links/{}/items'.format(link_id)
270+
return self._api_call('get', endpoint)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
author_email='platform@frame.io',
1616
license='MIT'
1717
)
18+

0 commit comments

Comments
 (0)