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/content.yaml
ふぁ a82844dfa5
update schema
Signed-off-by: ふぁ <yuki@yuki0311.com>
2024-02-09 17:22:13 +09:00

317 lines
8.9 KiB
YAML

openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
schemas:
ContentUnion:
oneOf:
- $ref: "#/components/schemas/TimelineTimelineItem"
- $ref: "#/components/schemas/TimelineTimelineModule"
- $ref: "#/components/schemas/TimelineTimelineCursor"
discriminator:
propertyName: entryType
mapping": # deprecated
TimelineTimelineItem: "#/components/schemas/TimelineTimelineItem"
TimelineTimelineModule: "#/components/schemas/TimelineTimelineModule"
TimelineTimelineCursor: "#/components/schemas/TimelineTimelineCursor"
ContentEntryType:
type: string
enum:
[TimelineTimelineItem, TimelineTimelineCursor, TimelineTimelineModule]
CursorType:
type: string
enum: [Top, Bottom, ShowMore, ShowMoreThreads, Gap] # Gap???
TimelineTimelineItem:
required:
- "__typename"
- "entryType"
- "itemContent"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineItem
entryType:
$ref: "#/components/schemas/ContentEntryType" # TimelineTimelineItem
itemContent:
$ref: "#/components/schemas/ItemContentUnion"
clientEventInfo:
$ref: "#/components/schemas/ClientEventInfo"
feedbackInfo:
type: object
additionalProperties: true # todo
TimelineTimelineModule:
required:
- "__typename"
- "entryType"
- "displayType"
# - "items"
- "clientEventInfo"
properties:
__typename:
type: string
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineModule
entryType:
$ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor
displayType:
type: string
enum: [Vertical, VerticalConversation, VerticalGrid, Carousel]
items:
type: array
items:
$ref: "#/components/schemas/ModuleItem"
footer:
type: object
additionalProperties: true # todo
header:
type: object
additionalProperties: true # todo
clientEventInfo:
type: object
additionalProperties: true # todo
metadata:
type: object
additionalProperties: true # todo
TimelineTimelineCursor:
required:
- "__typename"
- "cursorType"
- "value"
- "stopOnEmptyResponse"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineCursor
entryType:
$ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor
itemType:
$ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor
cursorType:
$ref: "#/components/schemas/CursorType"
value:
type: string
stopOnEmptyResponse:
type: boolean
default: false
displayTreatment:
$ref: "#/components/schemas/DisplayTreatment"
DisplayTreatment:
type: object
required:
- "actionText"
properties:
actionText:
type: string
# ================= Module =================
ModuleItem:
required:
- "entryId"
- "item"
properties:
entryId:
type: string
pattern: "^(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+"
item:
$ref: "#/components/schemas/ModuleEntry"
ModuleEntry:
required:
- "itemContent"
properties:
clientEventInfo:
$ref: "#/components/schemas/ClientEventInfo"
itemContent:
$ref: "#/components/schemas/ItemContentUnion"
# ================= ContentItem =================
ItemContentUnion:
oneOf:
- $ref: "#/components/schemas/TimelineTweet"
- $ref: "#/components/schemas/TimelineTimelineCursor"
- $ref: "#/components/schemas/TimelineUser"
- $ref: "#/components/schemas/TimelinePrompt"
- $ref: "#/components/schemas/TimelineMessagePrompt"
- $ref: "#/components/schemas/TimelineCommunity"
discriminator:
propertyName: __typename
mapping": # deprecated
TimelineTweet: "#/components/schemas/TimelineTweet"
TimelineTimelineCursor: "#/components/schemas/TimelineTimelineCursor"
TimelineUser: "#/components/schemas/TimelineUser"
TimelinePrompt: "#/components/schemas/TimelinePrompt"
TimelineMessagePrompt: "#/components/schemas/TimelineMessagePrompt"
TimelineCommunity: "#/components/schemas/TimelineCommunity"
ContentItemType:
type: string
enum:
[
TimelineTweet,
TimelineTimelineCursor,
TimelineUser,
TimelinePrompt,
TimelineMessagePrompt,
TimelineCommunity,
]
TimelineTweet:
required:
- "__typename"
- "itemType"
- "tweetDisplayType"
- "tweet_results"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTweet
itemType:
$ref: "#/components/schemas/ContentItemType" # TimelineTweet
tweetDisplayType:
type: string
tweet_results:
$ref: "#/components/schemas/ItemResult"
socialContext:
$ref: "#/components/schemas/SocialContext"
promotedMetadata:
type: object
additionalProperties: true # todo
highlights:
$ref: "#/components/schemas/Highlight"
TimelineUser:
required:
- "__typename"
- "itemType"
- "userDisplayType"
- "user_results"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineUser
itemType:
$ref: "#/components/schemas/ContentItemType" # TimelineUser
socialContext:
$ref: "#/components/schemas/SocialContext"
userDisplayType:
type: string
enum: [User, UserDetailed, SubscribableUser]
user_results:
$ref: "./user.yaml#/components/schemas/UserResults"
ItemResult:
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # null | TimelineTweet
result:
$ref: "./tweet.yaml#/components/schemas/TweetUnion"
SocialContext:
type: object
properties:
contextType:
type: string # enum
enum: ["Follow"]
text:
type: string
type:
type: string # enum
enum: ["TimelineGeneralContext"]
landingUrl:
$ref: "#/components/schemas/SocialContextLandingUrl"
SocialContextLandingUrl:
type: object
properties:
urlType:
type: string # enum
enum: ["DeepLink", "UrtEndpoint"]
url:
type: string # twitter://user?id=900282258736545792
format: uri
urtEndpointOptions:
$ref: "#/components/schemas/UrtEndpointOptions"
UrtEndpointOptions:
type: object
required:
- "title"
- "requestParams"
properties:
title:
type: string
requestParams:
type: array
items:
$ref: "#/components/schemas/UrtEndpointRequestParams"
UrtEndpointRequestParams:
type: object
required:
- "key"
- "value"
properties:
key:
type: string
value:
type: string
Highlight:
type: object
required:
- "textHighlights"
properties:
textHighlights:
type: array
items:
$ref: "#/components/schemas/TextHighlight"
TextHighlight:
type: object
required:
- "startIndex"
- "endIndex"
properties:
startIndex:
type: integer
endIndex:
type: integer
TimelinePrompt:
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelinePrompt
additionalProperties: true # todo
TimelineMessagePrompt:
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineMessagePrompt
additionalProperties: true # todo
TimelineCommunity:
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineCommunity
additionalProperties: true # todo
ClientEventInfo:
properties:
component:
# enum half_cover
type: string
element:
type: string
# august-2023-privacy-prompt-candidate
# pattern: "(([a-z]+|[0-9]+|[0-9a-f]+)(-|$))+"
# pattern: "^(january|february|march|april|may|june|july|august|september|october|november|december)-[0-9]{4}-([a-z]-)+[a-z]+$"
details:
type: object
additionalProperties: true # todo