forked from sns-sdks/python-facebook
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomment.py
More file actions
81 lines (63 loc) · 2.34 KB
/
comment.py
File metadata and controls
81 lines (63 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
Models for comment.
Refer: https://developers.facebook.com/docs/graph-api/reference/comment
"""
from dataclasses import dataclass
from typing import List, Optional
from dataclasses_json import config
from pyfacebook.models.base import BaseModel, field
from pyfacebook.models.extensions import Paging
from pyfacebook.models.attachment import StoryAttachment
@dataclass
class MessageTag(BaseModel):
"""
A class representing the Message Tag.
"""
id: Optional[str] = field(repr=True, compare=True)
name: Optional[str] = field(repr=True)
type: Optional[str] = field()
offset: Optional[int] = field()
length: Optional[int] = field()
@dataclass
class Comment(BaseModel):
"""
A class representing the Comment.
"""
id: Optional[str] = field(repr=True, compare=True)
attachment: Optional[StoryAttachment] = field()
can_comment: Optional[bool] = field()
can_remove: Optional[bool] = field()
can_hide: Optional[bool] = field()
can_like: Optional[bool] = field()
can_reply_privately: Optional[bool] = field()
comment_count: Optional[int] = field()
created_time: Optional[str] = field()
_from: Optional[dict] = field(metadata=config(field_name="from"))
like_count: Optional[int] = field()
message: Optional[str] = field()
message_tags: Optional[List[MessageTag]] = field()
object: Optional[dict] = field() # TODO
parent: Optional["Comment"] = field()
permalink_url: Optional[str] = field()
private_reply_conversation: Optional[dict] = (
field()
) # TODO Refer: https://developers.facebook.com/docs/graph-api/reference/conversation
user_likes: Optional[bool] = field()
@dataclass
class CommentsSummary(BaseModel):
"""
A class representing the summary for comments.
Refer: https://developers.facebook.com/docs/graph-api/reference/object/comments
"""
order: Optional[str] = field(repr=True)
total_count: Optional[int] = field(repr=True)
can_comment: Optional[bool] = field()
@dataclass
class CommentsResponse(BaseModel):
"""
A class representing the result for comments edge.
Refer: https://developers.facebook.com/docs/graph-api/reference/object/comments
"""
data: List[Comment] = field(repr=True, compare=True)
paging: Optional[Paging] = field()
summary: Optional[CommentsSummary] = field(repr=True)