···11+from pasturepy.constants.fields import POST_TYPES
22+from pasturepy.constants.graze_json import STATUS_TYPES
33+44+55+class PostNode:
66+ @staticmethod
77+ def post(filter_group, status: str, post_type: str):
88+ """Filter by entities (hashtags, mentions, domains, etc.)."""
99+ if status not in STATUS_TYPES:
1010+ raise ValueError(
1111+ f"Invalid method '{status}'. Must be one of {STATUS_TYPES}"
1212+ )
1313+ if post_type not in POST_TYPES:
1414+ raise ValueError(
1515+ f"Invalid post_type '{post_type}'. Must be one of {POST_TYPES}"
1616+ )
1717+1818+ return filter_group.add_filter({status: [post_type]})
+28-38
pasturepy/nodes/social.py
···11-from pasturepy.constants.graze_json import MEMBER_TYPES, SOCIAL_LISTS
11+from pasturepy.constants.graze_json import SOCIAL_LISTS, STATUS_TYPES
223344class SocialNode:
55 """Handles users, lists, social graph, and starter pack filtering."""
66-66+77 @staticmethod
88- def list_member(filter_group, list_uri: str, membership: str):
99- if membership not in MEMBER_TYPES:
88+ def list_member(filter_group, list_uri: str, status: str):
99+ if status not in STATUS_TYPES:
1010 raise ValueError(
1111- f"Invalid membership '{membership}'. "
1212- f"Must be one of: {', '.join(MEMBER_TYPES)}"
1111+ f"Invalid status '{status}'. Must be one of: {', '.join(STATUS_TYPES)}"
1312 )
1414-1515- return filter_group.add_filter({
1616- "list_member": [list_uri, membership]
1717- })
1818-1313+1414+ return filter_group.add_filter({"list_member": [list_uri, status]})
1515+1916 @staticmethod
2020- def starter_pack(filter_group, list_uri: str, membership: str):
2121- if membership not in MEMBER_TYPES:
1717+ def starter_pack(filter_group, list_uri: str, status: str):
1818+ if status not in STATUS_TYPES:
2219 raise ValueError(
2323- f"Invalid membership '{membership}'. "
2424- f"Must be one of: {', '.join(MEMBER_TYPES)}"
2020+ f"Invalid status '{status}'. Must be one of: {', '.join(STATUS_TYPES)}"
2521 )
2626-2727- return filter_group.add_filter({
2828- "starter_pack_member": [list_uri, membership]
2929- })
3030-2222+2323+ return filter_group.add_filter({"starter_pack_member": [list_uri, status]})
2424+3125 @staticmethod
3232- def social_list(filter_group, user_did: list, membership: str):
3333- if membership not in MEMBER_TYPES:
2626+ def social_list(filter_group, user_did: list, status: str):
2727+ if status not in STATUS_TYPES:
3428 raise ValueError(
3535- f"Invalid membership '{membership}'. "
3636- f"Must be one of: {', '.join(MEMBER_TYPES)}"
2929+ f"Invalid status '{status}'. Must be one of: {', '.join(STATUS_TYPES)}"
3730 )
3838-3939- return filter_group.add_filter({
4040- "social_list": [user_did, membership]
4141- })
4242-3131+3232+ return filter_group.add_filter({"social_list": [user_did, status]})
3333+4334 @staticmethod
4444- def social_graph(filter_group, user_handle: str, membership: str, list_type: str):
4545- if membership not in MEMBER_TYPES:
3535+ def social_graph(filter_group, user_handle: str, status: str, list_type: str):
3636+ if status not in STATUS_TYPES:
4637 raise ValueError(
4747- f"Invalid membership '{membership}'. "
4848- f"Must be one of: {', '.join(MEMBER_TYPES)}"
3838+ f"Invalid status '{status}'. Must be one of: {', '.join(STATUS_TYPES)}"
4939 )
5050-4040+5141 if list_type not in SOCIAL_LISTS:
5242 raise ValueError(
5343 f"Invalid list_type '{list_type}'. "
5444 f"Must be one of: {', '.join(SOCIAL_LISTS)}"
5545 )
5656-5757- return filter_group.add_filter({
5858- "social_graph": [user_handle, membership, list_type]
5959- })4646+4747+ return filter_group.add_filter(
4848+ {"social_graph": [user_handle, status, list_type]}
4949+ )