facebook_business/adobjects/album.py (375 lines of code) (raw):

# Copyright 2014 Facebook, Inc. # You are hereby granted a non-exclusive, worldwide, royalty-free license to # use, copy, modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Facebook platform, your use # of this software is subject to the Facebook Developer Principles and # Policies [http://developers.facebook.com/policy/]. This copyright notice # shall be included in all copies or substantial portions of the software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. from facebook_business.adobjects.abstractobject import AbstractObject from facebook_business.adobjects.abstractcrudobject import AbstractCrudObject from facebook_business.adobjects.objectparser import ObjectParser from facebook_business.api import FacebookRequest from facebook_business.typechecker import TypeChecker """ This class is auto-generated. For any issues or feature requests related to this class, please let us know on github and we'll fix in our codegen framework. We'll not be able to accept pull request for this class. """ class Album( AbstractCrudObject, ): def __init__(self, fbid=None, parent_id=None, api=None): self._isAlbum = True super(Album, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): backdated_time = 'backdated_time' backdated_time_granularity = 'backdated_time_granularity' can_backdate = 'can_backdate' can_upload = 'can_upload' count = 'count' cover_photo = 'cover_photo' created_time = 'created_time' description = 'description' edit_link = 'edit_link' event = 'event' field_from = 'from' id = 'id' is_user_facing = 'is_user_facing' link = 'link' location = 'location' modified_major = 'modified_major' name = 'name' photo_count = 'photo_count' place = 'place' privacy = 'privacy' type = 'type' updated_time = 'updated_time' video_count = 'video_count' def api_get(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') param_types = { } enums = { } request = FacebookRequest( node_id=self['id'], method='GET', endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Album, api_type='NODE', response_parser=ObjectParser(reuse_object=self), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def get_comments(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.comment import Comment param_types = { 'filter': 'filter_enum', 'live_filter': 'live_filter_enum', 'order': 'order_enum', 'since': 'datetime', } enums = { 'filter_enum': Comment.Filter.__dict__.values(), 'live_filter_enum': Comment.LiveFilter.__dict__.values(), 'order_enum': Comment.Order.__dict__.values(), } request = FacebookRequest( node_id=self['id'], method='GET', endpoint='/comments', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Comment, api_type='EDGE', response_parser=ObjectParser(target_class=Comment, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def create_comment(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.comment import Comment param_types = { 'attachment_id': 'string', 'attachment_share_url': 'string', 'attachment_url': 'string', 'comment_privacy_value': 'comment_privacy_value_enum', 'facepile_mentioned_ids': 'list<string>', 'feedback_source': 'string', 'is_offline': 'bool', 'message': 'string', 'nectar_module': 'string', 'object_id': 'string', 'parent_comment_id': 'Object', 'text': 'string', 'tracking': 'string', } enums = { 'comment_privacy_value_enum': Comment.CommentPrivacyValue.__dict__.values(), } request = FacebookRequest( node_id=self['id'], method='POST', endpoint='/comments', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Comment, api_type='EDGE', response_parser=ObjectParser(target_class=Comment, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def get_likes(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.profile import Profile param_types = { } enums = { } request = FacebookRequest( node_id=self['id'], method='GET', endpoint='/likes', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Profile, api_type='EDGE', response_parser=ObjectParser(target_class=Profile, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def create_like(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') param_types = { 'feedback_source': 'string', 'nectar_module': 'string', 'notify': 'bool', 'tracking': 'string', } enums = { } request = FacebookRequest( node_id=self['id'], method='POST', endpoint='/likes', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Album, api_type='EDGE', response_parser=ObjectParser(target_class=Album, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def get_photos(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.photo import Photo param_types = { } enums = { } request = FacebookRequest( node_id=self['id'], method='GET', endpoint='/photos', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Photo, api_type='EDGE', response_parser=ObjectParser(target_class=Photo, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def create_photo(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.photo import Photo param_types = { 'aid': 'string', 'allow_spherical_photo': 'bool', 'alt_text_custom': 'string', 'android_key_hash': 'string', 'application_id': 'string', 'attempt': 'unsigned int', 'audience_exp': 'bool', 'backdated_time': 'datetime', 'backdated_time_granularity': 'backdated_time_granularity_enum', 'caption': 'string', 'composer_session_id': 'string', 'direct_share_status': 'unsigned int', 'feed_targeting': 'Object', 'filter_type': 'unsigned int', 'full_res_is_coming_later': 'bool', 'initial_view_heading_override_degrees': 'unsigned int', 'initial_view_pitch_override_degrees': 'unsigned int', 'initial_view_vertical_fov_override_degrees': 'unsigned int', 'ios_bundle_id': 'string', 'is_explicit_location': 'bool', 'is_explicit_place': 'bool', 'manual_privacy': 'bool', 'message': 'string', 'name': 'string', 'no_story': 'bool', 'offline_id': 'unsigned int', 'og_action_type_id': 'string', 'og_icon_id': 'string', 'og_object_id': 'string', 'og_phrase': 'string', 'og_set_profile_badge': 'bool', 'og_suggestion_mechanism': 'string', 'place': 'Object', 'privacy': 'string', 'profile_id': 'int', 'proxied_app_id': 'string', 'published': 'bool', 'qn': 'string', 'scheduled_publish_time': 'unsigned int', 'spherical_metadata': 'map', 'sponsor_id': 'string', 'sponsor_relationship': 'unsigned int', 'tags': 'list<Object>', 'target_id': 'int', 'targeting': 'Object', 'time_since_original_post': 'unsigned int', 'uid': 'int', 'unpublished_content_type': 'unpublished_content_type_enum', 'url': 'string', 'user_selected_tags': 'bool', 'vault_image_id': 'string', } enums = { 'backdated_time_granularity_enum': Photo.BackdatedTimeGranularity.__dict__.values(), 'unpublished_content_type_enum': Photo.UnpublishedContentType.__dict__.values(), } request = FacebookRequest( node_id=self['id'], method='POST', endpoint='/photos', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=Photo, api_type='EDGE', response_parser=ObjectParser(target_class=Photo, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() def get_picture(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils if batch is None and (success is not None or failure is not None): api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.profilepicturesource import ProfilePictureSource param_types = { 'redirect': 'bool', 'type': 'type_enum', } enums = { 'type_enum': ProfilePictureSource.Type.__dict__.values(), } request = FacebookRequest( node_id=self['id'], method='GET', endpoint='/picture', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=ProfilePictureSource, api_type='EDGE', response_parser=ObjectParser(target_class=ProfilePictureSource, api=self._api), ) request.add_params(params) request.add_fields(fields) if batch is not None: request.add_to_batch(batch, success=success, failure=failure) return request elif pending: return request else: self.assure_call() return request.execute() _field_types = { 'backdated_time': 'datetime', 'backdated_time_granularity': 'string', 'can_backdate': 'bool', 'can_upload': 'bool', 'count': 'unsigned int', 'cover_photo': 'Photo', 'created_time': 'datetime', 'description': 'string', 'edit_link': 'Object', 'event': 'Event', 'from': 'Object', 'id': 'string', 'is_user_facing': 'bool', 'link': 'Object', 'location': 'string', 'modified_major': 'datetime', 'name': 'string', 'photo_count': 'unsigned int', 'place': 'Place', 'privacy': 'string', 'type': 'string', 'updated_time': 'datetime', 'video_count': 'unsigned int', } @classmethod def _get_field_enum_info(cls): field_enum_info = {} return field_enum_info