diff --git a/dist/compatible/openapi-3.0.yaml b/dist/compatible/openapi-3.0.yaml index 3f08f4c..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: @@ -60,6 +149,7 @@ components: - TimelineUser - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity type: string ContentUnion: discriminator: @@ -427,6 +517,7 @@ components: ItemContentUnion: discriminator: mapping": + TimelineCommunity: '#/components/schemas/TimelineCommunity' TimelineMessagePrompt: '#/components/schemas/TimelineMessagePrompt' TimelinePrompt: '#/components/schemas/TimelinePrompt' TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' @@ -439,6 +530,7 @@ components: - $ref: '#/components/schemas/TimelineUser' - $ref: '#/components/schemas/TimelinePrompt' - $ref: '#/components/schemas/TimelineMessagePrompt' + - $ref: '#/components/schemas/TimelineCommunity' ItemResult: properties: __typename: @@ -679,6 +771,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: @@ -914,6 +1071,11 @@ components: $ref: '#/components/schemas/InstructionType' required: - type + TimelineCommunity: + additionalProperties: true + properties: + __typename: + $ref: '#/components/schemas/TypeName' TimelineCoverBehavior: properties: type: @@ -1176,6 +1338,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + birdwatch_pivot: + $ref: '#/components/schemas/BirdwatchPivot' card: $ref: '#/components/schemas/TweetCard' core: @@ -1189,6 +1353,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: @@ -1465,6 +1633,7 @@ components: - TweetTombstone - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity - TweetUnavailable - Tweet - User @@ -1860,9 +2029,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..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: @@ -60,6 +149,7 @@ components: - TimelineUser - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity type: string ContentUnion: discriminator: @@ -427,6 +517,7 @@ components: ItemContentUnion: discriminator: mapping": + TimelineCommunity: '#/components/schemas/TimelineCommunity' TimelineMessagePrompt: '#/components/schemas/TimelineMessagePrompt' TimelinePrompt: '#/components/schemas/TimelinePrompt' TimelineTimelineCursor: '#/components/schemas/TimelineTimelineCursor' @@ -439,6 +530,7 @@ components: - $ref: '#/components/schemas/TimelineUser' - $ref: '#/components/schemas/TimelinePrompt' - $ref: '#/components/schemas/TimelineMessagePrompt' + - $ref: '#/components/schemas/TimelineCommunity' ItemResult: properties: __typename: @@ -679,6 +771,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: @@ -914,6 +1071,11 @@ components: $ref: '#/components/schemas/InstructionType' required: - type + TimelineCommunity: + additionalProperties: true + properties: + __typename: + $ref: '#/components/schemas/TypeName' TimelineCoverBehavior: properties: type: @@ -1176,6 +1338,8 @@ components: properties: __typename: $ref: '#/components/schemas/TypeName' + birdwatch_pivot: + $ref: '#/components/schemas/BirdwatchPivot' card: $ref: '#/components/schemas/TweetCard' core: @@ -1189,6 +1353,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: @@ -1465,6 +1633,7 @@ components: - TweetTombstone - TimelinePrompt - TimelineMessagePrompt + - TimelineCommunity - TweetUnavailable - Tweet - User @@ -1860,9 +2029,12 @@ components: - users extMediaAvailability: properties: + reason: + type: string status: enum: - Available + - Unavailable type: string mediaStats: properties: 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/tweet.yaml b/src/openapi/schemas/tweet.yaml index 12916cc..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: @@ -74,6 +76,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 +140,165 @@ 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] + + 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: @@ -500,9 +665,11 @@ components: # required: # - "status" properties: + reason: + type: string # enum Dmcaed status: type: string - enum: [Available] + enum: [Available, Unavailable] MediaSizes: required: 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, 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)