| 47 | |
| 48 | @classmethod |
| 49 | def _prepare_data( |
| 50 | cls, |
| 51 | *, |
| 52 | flair_id: str | None = None, |
| 53 | flair_text: str | None = None, |
| 54 | is_public_link: bool | None = None, |
| 55 | nsfw: bool | None = None, |
| 56 | original_content: bool | None = None, |
| 57 | selftext: str | None = None, |
| 58 | send_replies: bool | None = None, |
| 59 | spoiler: bool | None = None, |
| 60 | subreddit: models.Subreddit | models.UserSubreddit | None = None, |
| 61 | title: str | None = None, |
| 62 | url: str | None = None, |
| 63 | **draft_kwargs: Any, |
| 64 | ) -> dict[str, Any]: |
| 65 | data = { |
| 66 | "body": selftext or url, |
| 67 | "flair_id": flair_id, |
| 68 | "flair_text": flair_text, |
| 69 | "is_public_link": is_public_link, |
| 70 | "kind": "markdown" if selftext is not None else "link", |
| 71 | "nsfw": nsfw, |
| 72 | "original_content": original_content, |
| 73 | "send_replies": send_replies, |
| 74 | "spoiler": spoiler, |
| 75 | "title": title, |
| 76 | } |
| 77 | if subreddit: |
| 78 | data.update({ |
| 79 | "subreddit": subreddit.fullname, |
| 80 | "target": ("profile" if subreddit.display_name.startswith("u_") else "subreddit"), |
| 81 | }) |
| 82 | data.update(draft_kwargs) |
| 83 | return data |
| 84 | |
| 85 | def __init__(self, reddit: praw.Reddit, id: str | None = None, _data: dict[str, Any] | None = None) -> None: |
| 86 | """Initialize a :class:`.Draft` instance.""" |