Added extensible attachments models
This commit is contained in:
committed by
GitHub
parent
0ae213c240
commit
e0be9029e4
@@ -248,9 +248,81 @@ class Sticker(Attachment):
|
||||
super(Sticker, self).__init__(*args, **kwargs)
|
||||
|
||||
class ShareAttachment(Attachment):
|
||||
def __init__(self, **kwargs):
|
||||
"""Represents a shared item (eg. URL) that has been sent as a Facebook attachment - *Currently Incomplete!*"""
|
||||
#: ID of the author of the shared post
|
||||
author = None
|
||||
#: Target URL
|
||||
url = None
|
||||
#: Original URL if Facebook redirects the URL
|
||||
original_url = None
|
||||
#: Title of the attachment
|
||||
title = None
|
||||
#: Description of the attachment
|
||||
description = None
|
||||
#: Name of the source
|
||||
source = None
|
||||
#: URL of the attachment image
|
||||
image_url = None
|
||||
#: URL of the original image if Facebook uses `safe_image`
|
||||
original_image_url = None
|
||||
#: Width of the image
|
||||
image_width = None
|
||||
#: Height of the image
|
||||
image_height = None
|
||||
#: List of additional attachments
|
||||
attachments = None
|
||||
|
||||
def __init__(self, author=None, url=None, original_url=None, title=None, description=None, source=None, image_url=None, original_image_url=None, image_width=None, image_height=None, attachments=None, **kwargs):
|
||||
"""Represents a shared item (eg. URL) that has been sent as a Facebook attachment"""
|
||||
super(ShareAttachment, self).__init__(**kwargs)
|
||||
self.author = author
|
||||
self.url = url
|
||||
self.original_url = original_url
|
||||
self.title = title
|
||||
self.description = description
|
||||
self.source = source
|
||||
self.image_url = image_url
|
||||
self.original_image_url = original_image_url
|
||||
self.image_width = image_width
|
||||
self.image_height = image_height
|
||||
if attachments is None:
|
||||
attachments = []
|
||||
self.attachments = attachments
|
||||
|
||||
class LocationAttachment(Attachment):
|
||||
#: Latidute of the location
|
||||
latitude = None
|
||||
#: Longitude of the location
|
||||
longitude = None
|
||||
#: URL of image showing the map of the location
|
||||
image_url = None
|
||||
#: Width of the image
|
||||
image_width = None
|
||||
#: Height of the image
|
||||
image_height = None
|
||||
#: URL to Bing maps with the location
|
||||
url = None
|
||||
|
||||
def __init__(self, latitude=None, longitude=None, image=None, url=None, **kwargs):
|
||||
"""Represents a user location"""
|
||||
super(LocationAttachment, self).__init__(**kwargs)
|
||||
self.latitude = latitude
|
||||
self.longitude = longitude
|
||||
self.image = image
|
||||
self.url = url
|
||||
|
||||
class LiveLocationAttachment(LocationAttachment):
|
||||
#: Name of the location
|
||||
name = None
|
||||
#: Timestamp when live location expires
|
||||
expiration_time = None
|
||||
#: True if live location is expired
|
||||
is_expired = None
|
||||
|
||||
def __init__(self, name=None, expiration_time=None, is_expired=None, **kwargs):
|
||||
"""Represents a live user location"""
|
||||
super(LiveLocationAttachment, self).__init__(**kwargs)
|
||||
self.expiration_time = expiration_time
|
||||
self.is_expired = is_expired
|
||||
|
||||
class FileAttachment(Attachment):
|
||||
#: Url where you can download the file
|
||||
|
Reference in New Issue
Block a user