1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 15:40:26 +01:00

Merge pull request #54 from fa0311/dev

update schema
This commit is contained in:
ふぁ 2024-02-14 11:28:00 +09:00 committed by GitHub
commit 20a8207175
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 147 additions and 107 deletions

View file

@ -39,7 +39,7 @@ jobs:
- name: Get Openapi Generator - name: Get Openapi Generator
run: | run: |
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -O openapi-generator-cli.jar --no-verbose wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar --no-verbose
if: steps.openapi-generator-cache.outputs.cache-hit != 'true' if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
# Python Setup # Python Setup

View file

@ -40,7 +40,7 @@ jobs:
- name: Get Openapi Generator - name: Get Openapi Generator
run: | run: |
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -O openapi-generator-cli.jar --no-verbose wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar --no-verbose
if: steps.openapi-generator-cache.outputs.cache-hit != 'true' if: steps.openapi-generator-cache.outputs.cache-hit != 'true'
# Python Setup # Python Setup

4
.vscode/tasks.json vendored
View file

@ -34,14 +34,14 @@
"command": [ "command": [
"python3 -m venv .venv;", "python3 -m venv .venv;",
".venv/bin/python3 -m pip install -r requirements.txt;", ".venv/bin/python3 -m pip install -r requirements.txt;",
"wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -O openapi-generator-cli.jar;" "wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -O openapi-generator-cli.jar;"
] ]
}, },
"windows": { "windows": {
"command": [ "command": [
"python -m venv .venv;", "python -m venv .venv;",
".venv/Scripts/python -m pip install -r requirements.txt;", ".venv/Scripts/python -m pip install -r requirements.txt;",
"Invoke-WebRequest https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar -OutFile openapi-generator-cli.jar;" "Invoke-WebRequest https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.3.0/openapi-generator-cli-7.3.0.jar -OutFile openapi-generator-cli.jar;"
] ]
} }
} }

View file

@ -19,10 +19,10 @@ components:
AdditionalMediaInfoCallToActions: AdditionalMediaInfoCallToActions:
properties: properties:
visit_site: visit_site:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsVisitSite' $ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
required: watch_now:
- visit_site $ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
AdditionalMediaInfoCallToActionsVisitSite: AdditionalMediaInfoCallToActionsUrl:
properties: properties:
url: url:
format: uri format: uri
@ -55,9 +55,12 @@ components:
- ref - ref
BirdwatchEntityRef: BirdwatchEntityRef:
properties: properties:
text:
type: string
type: type:
enum: enum:
- TimelineUrl - TimelineUrl
- TimelineRichTextHashtag
type: string type: string
url: url:
format: uri format: uri
@ -68,8 +71,6 @@ components:
type: string type: string
required: required:
- type - type
- url
- urlType
BirdwatchPivot: BirdwatchPivot:
properties: properties:
callToAction: callToAction:
@ -286,7 +287,6 @@ components:
- description - description
- question - question
- search_tags - search_tags
- primary_community_topic
- actions - actions
- admin_results - admin_results
- creator_results - creator_results
@ -885,6 +885,8 @@ components:
type: string type: string
original_info: original_info:
$ref: '#/components/schemas/MediaOriginalInfo' $ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes: sizes:
$ref: '#/components/schemas/MediaSizes' $ref: '#/components/schemas/MediaSizes'
source_status_id_str: source_status_id_str:
@ -949,6 +951,8 @@ components:
type: string type: string
original_info: original_info:
$ref: '#/components/schemas/MediaOriginalInfo' $ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes: sizes:
$ref: '#/components/schemas/MediaSizes' $ref: '#/components/schemas/MediaSizes'
source_status_id_str: source_status_id_str:
@ -1075,6 +1079,8 @@ components:
properties: properties:
clientEventInfo: clientEventInfo:
$ref: '#/components/schemas/ClientEventInfo' $ref: '#/components/schemas/ClientEventInfo'
feedbackInfo:
$ref: '#/components/schemas/FeedbackInfo'
itemContent: itemContent:
$ref: '#/components/schemas/ItemContentUnion' $ref: '#/components/schemas/ItemContentUnion'
required: required:
@ -1201,19 +1207,7 @@ components:
QuotedRefResult: QuotedRefResult:
properties: properties:
result: result:
$ref: '#/components/schemas/QuotedRefResultData' $ref: '#/components/schemas/TweetUnion'
required:
- result
QuotedRefResultData:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
rest_id:
pattern: ^[0-9]+$
type: string
required:
- __typename
- rest_id
QuotedStatusPermalink: QuotedStatusPermalink:
properties: properties:
display: display:
@ -1275,6 +1269,21 @@ components:
type: string type: string
required: required:
- id_str - id_str
SensitiveMediaWarning:
properties:
adult_content:
default: false
type: boolean
graphic_violence:
default: false
type: boolean
other:
default: false
type: boolean
required:
- adult_content
- graphic_violence
- other
Session: Session:
properties: properties:
SsoInitTokens: SsoInitTokens:
@ -1336,6 +1345,7 @@ components:
enum: enum:
- DeepLink - DeepLink
- UrtEndpoint - UrtEndpoint
- ExternalUrl
type: string type: string
urtEndpointOptions: urtEndpointOptions:
$ref: '#/components/schemas/UrtEndpointOptions' $ref: '#/components/schemas/UrtEndpointOptions'
@ -1511,6 +1521,8 @@ components:
- Like - Like
- Location - Location
- Sparkle - Sparkle
- Conversation
- List
type: string type: string
landingUrl: landingUrl:
$ref: '#/components/schemas/SocialContextLandingUrl' $ref: '#/components/schemas/SocialContextLandingUrl'
@ -1856,9 +1868,6 @@ components:
$ref: '#/components/schemas/TweetView' $ref: '#/components/schemas/TweetView'
required: required:
- rest_id - rest_id
- edit_control
- is_translatable
- views
TweetCard: TweetCard:
properties: properties:
legacy: legacy:
@ -2153,6 +2162,7 @@ components:
- community_tweet_non_member_public_community - community_tweet_non_member_public_community
- non_compliant - non_compliant
- dynamic_product_ad - dynamic_product_ad
- stale_tweet
type: string type: string
place: place:
additionalProperties: true additionalProperties: true
@ -2273,6 +2283,7 @@ components:
type: string type: string
state: state:
enum: enum:
- Enabled
- EnabledWithCount - EnabledWithCount
type: string type: string
required: required:
@ -2291,7 +2302,6 @@ components:
required: required:
- __typename - __typename
- tweet - tweet
- limitedActionResults
TwitterTimeFormat: TwitterTimeFormat:
example: Sat Dec 31 23:59:59 +0000 2023 example: Sat Dec 31 23:59:59 +0000 2023
pattern: '^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) pattern: '^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)

View file

@ -19,10 +19,10 @@ components:
AdditionalMediaInfoCallToActions: AdditionalMediaInfoCallToActions:
properties: properties:
visit_site: visit_site:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsVisitSite' $ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
required: watch_now:
- visit_site $ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
AdditionalMediaInfoCallToActionsVisitSite: AdditionalMediaInfoCallToActionsUrl:
properties: properties:
url: url:
format: uri format: uri
@ -55,9 +55,12 @@ components:
- ref - ref
BirdwatchEntityRef: BirdwatchEntityRef:
properties: properties:
text:
type: string
type: type:
enum: enum:
- TimelineUrl - TimelineUrl
- TimelineRichTextHashtag
type: string type: string
url: url:
format: uri format: uri
@ -68,8 +71,6 @@ components:
type: string type: string
required: required:
- type - type
- url
- urlType
BirdwatchPivot: BirdwatchPivot:
properties: properties:
callToAction: callToAction:
@ -286,7 +287,6 @@ components:
- description - description
- question - question
- search_tags - search_tags
- primary_community_topic
- actions - actions
- admin_results - admin_results
- creator_results - creator_results
@ -885,6 +885,8 @@ components:
type: string type: string
original_info: original_info:
$ref: '#/components/schemas/MediaOriginalInfo' $ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes: sizes:
$ref: '#/components/schemas/MediaSizes' $ref: '#/components/schemas/MediaSizes'
source_status_id_str: source_status_id_str:
@ -949,6 +951,8 @@ components:
type: string type: string
original_info: original_info:
$ref: '#/components/schemas/MediaOriginalInfo' $ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes: sizes:
$ref: '#/components/schemas/MediaSizes' $ref: '#/components/schemas/MediaSizes'
source_status_id_str: source_status_id_str:
@ -1075,6 +1079,8 @@ components:
properties: properties:
clientEventInfo: clientEventInfo:
$ref: '#/components/schemas/ClientEventInfo' $ref: '#/components/schemas/ClientEventInfo'
feedbackInfo:
$ref: '#/components/schemas/FeedbackInfo'
itemContent: itemContent:
$ref: '#/components/schemas/ItemContentUnion' $ref: '#/components/schemas/ItemContentUnion'
required: required:
@ -1201,19 +1207,7 @@ components:
QuotedRefResult: QuotedRefResult:
properties: properties:
result: result:
$ref: '#/components/schemas/QuotedRefResultData' $ref: '#/components/schemas/TweetUnion'
required:
- result
QuotedRefResultData:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
rest_id:
pattern: ^[0-9]+$
type: string
required:
- __typename
- rest_id
QuotedStatusPermalink: QuotedStatusPermalink:
properties: properties:
display: display:
@ -1275,6 +1269,21 @@ components:
type: string type: string
required: required:
- id_str - id_str
SensitiveMediaWarning:
properties:
adult_content:
default: false
type: boolean
graphic_violence:
default: false
type: boolean
other:
default: false
type: boolean
required:
- adult_content
- graphic_violence
- other
Session: Session:
properties: properties:
SsoInitTokens: SsoInitTokens:
@ -1336,6 +1345,7 @@ components:
enum: enum:
- DeepLink - DeepLink
- UrtEndpoint - UrtEndpoint
- ExternalUrl
type: string type: string
urtEndpointOptions: urtEndpointOptions:
$ref: '#/components/schemas/UrtEndpointOptions' $ref: '#/components/schemas/UrtEndpointOptions'
@ -1511,6 +1521,8 @@ components:
- Like - Like
- Location - Location
- Sparkle - Sparkle
- Conversation
- List
type: string type: string
landingUrl: landingUrl:
$ref: '#/components/schemas/SocialContextLandingUrl' $ref: '#/components/schemas/SocialContextLandingUrl'
@ -1856,9 +1868,6 @@ components:
$ref: '#/components/schemas/TweetView' $ref: '#/components/schemas/TweetView'
required: required:
- rest_id - rest_id
- edit_control
- is_translatable
- views
TweetCard: TweetCard:
properties: properties:
legacy: legacy:
@ -2153,6 +2162,7 @@ components:
- community_tweet_non_member_public_community - community_tweet_non_member_public_community
- non_compliant - non_compliant
- dynamic_product_ad - dynamic_product_ad
- stale_tweet
type: string type: string
place: place:
additionalProperties: true additionalProperties: true
@ -2273,6 +2283,7 @@ components:
type: string type: string
state: state:
enum: enum:
- Enabled
- EnabledWithCount - EnabledWithCount
type: string type: string
required: required:
@ -2291,7 +2302,6 @@ components:
required: required:
- __typename - __typename
- tweet - tweet
- limitedActionResults
TwitterTimeFormat: TwitterTimeFormat:
example: Sat Dec 31 23:59:59 +0000 2023 example: Sat Dec 31 23:59:59 +0000 2023
pattern: '^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) pattern: '^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)

View file

@ -59,7 +59,7 @@ components:
entryType: entryType:
$ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor $ref: "#/components/schemas/ContentEntryType" # TimelineTimelineCursor
displayType: displayType:
$ref: "#/components/schemas/DisplayType" $ref: "#/components/schemas/DisplayType"
items: items:
type: array type: array
items: items:
@ -139,6 +139,8 @@ components:
$ref: "#/components/schemas/ClientEventInfo" $ref: "#/components/schemas/ClientEventInfo"
itemContent: itemContent:
$ref: "#/components/schemas/ItemContentUnion" $ref: "#/components/schemas/ItemContentUnion"
feedbackInfo:
$ref: "#/components/schemas/FeedbackInfo"
FeedbackInfo: FeedbackInfo:
required: required:
@ -240,14 +242,13 @@ components:
mapping": # deprecated mapping": # deprecated
TimelineGeneralContext: "#/components/schemas/TimelineGeneralContext" TimelineGeneralContext: "#/components/schemas/TimelineGeneralContext"
TimelineTopicContext: "#/components/schemas/TimelineTopicContext" TimelineTopicContext: "#/components/schemas/TimelineTopicContext"
SocialContextUnionType: SocialContextUnionType:
type: string type: string
enum: enum:
- TimelineGeneralContext - TimelineGeneralContext
- TimelineTopicContext - TimelineTopicContext
TimelineGeneralContext: TimelineGeneralContext:
type: object type: object
properties: properties:
@ -255,7 +256,14 @@ components:
$ref: "#/components/schemas/SocialContextUnionType" $ref: "#/components/schemas/SocialContextUnionType"
contextType: contextType:
type: string # enum type: string # enum
enum: ["Follow", "Pin", "Like", "Location", "Sparkle"] enum:
- "Follow"
- "Pin"
- "Like"
- "Location"
- "Sparkle"
- "Conversation"
- "List"
text: text:
type: string type: string
landingUrl: landingUrl:
@ -271,7 +279,7 @@ components:
functionalityType: functionalityType:
type: string type: string
enum: ["Basic"] enum: ["Basic"]
TopicContext: TopicContext:
type: object type: object
properties: properties:
@ -290,13 +298,13 @@ components:
type: boolean type: boolean
not_interested: not_interested:
type: boolean type: boolean
SocialContextLandingUrl: SocialContextLandingUrl:
type: object type: object
properties: properties:
urlType: urlType:
type: string # enum type: string # enum
enum: ["DeepLink", "UrtEndpoint"] enum: ["DeepLink", "UrtEndpoint", "ExternalUrl"]
url: url:
type: string # twitter://user?id=900282258736545792 type: string # twitter://user?id=900282258736545792
format: uri format: uri

View file

@ -23,7 +23,6 @@ components:
required: required:
- "__typename" - "__typename"
- "tweet" - "tweet"
- "limitedActionResults"
properties: properties:
__typename: __typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults $ref: "./typename.yaml#/components/schemas/TypeName" # TweetWithVisibilityResults
@ -120,13 +119,6 @@ components:
Tweet: Tweet:
required: required:
- "rest_id" - "rest_id"
# If the tweet has been edited, this property does not exist.
# - "core"
- "edit_control"
- "is_translatable"
# - "source"
# - "legacy"
- "views"
properties: properties:
__typename: __typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # null | Tweet $ref: "./typename.yaml#/components/schemas/TypeName" # null | Tweet
@ -231,7 +223,9 @@ components:
pattern: "^[0-9]+$" pattern: "^[0-9]+$"
state: state:
type: string type: string
enum: [EnabledWithCount] enum:
- Enabled
- EnabledWithCount
NoteTweet: NoteTweet:
required: required:
@ -341,22 +335,9 @@ components:
type: integer type: integer
QuotedRefResult: QuotedRefResult:
required:
- "result"
properties: properties:
result: result:
$ref: "#/components/schemas/QuotedRefResultData" $ref: "#/components/schemas/TweetUnion"
QuotedRefResultData:
required:
- "__typename"
- "rest_id"
properties:
__typename:
$ref: "./typename.yaml#/components/schemas/TypeName" # Tweet
rest_id:
type: string
pattern: "^[0-9]+$"
SuperFollowsReplyUserResult: SuperFollowsReplyUserResult:
required: required:
@ -409,7 +390,6 @@ components:
- "description" - "description"
- "question" - "question"
- "search_tags" - "search_tags"
- "primary_community_topic"
- "actions" - "actions"
- "admin_results" - "admin_results"
- "creator_results" - "creator_results"
@ -663,21 +643,21 @@ components:
ref: ref:
$ref: "#/components/schemas/BirdwatchEntityRef" $ref: "#/components/schemas/BirdwatchEntityRef"
BirdwatchEntityRef: BirdwatchEntityRef: # Union
required: required:
- "type" - "type"
- "url"
- "urlType"
properties: properties:
type: type:
type: string type: string
enum: [TimelineUrl] enum: [TimelineUrl, TimelineRichTextHashtag]
url: url:
type: string type: string
format: uri format: uri
urlType: urlType:
type: string type: string
enum: [ExternalUrl] enum: [ExternalUrl]
text:
type: string
BirdwatchPivotNote: BirdwatchPivotNote:
required: required:
@ -929,6 +909,7 @@ components:
- "community_tweet_non_member_public_community" - "community_tweet_non_member_public_community"
- "non_compliant" - "non_compliant"
- "dynamic_product_ad" - "dynamic_product_ad"
- "stale_tweet"
place: place:
additionalProperties: true # todo additionalProperties: true # todo
@ -1059,6 +1040,8 @@ components:
pattern: "^[0-9]+$" pattern: "^[0-9]+$"
ext_alt_text: ext_alt_text:
type: string type: string
sensitive_media_warning:
$ref: "#/components/schemas/SensitiveMediaWarning"
TweetLegacyScopes: TweetLegacyScopes:
required: required:
@ -1153,6 +1136,8 @@ components:
pattern: "^[0-9]+$" pattern: "^[0-9]+$"
ext_alt_text: ext_alt_text:
type: string type: string
sensitive_media_warning:
$ref: "#/components/schemas/SensitiveMediaWarning"
MediaOriginalInfo: MediaOriginalInfo:
required: required:
@ -1232,13 +1217,13 @@ components:
$ref: "#/components/schemas/AdditionalMediaInfoCallToActions" $ref: "#/components/schemas/AdditionalMediaInfoCallToActions"
AdditionalMediaInfoCallToActions: AdditionalMediaInfoCallToActions:
required:
- "visit_site"
properties: properties:
visit_site: visit_site:
$ref: "#/components/schemas/AdditionalMediaInfoCallToActionsVisitSite" $ref: "#/components/schemas/AdditionalMediaInfoCallToActionsUrl"
watch_now:
$ref: "#/components/schemas/AdditionalMediaInfoCallToActionsUrl"
AdditionalMediaInfoCallToActionsVisitSite: AdditionalMediaInfoCallToActionsUrl:
required: required:
- "url" - "url"
properties: properties:
@ -1263,6 +1248,22 @@ components:
type: string type: string
enum: [Available, Unavailable] enum: [Available, Unavailable]
SensitiveMediaWarning:
required:
- "adult_content"
- "graphic_violence"
- "other"
properties:
adult_content:
type: boolean
default: false
graphic_violence:
type: boolean
default: false
other:
type: boolean
default: false
MediaSizes: MediaSizes:
required: required:
- "large" - "large"

View file

@ -294,27 +294,38 @@ if __name__ == "__main__":
error_dump(e) error_dump(e)
error_count += 1 error_count += 1
try: ids = [
logger.info("Try: Self UserTweets Test") "1180389371481976833",
kwargs = get_kwargs("UserTweets", {"userId": "1180389371481976833"}) "900282258736545792",
res = pt.TweetApi(api_client).get_user_tweets_with_http_info(**kwargs) "1212617657003859968",
data = res.data.to_dict() "2455740283",
"2326837940",
]
for id in ids:
try:
logger.info("Try: Self UserTweets Test")
kwargs = get_kwargs("UserTweets", {"userId": id})
res = pt.TweetApi(api_client).get_user_tweets_with_http_info(**kwargs)
data = res.data.to_dict()
rate = match_rate( rate = match_rate(
data, data,
json.loads(res.raw_data), json.loads(res.raw_data),
res.data, res.data,
) )
logger.info(f"Match rate: {rate}") logger.info(f"Match rate: {rate}")
except Exception as e: except Exception as e:
error_dump(e) error_dump(e)
error_count += 1 error_count += 1
ids = [ ids = [
"1720975693524377759", "1720975693524377759",
"1721006592303251551", "1721006592303251551",
"1606661809075019776", "1739194269477331076",
"1697450269259522256",
"1697450278742884799",
"1749500209061663043",
] ]
for id in ids: for id in ids:
try: try: