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
ふぁ 86315f25a0
add test
Signed-off-by: ふぁ <yuki@yuki0311.com>
2023-07-30 03:17:47 +09:00

208 lines
6 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]
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:
type: object # todo
feedbackInfo:
type: object # todo
TimelineTimelineModule:
required:
- "__typename"
- "entryType"
- "displayType"
# - "items"
- "clientEventInfo"
properties:
__typename:
type: string
value: TimelineTimelineModule
# $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineModule
entryType:
$ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor
displayType:
type: string # enum
items:
type: array
items:
$ref: "#/components/schemas/ModuleItem"
footer:
type: object # todo
header:
type: object # todo
clientEventInfo:
type: object # todo
TimelineTimelineCursor:
required:
- "__typename"
- "cursorType"
- "value"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineCursor
entryType:
$ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor
itemType:
$ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor
cursorType:
type: string
enum: [Top, Bottom, ShowMore, ShowMoreThreads, Gap] # Gap???
value:
type: string
# ================= Module =================
ModuleItem:
required:
- "entryId"
- "item"
properties:
entryId:
type: string
# pattern: '^[a-z\-]+[0-9]+$'
item:
$ref: "#/components/schemas/ModuleEntry"
ModuleEntry:
required:
- "clientEventInfo"
- "itemContent"
properties:
clientEventInfo:
type: object # todo
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"
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"
ContentItemType:
type: string
enum:
[
TimelineTweet,
TimelineTimelineCursor,
TimelineUser,
TimelinePrompt,
TimelineMessagePrompt,
]
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 # todo
TimelineUser:
required:
- "__typename"
- "itemType"
- "socialContext"
- "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_results:
$ref: "./user.yaml#/components/schemas/UserResults"
ItemResult:
required:
- "result"
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
text:
type: string
type:
type: string # enum
TimelinePrompt: # todo
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelinePrompt
TimelineMessagePrompt: # todo
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TimelineMessagePrompt