1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 15:40:26 +01:00
twitter-openapi/src/openapi/schemas/tweet.yaml
ふぁ e9964037bf
add Community note
Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-11-05 14:55:45 +09:00

702 lines
16 KiB
YAML

openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
schemas:
TweetUnion:
oneOf:
- $ref: "#/components/schemas/Tweet"
- $ref: "#/components/schemas/TweetWithVisibilityResults"
- $ref: "#/components/schemas/TweetTombstone"
discriminator:
propertyName: __typename
mapping": # deprecated
Tweet: "#/components/schemas/Tweet"
TweetWithVisibilityResults: "#/components/schemas/TweetWithVisibilityResults"
TweetTombstone: "#/components/schemas/TweetTombstone"
TweetWithVisibilityResults:
required:
- "__typename"
- "tweet"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
tweet:
$ref: "#/components/schemas/Tweet"
TweetTombstone: #remove tweet
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
additionalProperties: true # todo
Tweet:
required:
- "rest_id"
# If the tweet has been edited, this property does not exist.
# - "core"
- "edit_control"
- "is_translatable"
# - "source"
# - "legacy"
- "views"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # null | Tweet
rest_id:
type: string
pattern: "^[0-9]+$"
birdwatch_pivot:
$ref: "#/components/schemas/BirdwatchPivot"
core:
$ref: "./user.yaml#/components/schemas/UserResultCore"
card:
$ref: "#/components/schemas/TweetCard"
unmention_data:
type: object
additionalProperties: true # todo
edit_control:
$ref: "#/components/schemas/TweetEditControl"
edit_prespective:
$ref: "#/components/schemas/TweetEditPrespective"
is_translatable:
type: boolean
default: false
source:
type: string # html (<a href="http://twitter.com/download/android" rel="nofollow">Twitter for Android</a>)
legacy:
$ref: "#/components/schemas/TweetLegacy"
views:
$ref: "#/components/schemas/TweetView"
quoted_status_result:
$ref: "./content.yaml#/components/schemas/ItemResult"
note_tweet:
$ref: "#/components/schemas/NoteTweet"
quick_promote_eligibility:
type: object
TweetEditControl:
properties:
edit_tweet_ids:
type: array
items:
type: string
pattern: "^[0-9]+$"
editable_until_msecs:
type: string
pattern: "^[0-9]+$"
is_edit_eligible:
type: boolean
edits_remaining:
type: string
pattern: "^[0-9]+$"
initial_tweet_id:
type: string
pattern: "^[0-9]+$"
edit_control_initial:
$ref: "#/components/schemas/TweetEditControlInitial"
TweetEditControlInitial:
required:
- "edit_tweet_ids"
- "editable_until_msecs"
- "is_edit_eligible"
- "edits_remaining"
properties:
edit_tweet_ids:
type: array
items:
type: string
pattern: "^[0-9]+$"
editable_until_msecs:
type: string
pattern: "^[0-9]+$"
is_edit_eligible:
type: boolean
edits_remaining:
type: string
pattern: "^[0-9]+$"
TweetEditPrespective:
properties:
favorited:
type: boolean
retweeted:
type: boolean
TweetView:
required:
- "state"
properties:
count:
type: string
pattern: "^[0-9]+$"
state:
type: string
enum: [EnabledWithCount]
NoteTweet:
required:
- "is_expandable"
- "note_tweet_results"
properties:
is_expandable:
type: boolean
note_tweet_results:
$ref: "#/components/schemas/NoteTweetResult"
NoteTweetResult:
required:
- "result"
properties:
result:
$ref: "#/components/schemas/NoteTweetResultData"
NoteTweetResultData:
required:
- "entity_set"
- "id"
- "text"
properties:
entity_set:
$ref: "#/components/schemas/Entities"
id:
type: string
pattern: "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$" # base64
media:
$ref: "#/components/schemas/NoteTweetResultMedia"
richtext:
$ref: "#/components/schemas/NoteTweetResultRichText"
text:
type: string
NoteTweetResultMedia:
required:
- "inline_media"
properties:
inline_media:
type: array
items:
type: object
NoteTweetResultRichText:
required:
- "richtext_tags"
properties:
richtext_tags:
type: array
items:
$ref: "#/components/schemas/NoteTweetResultRichTextTag"
NoteTweetResultRichTextTag:
required:
- "from_index"
- "to_index"
- "richtext_types"
properties:
from_index:
type: integer
to_index:
type: integer
richtext_types:
type: array
items:
type: string
enum: [Bold, Italic]
BirdwatchPivot:
required:
- "destinationUrl"
- "footer"
- "note"
- "subtitle"
- "title"
- "shorttitle"
- "iconType"
properties:
destinationUrl:
type: string
format: uri
footer:
$ref: "#/components/schemas/BirdwatchPivotFooter"
note:
$ref: "#/components/schemas/BirdwatchPivotNote"
subtitle:
$ref: "#/components/schemas/BirdwatchPivotSubtitle"
title:
type: string
shorttitle:
type: string
visualStyle:
type: string
enum: [Default]
iconType:
type: string
enum: [BirdwatchV1Icon]
BirdwatchPivotFooter:
required:
- "text"
- "entities"
properties:
text:
type: string
entities:
type: array
items:
$ref: "#/components/schemas/BirdwatchEntity"
BirdwatchEntity:
required:
- "fromIndex"
- "toIndex"
- "ref"
properties:
fromIndex:
type: integer
toIndex:
type: integer
ref:
$ref: "#/components/schemas/BirdwatchEntityRef"
BirdwatchEntityRef:
required:
- "type"
- "url"
- "urlType"
properties:
type:
type: string
enum: [TimelineUrl]
url:
type: string
format: uri
urlType:
type: string
enum: [ExternalUrl]
BirdwatchPivotNote:
required:
- "rest_id"
properties:
rest_id:
type: string
pattern: "^[0-9]+$"
BirdwatchPivotSubtitle:
required:
- "text"
- "entities"
properties:
text:
type: string
entities:
type: array
items:
$ref: "#/components/schemas/BirdwatchEntity"
TweetCard:
properties:
rest_id:
type: string
legacy:
$ref: "#/components/schemas/TweetCardLegacy"
TweetCardLegacy:
required:
- "binding_values"
- "name"
- "url"
properties:
name:
type: string
url:
type: string
binding_values:
type: array
items:
$ref: "#/components/schemas/TweetCardLegacyBindingValue"
TweetCardLegacyBindingValue:
required:
- "key"
- "value"
properties:
key:
type: string
value:
$ref: "#/components/schemas/TweetCardLegacyBindingValueData"
TweetCardLegacyBindingValueData:
required:
- "type"
properties:
string_value:
type: string
boolean_value:
type: boolean
scribe_key:
type: string
type:
type: string
TweetLegacy:
required:
- "bookmark_count"
- "bookmarked"
- "conversation_id_str"
- "created_at"
- "display_text_range"
- "entities"
- "favorite_count"
- "favorited"
- "full_text"
- "is_quote_status"
- "lang"
- "quote_count"
- "reply_count"
- "retweet_count"
- "retweeted"
- "user_id_str"
- "id_str"
properties:
bookmark_count:
type: integer
bookmarked:
type: boolean
created_at:
$ref: "./general.yaml#/components/schemas/TwitterTimeFormat"
conversation_id_str:
type: string
pattern: "^[0-9]+$"
display_text_range:
type: array
items:
type: integer
entities:
$ref: "#/components/schemas/Entities"
favorite_count:
type: integer
favorited:
type: boolean
full_text:
type: string
is_quote_status:
type: boolean
lang:
type: string # enum
possibly_sensitive:
type: boolean
default: false
possibly_sensitive_editable:
type: boolean
default: false
quote_count:
type: integer
reply_count:
type: integer
retweet_count:
type: integer
retweeted:
type: boolean
retweeted_status_result:
$ref: "./content.yaml#/components/schemas/ItemResult"
user_id_str:
type: string
pattern: "^[0-9]+$"
id_str:
type: string
pattern: "^[0-9]+$"
self_thread:
$ref: "#/components/schemas/SelfThread"
extended_entities:
$ref: "#/components/schemas/ExtendedEntities"
SelfThread:
required:
- "id_str"
properties:
id_str:
type: string
pattern: "^[0-9]+$"
Entities:
required:
- "hashtags"
- "symbols"
- "user_mentions"
- "urls"
properties:
hashtags:
type: array
items:
$ref: "#/components/schemas/Hashtag"
symbols:
type: array
items:
$ref: "#/components/schemas/Symbol"
user_mentions:
type: array
items:
$ref: "#/components/schemas/UserMention"
urls:
type: array
items:
$ref: "#/components/schemas/Url"
media:
type: array
items:
$ref: "#/components/schemas/Media"
Hashtag:
type: object
additionalProperties: true # todo
Symbol:
type: object
additionalProperties: true # todo
UserMention:
type: object
additionalProperties: true # todo
Url:
type: object
required:
- "url"
- "indices"
- "expanded_url"
- "display_url"
properties:
display_url:
type: string
expanded_url:
type: string
format: uri
url:
type: string
format: uri
indices:
type: array
items:
type: integer
Media:
required:
- "display_url"
- "expanded_url"
- "id_str"
- "indices"
- "media_url_https"
- "type"
- "url"
# - "features"
- "sizes"
- "original_info"
properties:
display_url:
type: string
format: uri
expanded_url:
type: string
format: uri
id_str:
type: string
pattern: "^[0-9]+$"
indices:
type: array
items:
type: integer
media_url_https:
type: string
format: uri
type:
type: string
enum: [photo, video, animated_gif]
url:
type: string
format: uri
features:
type: object
sizes:
$ref: "#/components/schemas/MediaSizes"
original_info:
$ref: "#/components/schemas/MediaOriginalInfo"
ExtendedEntities:
required:
- "media"
properties:
media:
type: array
items:
$ref: "#/components/schemas/MediaExtended"
MediaExtended:
required:
- "display_url"
- "expanded_url"
- "id_str"
- "indices"
- "media_key"
- "media_url_https"
- "type"
- "url"
# - "ext_media_availability"
# - "features"
- "sizes"
- "original_info"
properties:
display_url:
type: string
format: uri
expanded_url:
type: string
format: uri
id_str:
type: string
pattern: "^[0-9]+$"
indices:
type: array
items:
type: integer
media_key:
type: string
media_url_https:
type: string
format: uri
type:
type: string
enum: [photo, video, animated_gif]
url:
type: string
format: uri
additional_media_info:
$ref: "#/components/schemas/AdditionalMediaInfo"
mediaStats:
$ref: "#/components/schemas/mediaStats"
ext_media_availability:
$ref: "#/components/schemas/extMediaAvailability"
features:
type: object
sizes:
$ref: "#/components/schemas/MediaSizes"
original_info:
$ref: "#/components/schemas/MediaOriginalInfo"
video_info:
$ref: "#/components/schemas/MediaVideoInfo"
MediaOriginalInfo:
required:
- "height"
- "width"
properties:
height:
type: integer
width:
type: integer
focus_rects:
type: array
items:
$ref: "#/components/schemas/MediaOriginalInfoFocusRect"
MediaOriginalInfoFocusRect:
type: object
required:
- "x"
- "y"
- "w"
- "h"
properties:
x:
type: integer
y:
type: integer
w:
type: integer
h:
type: integer
MediaVideoInfo:
required:
- "aspect_ratio"
- "variants"
properties:
aspect_ratio:
type: array
items:
type: integer
duration_millis:
type: integer
variants:
type: array
items:
$ref: "#/components/schemas/MediaVideoInfoVariant"
MediaVideoInfoVariant:
required:
- "content_type"
- "url"
properties:
bitrate:
type: integer
content_type:
type: string
url:
type: string
format: uri
AdditionalMediaInfo:
required:
- "monetizable"
properties:
monetizable:
type: boolean
mediaStats:
required:
- "viewCount"
properties:
viewCount:
type: integer
extMediaAvailability:
# required:
# - "status"
properties:
reason:
type: string # enum Dmcaed
status:
type: string
enum: [Available, Unavailable]
MediaSizes:
required:
- "large"
- "medium"
- "small"
- "thumb"
properties:
large:
$ref: "#/components/schemas/MediaSize"
medium:
$ref: "#/components/schemas/MediaSize"
small:
$ref: "#/components/schemas/MediaSize"
thumb:
$ref: "#/components/schemas/MediaSize"
MediaSize:
required:
- "w"
- "h"
- "resize"
properties:
w:
type: integer
h:
type: integer
resize:
type: string
enum: [crop, fit]