Skip to content

Commit b40c50a

Browse files
author
Hilary Mason
committed
rest of the bundle endpoints
1 parent f15b6ed commit b40c50a

1 file changed

Lines changed: 51 additions & 5 deletions

File tree

bitly_api/bitly_api.py

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,11 @@ def bundle_bundles_by_user(self, user=None, expand_user=False):
391391
data = self._call_oauth2_metrics("v3/bundle/bundles_by_user", params)
392392
return data
393393

394-
#def bundle_clone(self, bundle_link): # TODO: 500s
395-
#"""clone a bundle for the authenticated user"""
396-
#params = dict(bundle_link=bundle_link)
397-
#data = self._call_oauth2_metrics("v3/bundle/clone", params)
398-
#return data
394+
def bundle_clone(self, bundle_link): # TODO: 500s
395+
"""clone a bundle for the authenticated user"""
396+
params = dict(bundle_link=bundle_link)
397+
data = self._call_oauth2_metrics("v3/bundle/clone", params)
398+
return data
399399

400400
def bundle_collaborator_add(self, bundle_link, collaborator=None):
401401
"""add a collaborator a bundle"""
@@ -489,8 +489,54 @@ def bundle_link_comment_remove(self, bundle_link, link, comment_id):
489489
data = self._call_oauth2_metrics("v3/bundle/link_comment_remove", params)
490490
return data
491491

492+
def bundle_link_edit(self, bundle_link, link, edit, title=None, preview=None):
493+
""" edit the title for a link """
494+
params = dict(bundle_link=bundle_link, link=link)
495+
if edit == "title":
496+
params["edit"] = edit
497+
assert isinstance(title, str)
498+
params["title"] = title
499+
elif edit == "preview":
500+
params["edit"] = edit
501+
assert isinstance(preview, bool)
502+
if preview:
503+
params["preview"] = "true"
504+
else:
505+
params["preview"] = "false"
506+
else:
507+
raise BitlyError(500, "PARAM EDIT MUST HAVE VALUE TITLE OR PREVIEW") # all caps is fun!
508+
data = self._call_oauth2_metrics("v3/bundle/link_edit", params)
509+
return data
510+
511+
def bundle_link_remove(self, bundle_link, link):
512+
""" remove a link from a bundle """
513+
params = dict(bundle_link=bundle_link, link=link)
514+
data = self._call_oauth2_metrics("v3/bundle/link_remove", params)
515+
return data
492516

517+
def bundle_link_reorder(self, bundle_link, link, display_order):
518+
""" reorder the links in a bundle"""
519+
params = dict(bundle_link=bundle_link, link=link, display_order=display_order)
520+
data = self._call_oauth2_metrics("v3/bundle/link_reorder", params)
521+
return data
493522

523+
def bundle_collaborator_remove(self, bundle_link, collaborator):
524+
"""remove a pending collaborator from a bundle"""
525+
params = dict(bundle_link=bundle_link)
526+
params["collaborator"] = collaborator
527+
data = self._call_oauth2_metrics("v3/bundle/pending_collaborator_remove", params)
528+
return data
529+
530+
def bundle_view_count(self, bundle_link):
531+
""" get the number of views on a bundle """
532+
params = dict(bundle_link=bundle_link)
533+
data = self._call_oauth2_metrics("v3/bundle/view_count", params)
534+
return data
535+
536+
def user_bundle_history(self):
537+
""" return the bundles that this user has access to """
538+
data = self._call_oauth2_metrics("v3/user/bundle_history", dict())
539+
return data
494540

495541
def highvalue(self, limit=10, lang='en'):
496542
params = dict(lang=lang)

0 commit comments

Comments
 (0)