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
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'
# Python Setup

View file

@ -40,7 +40,7 @@ jobs:
- name: Get Openapi Generator
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'
# Python Setup

4
.vscode/tasks.json vendored
View file

@ -34,14 +34,14 @@
"command": [
"python3 -m venv .venv;",
".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": {
"command": [
"python -m venv .venv;",
".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:
properties:
visit_site:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsVisitSite'
required:
- visit_site
AdditionalMediaInfoCallToActionsVisitSite:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
watch_now:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
AdditionalMediaInfoCallToActionsUrl:
properties:
url:
format: uri
@ -55,9 +55,12 @@ components:
- ref
BirdwatchEntityRef:
properties:
text:
type: string
type:
enum:
- TimelineUrl
- TimelineRichTextHashtag
type: string
url:
format: uri
@ -68,8 +71,6 @@ components:
type: string
required:
- type
- url
- urlType
BirdwatchPivot:
properties:
callToAction:
@ -286,7 +287,6 @@ components:
- description
- question
- search_tags
- primary_community_topic
- actions
- admin_results
- creator_results
@ -885,6 +885,8 @@ components:
type: string
original_info:
$ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes:
$ref: '#/components/schemas/MediaSizes'
source_status_id_str:
@ -949,6 +951,8 @@ components:
type: string
original_info:
$ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes:
$ref: '#/components/schemas/MediaSizes'
source_status_id_str:
@ -1075,6 +1079,8 @@ components:
properties:
clientEventInfo:
$ref: '#/components/schemas/ClientEventInfo'
feedbackInfo:
$ref: '#/components/schemas/FeedbackInfo'
itemContent:
$ref: '#/components/schemas/ItemContentUnion'
required:
@ -1201,19 +1207,7 @@ components:
QuotedRefResult:
properties:
result:
$ref: '#/components/schemas/QuotedRefResultData'
required:
- result
QuotedRefResultData:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
rest_id:
pattern: ^[0-9]+$
type: string
required:
- __typename
- rest_id
$ref: '#/components/schemas/TweetUnion'
QuotedStatusPermalink:
properties:
display:
@ -1275,6 +1269,21 @@ components:
type: string
required:
- 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:
properties:
SsoInitTokens:
@ -1336,6 +1345,7 @@ components:
enum:
- DeepLink
- UrtEndpoint
- ExternalUrl
type: string
urtEndpointOptions:
$ref: '#/components/schemas/UrtEndpointOptions'
@ -1511,6 +1521,8 @@ components:
- Like
- Location
- Sparkle
- Conversation
- List
type: string
landingUrl:
$ref: '#/components/schemas/SocialContextLandingUrl'
@ -1856,9 +1868,6 @@ components:
$ref: '#/components/schemas/TweetView'
required:
- rest_id
- edit_control
- is_translatable
- views
TweetCard:
properties:
legacy:
@ -2153,6 +2162,7 @@ components:
- community_tweet_non_member_public_community
- non_compliant
- dynamic_product_ad
- stale_tweet
type: string
place:
additionalProperties: true
@ -2273,6 +2283,7 @@ components:
type: string
state:
enum:
- Enabled
- EnabledWithCount
type: string
required:
@ -2291,7 +2302,6 @@ components:
required:
- __typename
- tweet
- limitedActionResults
TwitterTimeFormat:
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)

View file

@ -19,10 +19,10 @@ components:
AdditionalMediaInfoCallToActions:
properties:
visit_site:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsVisitSite'
required:
- visit_site
AdditionalMediaInfoCallToActionsVisitSite:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
watch_now:
$ref: '#/components/schemas/AdditionalMediaInfoCallToActionsUrl'
AdditionalMediaInfoCallToActionsUrl:
properties:
url:
format: uri
@ -55,9 +55,12 @@ components:
- ref
BirdwatchEntityRef:
properties:
text:
type: string
type:
enum:
- TimelineUrl
- TimelineRichTextHashtag
type: string
url:
format: uri
@ -68,8 +71,6 @@ components:
type: string
required:
- type
- url
- urlType
BirdwatchPivot:
properties:
callToAction:
@ -286,7 +287,6 @@ components:
- description
- question
- search_tags
- primary_community_topic
- actions
- admin_results
- creator_results
@ -885,6 +885,8 @@ components:
type: string
original_info:
$ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes:
$ref: '#/components/schemas/MediaSizes'
source_status_id_str:
@ -949,6 +951,8 @@ components:
type: string
original_info:
$ref: '#/components/schemas/MediaOriginalInfo'
sensitive_media_warning:
$ref: '#/components/schemas/SensitiveMediaWarning'
sizes:
$ref: '#/components/schemas/MediaSizes'
source_status_id_str:
@ -1075,6 +1079,8 @@ components:
properties:
clientEventInfo:
$ref: '#/components/schemas/ClientEventInfo'
feedbackInfo:
$ref: '#/components/schemas/FeedbackInfo'
itemContent:
$ref: '#/components/schemas/ItemContentUnion'
required:
@ -1201,19 +1207,7 @@ components:
QuotedRefResult:
properties:
result:
$ref: '#/components/schemas/QuotedRefResultData'
required:
- result
QuotedRefResultData:
properties:
__typename:
$ref: '#/components/schemas/TypeName'
rest_id:
pattern: ^[0-9]+$
type: string
required:
- __typename
- rest_id
$ref: '#/components/schemas/TweetUnion'
QuotedStatusPermalink:
properties:
display:
@ -1275,6 +1269,21 @@ components:
type: string
required:
- 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:
properties:
SsoInitTokens:
@ -1336,6 +1345,7 @@ components:
enum:
- DeepLink
- UrtEndpoint
- ExternalUrl
type: string
urtEndpointOptions:
$ref: '#/components/schemas/UrtEndpointOptions'
@ -1511,6 +1521,8 @@ components:
- Like
- Location
- Sparkle
- Conversation
- List
type: string
landingUrl:
$ref: '#/components/schemas/SocialContextLandingUrl'
@ -1856,9 +1868,6 @@ components:
$ref: '#/components/schemas/TweetView'
required:
- rest_id
- edit_control
- is_translatable
- views
TweetCard:
properties:
legacy:
@ -2153,6 +2162,7 @@ components:
- community_tweet_non_member_public_community
- non_compliant
- dynamic_product_ad
- stale_tweet
type: string
place:
additionalProperties: true
@ -2273,6 +2283,7 @@ components:
type: string
state:
enum:
- Enabled
- EnabledWithCount
type: string
required:
@ -2291,7 +2302,6 @@ components:
required:
- __typename
- tweet
- limitedActionResults
TwitterTimeFormat:
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)

View file

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

View file

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

View file

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