Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #83

Merged
merged 3 commits into from
Jan 5, 2025
Merged

Dev #83

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
461 changes: 348 additions & 113 deletions dist/compatible/openapi-3.0.yaml

Large diffs are not rendered by default.

626 changes: 579 additions & 47 deletions dist/docs/openapi-3.0.yaml

Large diffs are not rendered by default.

161 changes: 142 additions & 19 deletions src/config/placeholder.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/openapi/schemas/content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ components:
additionalProperties: true # todo
highlights:
$ref: "#/components/schemas/Highlight"
hasModeratedReplies:
type: boolean

TimelineUser:
required:
Expand Down
187 changes: 172 additions & 15 deletions src/openapi/schemas/tweet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ components:
- $ref: "#/components/schemas/TweetWithVisibilityResults"
- $ref: "#/components/schemas/TweetTombstone"
- $ref: "#/components/schemas/TweetUnavailable"
- $ref: "#/components/schemas/TweetPreviewDisplay"
discriminator:
propertyName: __typename
mapping": # deprecated
Tweet: "#/components/schemas/Tweet"
TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults"
TweetTombstone: "#/components/schemas/TweetTombstone"
TweetUnavailable: "#/components/schemas/TweetUnavailable"
TweetPreviewDisplay: "#/components/schemas/TweetPreviewDisplay"

TweetWithVisibilityResults:
required:
Expand Down Expand Up @@ -201,6 +203,14 @@ components:
$ref: "#/components/schemas/Article"
community_results:
$ref: "#/components/schemas/Community"
trend_results:
$ref: "#/components/schemas/TrendResults"
grok_analysis_followups:
type: array
items:
type: string
grok_share_attachment:
$ref: "#/components/schemas/GrokShareAttachment"

TweetEditControl:
properties:
Expand Down Expand Up @@ -441,21 +451,21 @@ components:
required:
- "__typename"
- "id_str"
- "name"
- "description"
- "search_tags"
- "actions"
- "admin_results"
- "creator_results"
- "invites_result"
- "join_policy"
- "invites_policy"
- "is_pinned"
- "members_facepile_results"
- "moderator_count"
- "member_count"
- "role"
- "rules"
# - "name"
# - "description"
# - "search_tags"
# - "actions"
# - "admin_results"
# - "creator_results"
# - "invites_result"
# - "join_policy"
# - "invites_policy"
# - "is_pinned"
# - "members_facepile_results"
# - "moderator_count"
# - "member_count"
# - "role"
# - "rules"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # Community
Expand Down Expand Up @@ -1537,3 +1547,150 @@ components:
properties:
media_key:
type: string

TrendResults:
required:
- "rest_id"
properties:
rest_id:
type: string
pattern: "^[0-9]+$"

GrokShareAttachment:
required:
- "items"
properties:
items:
type: array
items:
$ref: "#/components/schemas/GrokShareAttachmentItem"

GrokShareAttachmentItem:
required:
- "media_urls"
- message
properties:
media_urls:
type: array
items:
type: string
format: uri
message:
type: string

TweetPreviewDisplay:
required:
- "__typename"
- "tweet"
- "limited_action_results"
- "cta"

properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetPreviewDisplay
tweet:
$ref: "#/components/schemas/TweetPreviewDisplayTweet"
limited_action_results:
$ref: "#/components/schemas/TweetLimitedActionResults"
cta:
$ref: "#/components/schemas/TweetPreviewDisplayCta"

TweetPreviewDisplayTweet:
required:
- "rest_id"
- "text"
- "core"
- "entities"
- "reply_count"
- "retweet_count"
- "favorite_count"
- "bookmark_count"
- "quote_count"
- "view_count"
- "created_at"
properties:
rest_id:
type: string
pattern: "^[0-9]+$"
text:
type: string
core:
$ref: "./user.yaml#/components/schemas/UserResultCore"
entities:
type: object # {}
# $ref: "#/components/schemas/Entities"
reply_count:
type: integer
retweet_count:
type: integer
favorite_count:
type: integer
bookmark_count:
type: integer
quote_count:
type: integer
view_count:
$ref: "#/components/schemas/TweetPreviewDisplayTweetViewCount"
created_at:
$ref: "./general.yaml#/components/schemas/TwitterTimeFormat"

TweetPreviewDisplayTweetViewCount:
required:
- "count"
properties:
count:
type: string
pattern: "^[0-9]+$"

TweetLimitedActionResults:
required:
- "limited_actions"
properties:
limited_actions:
type: array
items:
$ref: "#/components/schemas/LimitedActionResultsData"

LimitedActionResultsData:
required:
- "action"
properties:
action:
type: string
enum:
- "Reply"
- "Retweet"
- "QuoteTweet"
- "Like"
- "React"
- "AddToBookmarks"
- "AddToMoment"
- "PinToProfile"
- "ViewHiddenReplies"
- "VoteOnPoll"
- "ShowRetweetActionMenu"
- "ReplyDownVote"
- "SendViaDm"
- "ViewPostEngagements"

TweetPreviewDisplayCta:
required:
- "title"
- "url"
properties:
title:
type: string
url:
$ref: "#/components/schemas/TweetPreviewDisplayCtaUrl"

TweetPreviewDisplayCtaUrl:
required:
- "url"
- "urlType"
properties:
url:
type: string
format: uri
urlType:
type: string
enum: ["DeepLink", "UrtEndpoint", "ExternalUrl"]
1 change: 1 addition & 0 deletions src/openapi/schemas/typename.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ components:
TimelineMessagePrompt,
TimelineCommunity,
TweetUnavailable,
TweetPreviewDisplay,
Tweet,
User,
UserUnavailable,
Expand Down
2 changes: 2 additions & 0 deletions src/openapi/schemas/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ components:
type: boolean
premium_gifting_eligible:
type: boolean
has_hidden_subscriptions_on_profile:
type: boolean

UserProfessional:
required:
Expand Down
8 changes: 8 additions & 0 deletions test/python/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ def error_dump(e):
"2455740283",
"2326837940",
"1788224200639160320",
"1500128450186985472",
"25073877",
]
for id in ids:
try:
Expand Down Expand Up @@ -378,6 +380,12 @@ def error_dump(e):
"1810188416812019999",
"1851981523207299417",
"1853879226987901408",
"1866022435549757577",
"1866103697148887145",
"1866036470303309863",
"1862405433639804958",
"1869983867521904840",
"1875050002046726519",
]
for id in ids:
try:
Expand Down
Loading