From 522a4aea02e2fc53b0a8e64dbd8fcbaabe3aeb2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Thu, 28 Sep 2023 16:58:50 +0900 Subject: [PATCH 1/5] add Unavailable in extMediaAvailability MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 3 +++ dist/docs/openapi-3.0.yaml | 3 +++ src/openapi/schemas/tweet.yaml | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 3f08f4c..32dfa9c 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -1860,9 +1860,12 @@ components: - users extMediaAvailability: properties: + reason: + type: string status: enum: - Available + - Unavailable type: string mediaStats: properties: diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index 9395c5c..5380396 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -1860,9 +1860,12 @@ components: - users extMediaAvailability: properties: + reason: + type: string status: enum: - Available + - Unavailable type: string mediaStats: properties: diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index 12916cc..ba65356 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -500,9 +500,11 @@ components: # required: # - "status" properties: + reason: + type: string # enum Dmcaed status: type: string - enum: [Available] + enum: [Available, Unavailable] MediaSizes: required: From a4bb8f6e31913decceef6e2810d9fcd43dcba62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 5 Nov 2023 14:18:54 +0900 Subject: [PATCH 2/5] add TimelineCommunity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 9 +++++++++ dist/docs/openapi-3.0.yaml | 9 +++++++++ src/openapi/schemas/content.yaml | 9 +++++++++ src/openapi/schemas/typename.yaml | 1 + 4 files changed, 28 insertions(+) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 32dfa9c..71e9bea 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -60,6 +60,7 @@ components: - TimelineUser - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity type: string ContentUnion: discriminator: @@ -427,6 +428,7 @@ components: ItemContentUnion: discriminator: mapping": + TimelineCommunity: '#/components/schemas/TimelineCommunity' TimelineMessagePrompt: '#/components/schemas/TimelineMessagePrompt' TimelinePrompt: '#/components/schemas/TimelinePrompt' TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' @@ -439,6 +441,7 @@ components: - $ref: '#/components/schemas/TimelineUser' - $ref: '#/components/schemas/TimelinePrompt' - $ref: '#/components/schemas/TimelineMessagePrompt' + - $ref: '#/components/schemas/TimelineCommunity' ItemResult: properties: __typename: @@ -914,6 +917,11 @@ components: $ref: '#/components/schemas/InstructionType' required: - type + TimelineCommunity: + additionalProperties: true + properties: + __typename: + $ref: '#/components/schemas/TypeName' TimelineCoverBehavior: properties: type: @@ -1465,6 +1473,7 @@ components: - TweetTombstone - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity - TweetUnavailable - Tweet - User diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index 5380396..3c52b34 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -60,6 +60,7 @@ components: - TimelineUser - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity type: string ContentUnion: discriminator: @@ -427,6 +428,7 @@ components: ItemContentUnion: discriminator: mapping": + TimelineCommunity: '#/components/schemas/TimelineCommunity' TimelineMessagePrompt: '#/components/schemas/TimelineMessagePrompt' TimelinePrompt: '#/components/schemas/TimelinePrompt' TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' @@ -439,6 +441,7 @@ components: - $ref: '#/components/schemas/TimelineUser' - $ref: '#/components/schemas/TimelinePrompt' - $ref: '#/components/schemas/TimelineMessagePrompt' + - $ref: '#/components/schemas/TimelineCommunity' ItemResult: properties: __typename: @@ -914,6 +917,11 @@ components: $ref: '#/components/schemas/InstructionType' required: - type + TimelineCommunity: + additionalProperties: true + properties: + __typename: + $ref: '#/components/schemas/TypeName' TimelineCoverBehavior: properties: type: @@ -1465,6 +1473,7 @@ components: - TweetTombstone - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity - TweetUnavailable - Tweet - User diff --git a/src/openapi/schemas/content.yaml b/src/openapi/schemas/content.yaml index b4e3a54..4e6352c 100644 --- a/src/openapi/schemas/content.yaml +++ b/src/openapi/schemas/content.yaml @@ -125,6 +125,7 @@ components: - $ref: "#/components/schemas/TimelineUser" - $ref: "#/components/schemas/TimelinePrompt" - $ref: "#/components/schemas/TimelineMessagePrompt" + - $ref: "#/components/schemas/TimelineCommunity" discriminator: propertyName: __typename @@ -134,6 +135,7 @@ components: TimelineUser: "#/components/schemas/TimelineUser" TimelinePrompt: "#/components/schemas/TimelinePrompt" TimelineMessagePrompt: "#/components/schemas/TimelineMessagePrompt" + TimelineCommunity: "#/components/schemas/TimelineCommunity" ContentItemType: type: string @@ -144,6 +146,7 @@ components: TimelineUser, TimelinePrompt, TimelineMessagePrompt, + TimelineCommunity, ] TimelineTweet: @@ -216,6 +219,12 @@ components: $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: diff --git a/src/openapi/schemas/typename.yaml b/src/openapi/schemas/typename.yaml index 85fd323..ee88b92 100644 --- a/src/openapi/schemas/typename.yaml +++ b/src/openapi/schemas/typename.yaml @@ -18,6 +18,7 @@ components: TweetTombstone, TimelinePrompt, TimelineMessagePrompt, + TimelineCommunity, TweetUnavailable, Tweet, User, From 915b9280f5003c311e2f5f6e3f5b2786afccfaa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 5 Nov 2023 14:43:04 +0900 Subject: [PATCH 3/5] add note tweet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 69 ++++++++++++++++++++++++++++++ dist/docs/openapi-3.0.yaml | 69 ++++++++++++++++++++++++++++++ src/openapi/schemas/tweet.yaml | 72 ++++++++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 71e9bea..2e63116 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -682,6 +682,71 @@ components: required: - entryId - item + NoteTweet: + properties: + is_expandable: + type: boolean + note_tweet_results: + $ref: '#/components/schemas/NoteTweetResult' + required: + - is_expandable + - note_tweet_results + NoteTweetResult: + properties: + result: + $ref: '#/components/schemas/NoteTweetResultData' + required: + - result + NoteTweetResultData: + properties: + entity_set: + $ref: '#/components/schemas/Entities' + id: + pattern: ^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$ + type: string + media: + $ref: '#/components/schemas/NoteTweetResultMedia' + richtext: + $ref: '#/components/schemas/NoteTweetResultRichText' + text: + type: string + required: + - entity_set + - id + - text + NoteTweetResultMedia: + properties: + inline_media: + items: + type: object + type: array + required: + - inline_media + NoteTweetResultRichText: + properties: + richtext_tags: + items: + $ref: '#/components/schemas/NoteTweetResultRichTextTag' + type: array + required: + - richtext_tags + NoteTweetResultRichTextTag: + properties: + from_index: + type: integer + richtext_types: + items: + enum: + - Bold + - Italic + type: string + type: array + to_index: + type: integer + required: + - from_index + - to_index + - richtext_types OneFactorLoginEligibility: properties: fetchStatus: @@ -1197,6 +1262,10 @@ components: type: boolean legacy: $ref: '#/components/schemas/TweetLegacy' + note_tweet: + $ref: '#/components/schemas/NoteTweet' + quick_promote_eligibility: + type: object quoted_status_result: $ref: '#/components/schemas/ItemResult' rest_id: diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index 3c52b34..cd012cb 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -682,6 +682,71 @@ components: required: - entryId - item + NoteTweet: + properties: + is_expandable: + type: boolean + note_tweet_results: + $ref: '#/components/schemas/NoteTweetResult' + required: + - is_expandable + - note_tweet_results + NoteTweetResult: + properties: + result: + $ref: '#/components/schemas/NoteTweetResultData' + required: + - result + NoteTweetResultData: + properties: + entity_set: + $ref: '#/components/schemas/Entities' + id: + pattern: ^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?$ + type: string + media: + $ref: '#/components/schemas/NoteTweetResultMedia' + richtext: + $ref: '#/components/schemas/NoteTweetResultRichText' + text: + type: string + required: + - entity_set + - id + - text + NoteTweetResultMedia: + properties: + inline_media: + items: + type: object + type: array + required: + - inline_media + NoteTweetResultRichText: + properties: + richtext_tags: + items: + $ref: '#/components/schemas/NoteTweetResultRichTextTag' + type: array + required: + - richtext_tags + NoteTweetResultRichTextTag: + properties: + from_index: + type: integer + richtext_types: + items: + enum: + - Bold + - Italic + type: string + type: array + to_index: + type: integer + required: + - from_index + - to_index + - richtext_types OneFactorLoginEligibility: properties: fetchStatus: @@ -1197,6 +1262,10 @@ components: type: boolean legacy: $ref: '#/components/schemas/TweetLegacy' + note_tweet: + $ref: '#/components/schemas/NoteTweet' + quick_promote_eligibility: + type: object quoted_status_result: $ref: '#/components/schemas/ItemResult' rest_id: diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index ba65356..3f4baf0 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -74,6 +74,10 @@ components: $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: @@ -134,6 +138,74 @@ components: 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] + TweetCard: properties: rest_id: From e9964037bf21054c6187ac8b01d5bf45e4de48aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 5 Nov 2023 14:55:45 +0900 Subject: [PATCH 4/5] add Community note MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- dist/compatible/openapi-3.0.yaml | 91 +++++++++++++++++++++++++++++++ dist/docs/openapi-3.0.yaml | 91 +++++++++++++++++++++++++++++++ src/openapi/schemas/tweet.yaml | 93 ++++++++++++++++++++++++++++++++ 3 files changed, 275 insertions(+) diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 2e63116..0fffc2c 100644 --- a/dist/compatible/openapi-3.0.yaml +++ b/dist/compatible/openapi-3.0.yaml @@ -6,6 +6,95 @@ components: type: boolean required: - monetizable + BirdwatchEntity: + properties: + fromIndex: + type: integer + ref: + $ref: '#/components/schemas/BirdwatchEntityRef' + toIndex: + type: integer + required: + - fromIndex + - toIndex + - ref + BirdwatchEntityRef: + properties: + type: + enum: + - TimelineUrl + type: string + url: + format: uri + type: string + urlType: + enum: + - ExternalUrl + type: string + required: + - type + - url + - urlType + BirdwatchPivot: + properties: + destinationUrl: + format: uri + type: string + footer: + $ref: '#/components/schemas/BirdwatchPivotFooter' + iconType: + enum: + - BirdwatchV1Icon + type: string + note: + $ref: '#/components/schemas/BirdwatchPivotNote' + shorttitle: + type: string + subtitle: + $ref: '#/components/schemas/BirdwatchPivotSubtitle' + title: + type: string + visualStyle: + enum: + - Default + type: string + required: + - destinationUrl + - footer + - note + - subtitle + - title + - shorttitle + - iconType + BirdwatchPivotFooter: + properties: + entities: + items: + $ref: '#/components/schemas/BirdwatchEntity' + type: array + text: + type: string + required: + - text + - entities + BirdwatchPivotNote: + properties: + rest_id: + pattern: ^[0-9]+$ + type: string + required: + - rest_id + BirdwatchPivotSubtitle: + properties: + entities: + items: + $ref: '#/components/schemas/BirdwatchEntity' + type: array + text: + type: string + required: + - text + - entities BookmarksResponse: properties: data: @@ -1249,6 +1338,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + birdwatch_pivot: + $ref: '#/components/schemas/BirdwatchPivot' card: $ref: '#/components/schemas/TweetCard' core: diff --git a/dist/docs/openapi-3.0.yaml b/dist/docs/openapi-3.0.yaml index cd012cb..84a5a8d 100644 --- a/dist/docs/openapi-3.0.yaml +++ b/dist/docs/openapi-3.0.yaml @@ -6,6 +6,95 @@ components: type: boolean required: - monetizable + BirdwatchEntity: + properties: + fromIndex: + type: integer + ref: + $ref: '#/components/schemas/BirdwatchEntityRef' + toIndex: + type: integer + required: + - fromIndex + - toIndex + - ref + BirdwatchEntityRef: + properties: + type: + enum: + - TimelineUrl + type: string + url: + format: uri + type: string + urlType: + enum: + - ExternalUrl + type: string + required: + - type + - url + - urlType + BirdwatchPivot: + properties: + destinationUrl: + format: uri + type: string + footer: + $ref: '#/components/schemas/BirdwatchPivotFooter' + iconType: + enum: + - BirdwatchV1Icon + type: string + note: + $ref: '#/components/schemas/BirdwatchPivotNote' + shorttitle: + type: string + subtitle: + $ref: '#/components/schemas/BirdwatchPivotSubtitle' + title: + type: string + visualStyle: + enum: + - Default + type: string + required: + - destinationUrl + - footer + - note + - subtitle + - title + - shorttitle + - iconType + BirdwatchPivotFooter: + properties: + entities: + items: + $ref: '#/components/schemas/BirdwatchEntity' + type: array + text: + type: string + required: + - text + - entities + BirdwatchPivotNote: + properties: + rest_id: + pattern: ^[0-9]+$ + type: string + required: + - rest_id + BirdwatchPivotSubtitle: + properties: + entities: + items: + $ref: '#/components/schemas/BirdwatchEntity' + type: array + text: + type: string + required: + - text + - entities BookmarksResponse: properties: data: @@ -1249,6 +1338,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + birdwatch_pivot: + $ref: '#/components/schemas/BirdwatchPivot' card: $ref: '#/components/schemas/TweetCard' core: diff --git a/src/openapi/schemas/tweet.yaml b/src/openapi/schemas/tweet.yaml index 3f4baf0..39fca11 100644 --- a/src/openapi/schemas/tweet.yaml +++ b/src/openapi/schemas/tweet.yaml @@ -52,6 +52,8 @@ components: rest_id: type: string pattern: "^[0-9]+$" + birdwatch_pivot: + $ref: "#/components/schemas/BirdwatchPivot" core: $ref: "./user.yaml#/components/schemas/UserResultCore" card: @@ -206,6 +208,97 @@ components: 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: From e2cab224ae2b3addf84d8ebfde2ff87bd9202076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= Date: Sun, 5 Nov 2023 14:55:53 +0900 Subject: [PATCH 5/5] add test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ふぁ --- test/python/test_serialize.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/python/test_serialize.py b/test/python/test_serialize.py index 4968856..a0e631c 100644 --- a/test/python/test_serialize.py +++ b/test/python/test_serialize.py @@ -256,5 +256,29 @@ if __name__ == "__main__": error_dump(e) error_count += 1 + try: + logger.info(f"Try: Self TweetDetail Test") + kwargs = get_kwargs("TweetDetail", {"focalTweetId": "1720975693524377759"}) + res = pt.TweetApi(api_client).get_tweet_detail_with_http_info(**kwargs) + data = res.data.to_dict() + + rate = match_rate(data, json.loads(res.raw_data)) + logger.info(f"Match rate: {rate}") + except Exception as e: + error_dump(e) + error_count += 1 + + try: + logger.info(f"Try: Self TweetDetail Test") + kwargs = get_kwargs("TweetDetail", {"focalTweetId": "1720818185186791678"}) + res = pt.TweetApi(api_client).get_tweet_detail_with_http_info(**kwargs) + data = res.data.to_dict() + + rate = match_rate(data, json.loads(res.raw_data)) + logger.info(f"Match rate: {rate}") + except Exception as e: + error_dump(e) + error_count += 1 + if error_count > 0: exit(1)