Skip to content

Commit 1839bb1

Browse files
committed
feat(model): ✨ add model for container
1 parent f31a68c commit 1839bb1

4 files changed

Lines changed: 23 additions & 4 deletions

File tree

pyfacebook/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
IgBusReply,
1919
IgBusComment,
2020
IgBusHashtag,
21+
IgBusContainer,
2122
)

pyfacebook/models/ig_business_models.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,16 @@ class IgBusHashtag(BaseModel):
132132

133133
id: Optional[str] = field(repr=True, compare=True)
134134
name: Optional[str] = field(repr=True)
135+
136+
137+
@dataclass
138+
class IgBusContainer(BaseModel):
139+
"""
140+
A class representing the media container.
141+
142+
Refer: https://developers.facebook.com/docs/instagram-api/reference/ig-container
143+
"""
144+
145+
id: Optional[str] = field(repr=True, compare=True)
146+
status: Optional[str] = field()
147+
status_code: Optional[str] = field()
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
{
2-
"status_code": "FINISHED",
3-
"id": "17889615691921648"
4-
}
1+
{"status_code":"FINISHED","id":"17889615691921648"}

tests/test_models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,11 @@ def test_ig_bus_hashtag(helpers):
158158
hashtag = md.IgBusHashtag.new_from_json_dict(data)
159159
assert hashtag.id == "17841593698074073"
160160
assert hashtag.name == "coke"
161+
162+
163+
def test_ig_bus_container(helpers):
164+
data = helpers.load_json("testdata/instagram/models/ig_container.json")
165+
166+
container = md.IgBusContainer.new_from_json_dict(data)
167+
assert container.id == "17889615691921648"
168+
assert container.status_code == "FINISHED"

0 commit comments

Comments
 (0)