From a16f4a691537dc898eef26496e0138350f4b01cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Tue, 18 Apr 2023 19:07:40 +0900 Subject: [PATCH] add TweetDetail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/openapi-3.0.yaml | 2 + dist/path/tweet.yaml | 100 ++++++++++++++++++++++ dist/schemas/content.yaml | 120 +++++++++++++++------------ dist/schemas/instruction.yaml | 16 ++++ src/config/placeholder.json | 34 ++++++++ src/openapi/path/tweet.yaml | 36 ++++++++ src/openapi/schemas/content.yaml | 25 ++++-- src/openapi/schemas/instruction.yaml | 22 ++++- src/openapi/schemas/tweet.yaml | 3 +- 9 files changed, 297 insertions(+), 61 deletions(-) create mode 100644 dist/path/tweet.yaml create mode 100644 src/openapi/path/tweet.yaml diff --git a/dist/openapi-3.0.yaml b/dist/openapi-3.0.yaml index a5faf83..6d3508e 100644 --- a/dist/openapi-3.0.yaml +++ b/dist/openapi-3.0.yaml @@ -60,6 +60,8 @@ paths: $ref: ./path/user.yaml#/paths/~1sLVLhk0bGj3MVFEKTdax1w~1UserByScreenName /tmd4ifV8RHltzn8ymGg1aw/Bookmarks: $ref: ./path/bookmarks.yaml#/paths/~1tmd4ifV8RHltzn8ymGg1aw~1Bookmarks + /wNNG8DBB8EaXw1lq4vFWGA/TweetDetail: + $ref: ./path/tweet.yaml#/paths/~1wNNG8DBB8EaXw1lq4vFWGA~1TweetDetail /zhX91JE87mWvfprhYE97xA/HomeLatestTimeline: $ref: ./path/timeline.yaml#/paths/~1zhX91JE87mWvfprhYE97xA~1HomeLatestTimeline /{{FollowersQuery}}/Followers: diff --git a/dist/path/tweet.yaml b/dist/path/tweet.yaml new file mode 100644 index 0000000..46ad285 --- /dev/null +++ b/dist/path/tweet.yaml @@ -0,0 +1,100 @@ +components: + schemas: + BookmarksResponseData: + properties: + threaded_conversation_with_injections_v2: + $ref: ./../schemas/timeline.yaml#/components/schemas/Timeline + required: + - threaded_conversation_with_injections_v2 + TweetDetailResponse: + properties: + data: + $ref: '#/components/schemas/BookmarksResponseData' + required: + - data +info: + title: Twitter OpenAPI + version: 0.0.1 +openapi: 3.0.3 +paths: + /wNNG8DBB8EaXw1lq4vFWGA/TweetDetail: + get: + description: get TweetDetail + operationId: getTweetDetail + parameters: + - in: query + name: variables + required: true + schema: + example: '{"focalTweetId": "1349129669258448897", "with_rux_injections": + false, "includePromotedContent": true, "withCommunity": true, "withQuickPromoteEligibilityTweetFields": + true, "withBirdwatchNotes": true, "withVoice": true, "withV2Timeline": + true}' + type: string + - in: query + name: features + required: true + schema: + example: '{"blue_business_profile_image_shape_enabled": true, "responsive_web_graphql_exclude_directive_enabled": + true, "verified_phone_label_enabled": false, "responsive_web_graphql_timeline_navigation_enabled": + true, "responsive_web_graphql_skip_user_profile_image_extensions_enabled": + false, "tweetypie_unmention_optimization_enabled": true, "vibe_api_enabled": + true, "responsive_web_edit_tweet_api_enabled": true, "graphql_is_translatable_rweb_tweet_is_translatable_enabled": + true, "view_counts_everywhere_api_enabled": true, "longform_notetweets_consumption_enabled": + true, "tweet_awards_web_tipping_enabled": false, "freedom_of_speech_not_reach_fetch_enabled": + false, "standardized_nudges_misinfo": true, "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": + false, "interactive_text_enabled": true, "responsive_web_text_conversations_enabled": + false, "longform_notetweets_rich_text_read_enabled": true, "responsive_web_enhance_cards_enabled": + false}' + type: string + - in: query + name: queryId + required: true + schema: + default: wNNG8DBB8EaXw1lq4vFWGA + example: wNNG8DBB8EaXw1lq4vFWGA + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TweetDetailResponse' + description: Successful operation + headers: + x-connection-hash: + schema: + type: string + x-content-type-options: + schema: + type: string + x-frame-options: + schema: + type: string + x-rate-limit-limit: + schema: + type: integer + x-rate-limit-remaining: + schema: + type: integer + x-rate-limit-reset: + schema: + type: integer + x-response-time: + schema: + type: integer + x-tfe-preserve-body: + schema: + type: boolean + x-transaction-id: + schema: + type: string + x-twitter-response-tags: + schema: + type: string + x-xss-protection: + schema: + type: integer + tags: + - bookmark + - graphql diff --git a/dist/schemas/content.yaml b/dist/schemas/content.yaml index 9818ad0..5f83e40 100644 --- a/dist/schemas/content.yaml +++ b/dist/schemas/content.yaml @@ -9,6 +9,7 @@ components: ContentItemType: enum: - TimelineTweet + - TimelineTimelineCursor type: string ContentUnion: discriminator: @@ -21,7 +22,72 @@ components: - $ref: '#/components/schemas/TimelineTimelineItem' - $ref: '#/components/schemas/TimelineTimelineCursor' - $ref: '#/components/schemas/TimelineTimelineModule' - ItemContent: + ItemContentUnion: + discriminator: + mapping": + TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' + TimelineTweet: '#/components/schemas/TimelineTweet' + propertyName: itemType + oneOf: + - $ref: '#/components/schemas/TimelineTweet' + - $ref: '#/components/schemas/TimelineTimelineCursor' + ItemResult: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + result: + $ref: ./tweet.yaml#/components/schemas/TweetUnion + required: + - result + TimelineTimelineCursor: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + cursorType: + enum: + - Top + - Bottom + type: string + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + itemType: + $ref: '#/components/schemas/ContentEntryType' + type: string + value: + type: string + required: + - __typename + - cursorType + - value + TimelineTimelineItem: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + clientEventInfo: + type: object + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + feedbackInfo: + type: object + itemContent: + $ref: '#/components/schemas/ItemContentUnion' + required: + - __typename + - entryType + - itemContent + TimelineTimelineModule: + properties: + __typename: + $ref: ./typename.yaml#/components/schemas/TypeName + entryType: + $ref: '#/components/schemas/ContentEntryType' + type: string + required: + - __typename + - entryType + TimelineTweet: properties: __typename: $ref: ./typename.yaml#/components/schemas/TypeName @@ -46,58 +112,6 @@ components: - itemType - tweetDisplayType - tweet_results - ItemResult: - properties: - result: - $ref: ./tweet.yaml#/components/schemas/TweetUnion - required: - - result - TimelineTimelineCursor: - properties: - __typename: - $ref: ./typename.yaml#/components/schemas/TypeName - cursorType: - enum: - - Top - - Bottom - type: string - entryType: - $ref: '#/components/schemas/ContentEntryType' - type: string - value: - type: string - required: - - __typename - - entryType - - cursorType - - value - TimelineTimelineItem: - properties: - __typename: - $ref: ./typename.yaml#/components/schemas/TypeName - clientEventInfo: - type: object - entryType: - $ref: '#/components/schemas/ContentEntryType' - type: string - feedbackInfo: - type: object - itemContent: - $ref: '#/components/schemas/ItemContent' - required: - - __typename - - entryType - - itemContent - TimelineTimelineModule: - properties: - __typename: - $ref: ./typename.yaml#/components/schemas/TypeName - entryType: - $ref: '#/components/schemas/ContentEntryType' - type: string - required: - - __typename - - entryType info: title: Twitter OpenAPI version: 0.0.1 diff --git a/dist/schemas/instruction.yaml b/dist/schemas/instruction.yaml index 5097676..9f73553 100644 --- a/dist/schemas/instruction.yaml +++ b/dist/schemas/instruction.yaml @@ -5,6 +5,7 @@ components: - TimelineAddEntries - TimelineClearCache - TimelinePinEntry + - TimelineTerminateTimeline type: string InstructionUnion: discriminator: @@ -12,11 +13,13 @@ components: TimelineAddEntries: '#/components/schemas/TimelineAddEntries' TimelineClearCache: '#/components/schemas/TimelineClearCache' TimelinePinEntry: '#/components/schemas/TimelinePinEntry' + TimelineTerminateTimeline: '#/components/schemas/TimelineTerminateTimeline' propertyName: type oneOf: - $ref: '#/components/schemas/TimelineAddEntries' - $ref: '#/components/schemas/TimelineClearCache' - $ref: '#/components/schemas/TimelinePinEntry' + - $ref: '#/components/schemas/TimelineTerminateTimeline' TimelineAddEntries: properties: entries: @@ -60,6 +63,19 @@ components: required: - type - entry + TimelineTerminateTimeline: + properties: + direction: + enum: + - Top + - Bottom + type: string + type: + $ref: '#/components/schemas/InstructionType' + type: string + required: + - type + - direction info: title: Twitter OpenAPI version: 0.0.1 diff --git a/src/config/placeholder.json b/src/config/placeholder.json index 8fd7909..2471896 100644 --- a/src/config/placeholder.json +++ b/src/config/placeholder.json @@ -261,6 +261,40 @@ "responsive_web_enhance_cards_enabled": false } }, + "TweetDetail": { + "Query": "wNNG8DBB8EaXw1lq4vFWGA", + "Variables": { + "focalTweetId": "1349129669258448897", + "with_rux_injections": false, + "includePromotedContent": true, + "withCommunity": true, + "withQuickPromoteEligibilityTweetFields": true, + "withBirdwatchNotes": true, + "withVoice": true, + "withV2Timeline": true + }, + "Features": { + "blue_business_profile_image_shape_enabled": true, + "responsive_web_graphql_exclude_directive_enabled": true, + "verified_phone_label_enabled": false, + "responsive_web_graphql_timeline_navigation_enabled": true, + "responsive_web_graphql_skip_user_profile_image_extensions_enabled": false, + "tweetypie_unmention_optimization_enabled": true, + "vibe_api_enabled": true, + "responsive_web_edit_tweet_api_enabled": true, + "graphql_is_translatable_rweb_tweet_is_translatable_enabled": true, + "view_counts_everywhere_api_enabled": true, + "longform_notetweets_consumption_enabled": true, + "tweet_awards_web_tipping_enabled": false, + "freedom_of_speech_not_reach_fetch_enabled": false, + "standardized_nudges_misinfo": true, + "tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled": false, + "interactive_text_enabled": true, + "responsive_web_text_conversations_enabled": false, + "longform_notetweets_rich_text_read_enabled": true, + "responsive_web_enhance_cards_enabled": false + } + }, "Template": { "Query": "", "Variables": {}, diff --git a/src/openapi/path/tweet.yaml b/src/openapi/path/tweet.yaml new file mode 100644 index 0000000..cfe677b --- /dev/null +++ b/src/openapi/path/tweet.yaml @@ -0,0 +1,36 @@ +openapi: 3.0.3 +info: + title: Twitter OpenAPI + version: 0.0.1 + +paths: + /{{TweetDetailQuery}}/TweetDetail: + get: + operationId: getTweetDetail + description: get TweetDetail + responses: + "200": + description: Successful operation + content: + application/json: + schema: + $ref: "#/components/schemas/TweetDetailResponse" + tags: + - "bookmark" + - "graphql" + +components: + schemas: + TweetDetailResponse: + required: + - "data" + properties: + data: + $ref: "#/components/schemas/BookmarksResponseData" + + BookmarksResponseData: + required: + - "threaded_conversation_with_injections_v2" + properties: + threaded_conversation_with_injections_v2: + $ref: "./../schemas/timeline.yaml#/components/schemas/Timeline" diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml index 337e7ca..515b103 100644 --- a/src/openapi/schemas/content.yaml +++ b/src/openapi/schemas/content.yaml @@ -35,7 +35,7 @@ components: type: string # enum $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineItem itemContent: - $ref: "#/components/schemas/ItemContent" + $ref: "#/components/schemas/ItemContentUnion" clientEventInfo: type: object # todo feedbackInfo: @@ -44,7 +44,6 @@ components: TimelineTimelineCursor: required: - "__typename" - - "entryType" - "cursorType" - "value" properties: @@ -52,7 +51,10 @@ components: $ref: "./typename.yaml#/components/schemas/TypeName" # TimelineTimelineCursor entryType: type: string # enum - $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor + $ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor + itemType: + type: string # enum + $ref: "#/components/schemas/ContentEntryType" # null | TimelineTimelineCursor cursorType: type: string enum: [Top, Bottom] @@ -72,11 +74,22 @@ components: $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor # ================= ContentItem ================= + + ItemContentUnion: + oneOf: + - $ref: "#/components/schemas/TimelineTweet" + - $ref: "#/components/schemas/TimelineTimelineCursor" + discriminator: + propertyName: itemType + mapping": # deprecated + TimelineTweet: "#/components/schemas/TimelineTweet" + TimelineTimelineCursor: "#/components/schemas/TimelineTimelineCursor" + ContentItemType: type: string - enum: [TimelineTweet] + enum: [TimelineTweet, TimelineTimelineCursor] - ItemContent: + TimelineTweet: required: - "__typename" - "itemType" @@ -106,5 +119,7 @@ components: required: - "result" properties: + __typename: + $ref: "./typename.yaml#/components/schemas/TypeName" # null | TimelineTweet result: $ref: "./tweet.yaml#/components/schemas/TweetUnion" diff --git a/src/openapi/schemas/instruction.yaml b/src/openapi/schemas/instruction.yaml index 9e29f6a..4224b17 100644 --- a/src/openapi/schemas/instruction.yaml +++ b/src/openapi/schemas/instruction.yaml @@ -11,16 +11,24 @@ components: - $ref: "#/components/schemas/TimelineAddEntries" - $ref: "#/components/schemas/TimelineClearCache" - $ref: "#/components/schemas/TimelinePinEntry" + - $ref: "#/components/schemas/TimelineTerminateTimeline" discriminator: propertyName: type mapping": # deprecated TimelineAddEntries: "#/components/schemas/TimelineAddEntries" TimelineClearCache: "#/components/schemas/TimelineClearCache" TimelinePinEntry: "#/components/schemas/TimelinePinEntry" + TimelineTerminateTimeline: "#/components/schemas/TimelineTerminateTimeline" InstructionType: type: string - enum: [TimelineAddEntries, TimelineClearCache, TimelinePinEntry] + enum: + [ + TimelineAddEntries, + TimelineClearCache, + TimelinePinEntry, + TimelineTerminateTimeline, + ] TimelineAddEntries: required: @@ -54,6 +62,18 @@ components: entry: $ref: "#/components/schemas/TimelineAddEntry" + TimelineTerminateTimeline: + required: + - type + - direction + properties: + type: + type: string + $ref: "#/components/schemas/InstructionType" # TimelineTerminateTimeline + direction: + type: string + enum: [Top, Bottom] + TimelineAddEntry: required: - "content" diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index 1c66435..e96ce9e 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -29,7 +29,6 @@ components: Tweet: required: - # - "__typename" - "rest_id" - "core" - "edit_control" @@ -40,7 +39,7 @@ components: properties: __typename: - $ref: "./typename.yaml#/components/schemas/TypeName" # Tweet + $ref: "./typename.yaml#/components/schemas/TypeName" # null | Tweet rest_id: type: string pattern: "^[0-9]+$"