mirror of
https://github.com/thegeneralist01/twitter-openapi
synced 2026-01-11 15:40:26 +01:00
commit
02aaf02751
10 changed files with 94 additions and 32 deletions
3
.vscode/launch.json
vendored
3
.vscode/launch.json
vendored
|
|
@ -28,7 +28,8 @@
|
||||||
"env": {
|
"env": {
|
||||||
"ERROR_UNCATCHED": "True",
|
"ERROR_UNCATCHED": "True",
|
||||||
"STRICT_MODE": "True",
|
"STRICT_MODE": "True",
|
||||||
"MULTI_THREAD": "True"
|
"MULTI_THREAD": "True",
|
||||||
|
"CUESOR_TEST_COUNT": "3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
|
|
@ -9,7 +9,6 @@
|
||||||
"source .venv/bin/activate;",
|
"source .venv/bin/activate;",
|
||||||
"python3 tools/build.py;",
|
"python3 tools/build.py;",
|
||||||
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
|
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
|
||||||
"python3 test/python/replace.py;",
|
|
||||||
"python3 -m pip install ./python_generated;"
|
"python3 -m pip install ./python_generated;"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -19,7 +18,6 @@
|
||||||
"python tools/build.py;",
|
"python tools/build.py;",
|
||||||
"scoop reset temurin11-jdk;",
|
"scoop reset temurin11-jdk;",
|
||||||
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
|
"java -jar openapi-generator-cli.jar generate -c test/python/openapi-generator-config.yaml -g python;",
|
||||||
"python test/python/replace.py;",
|
|
||||||
"python -m pip install ./python_generated;"
|
"python -m pip install ./python_generated;"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
23
dist/compatible/openapi-3.0.yaml
vendored
23
dist/compatible/openapi-3.0.yaml
vendored
|
|
@ -564,6 +564,10 @@ components:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Symbol'
|
$ref: '#/components/schemas/Symbol'
|
||||||
type: array
|
type: array
|
||||||
|
timestamps:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Timestamp'
|
||||||
|
type: array
|
||||||
urls:
|
urls:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Url'
|
$ref: '#/components/schemas/Url'
|
||||||
|
|
@ -1793,6 +1797,20 @@ components:
|
||||||
$ref: '#/components/schemas/Timeline'
|
$ref: '#/components/schemas/Timeline'
|
||||||
required:
|
required:
|
||||||
- timeline
|
- timeline
|
||||||
|
Timestamp:
|
||||||
|
properties:
|
||||||
|
indices:
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
type: array
|
||||||
|
seconds:
|
||||||
|
type: integer
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- indices
|
||||||
|
- seconds
|
||||||
|
- text
|
||||||
TopicContext:
|
TopicContext:
|
||||||
properties:
|
properties:
|
||||||
description:
|
description:
|
||||||
|
|
@ -2159,10 +2177,11 @@ components:
|
||||||
limited_actions:
|
limited_actions:
|
||||||
enum:
|
enum:
|
||||||
- limited_replies
|
- limited_replies
|
||||||
- community_tweet_non_member_public_community
|
|
||||||
- non_compliant
|
- non_compliant
|
||||||
- dynamic_product_ad
|
- dynamic_product_ad
|
||||||
- stale_tweet
|
- stale_tweet
|
||||||
|
- community_tweet_non_member_public_community
|
||||||
|
- community_tweet_non_member_closed_community
|
||||||
type: string
|
type: string
|
||||||
place:
|
place:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
|
|
@ -2790,6 +2809,8 @@ components:
|
||||||
properties:
|
properties:
|
||||||
__typename:
|
__typename:
|
||||||
$ref: '#/components/schemas/TypeName'
|
$ref: '#/components/schemas/TypeName'
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
reason:
|
reason:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
|
|
||||||
23
dist/compatible_discriminator/openapi-3.0.yaml
vendored
23
dist/compatible_discriminator/openapi-3.0.yaml
vendored
|
|
@ -564,6 +564,10 @@ components:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Symbol'
|
$ref: '#/components/schemas/Symbol'
|
||||||
type: array
|
type: array
|
||||||
|
timestamps:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Timestamp'
|
||||||
|
type: array
|
||||||
urls:
|
urls:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Url'
|
$ref: '#/components/schemas/Url'
|
||||||
|
|
@ -1793,6 +1797,20 @@ components:
|
||||||
$ref: '#/components/schemas/Timeline'
|
$ref: '#/components/schemas/Timeline'
|
||||||
required:
|
required:
|
||||||
- timeline
|
- timeline
|
||||||
|
Timestamp:
|
||||||
|
properties:
|
||||||
|
indices:
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
type: array
|
||||||
|
seconds:
|
||||||
|
type: integer
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- indices
|
||||||
|
- seconds
|
||||||
|
- text
|
||||||
TopicContext:
|
TopicContext:
|
||||||
properties:
|
properties:
|
||||||
description:
|
description:
|
||||||
|
|
@ -2159,10 +2177,11 @@ components:
|
||||||
limited_actions:
|
limited_actions:
|
||||||
enum:
|
enum:
|
||||||
- limited_replies
|
- limited_replies
|
||||||
- community_tweet_non_member_public_community
|
|
||||||
- non_compliant
|
- non_compliant
|
||||||
- dynamic_product_ad
|
- dynamic_product_ad
|
||||||
- stale_tweet
|
- stale_tweet
|
||||||
|
- community_tweet_non_member_public_community
|
||||||
|
- community_tweet_non_member_closed_community
|
||||||
type: string
|
type: string
|
||||||
place:
|
place:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
|
|
@ -2790,6 +2809,8 @@ components:
|
||||||
properties:
|
properties:
|
||||||
__typename:
|
__typename:
|
||||||
$ref: '#/components/schemas/TypeName'
|
$ref: '#/components/schemas/TypeName'
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
reason:
|
reason:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
|
|
||||||
23
dist/docs/openapi-3.0.yaml
vendored
23
dist/docs/openapi-3.0.yaml
vendored
|
|
@ -564,6 +564,10 @@ components:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Symbol'
|
$ref: '#/components/schemas/Symbol'
|
||||||
type: array
|
type: array
|
||||||
|
timestamps:
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/Timestamp'
|
||||||
|
type: array
|
||||||
urls:
|
urls:
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/Url'
|
$ref: '#/components/schemas/Url'
|
||||||
|
|
@ -1793,6 +1797,20 @@ components:
|
||||||
$ref: '#/components/schemas/Timeline'
|
$ref: '#/components/schemas/Timeline'
|
||||||
required:
|
required:
|
||||||
- timeline
|
- timeline
|
||||||
|
Timestamp:
|
||||||
|
properties:
|
||||||
|
indices:
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
type: array
|
||||||
|
seconds:
|
||||||
|
type: integer
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- indices
|
||||||
|
- seconds
|
||||||
|
- text
|
||||||
TopicContext:
|
TopicContext:
|
||||||
properties:
|
properties:
|
||||||
description:
|
description:
|
||||||
|
|
@ -2159,10 +2177,11 @@ components:
|
||||||
limited_actions:
|
limited_actions:
|
||||||
enum:
|
enum:
|
||||||
- limited_replies
|
- limited_replies
|
||||||
- community_tweet_non_member_public_community
|
|
||||||
- non_compliant
|
- non_compliant
|
||||||
- dynamic_product_ad
|
- dynamic_product_ad
|
||||||
- stale_tweet
|
- stale_tweet
|
||||||
|
- community_tweet_non_member_public_community
|
||||||
|
- community_tweet_non_member_closed_community
|
||||||
type: string
|
type: string
|
||||||
place:
|
place:
|
||||||
additionalProperties: true
|
additionalProperties: true
|
||||||
|
|
@ -2790,6 +2809,8 @@ components:
|
||||||
properties:
|
properties:
|
||||||
__typename:
|
__typename:
|
||||||
$ref: '#/components/schemas/TypeName'
|
$ref: '#/components/schemas/TypeName'
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
reason:
|
reason:
|
||||||
type: string
|
type: string
|
||||||
required:
|
required:
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,6 @@ components:
|
||||||
$ref: "#/components/schemas/BirdwatchEntity"
|
$ref: "#/components/schemas/BirdwatchEntity"
|
||||||
|
|
||||||
BirdwatchPivotCallToAction:
|
BirdwatchPivotCallToAction:
|
||||||
# {'prompt': 'Do you find this helpful?', 'title': 'Rate it', 'destinationUrl': 'https://twitter.com/i/birdwatch/n/1710821689636934115'}
|
|
||||||
required:
|
required:
|
||||||
- "prompt"
|
- "prompt"
|
||||||
- "title"
|
- "title"
|
||||||
|
|
@ -906,10 +905,11 @@ components:
|
||||||
type: string
|
type: string
|
||||||
enum:
|
enum:
|
||||||
- "limited_replies"
|
- "limited_replies"
|
||||||
- "community_tweet_non_member_public_community"
|
|
||||||
- "non_compliant"
|
- "non_compliant"
|
||||||
- "dynamic_product_ad"
|
- "dynamic_product_ad"
|
||||||
- "stale_tweet"
|
- "stale_tweet"
|
||||||
|
- "community_tweet_non_member_public_community"
|
||||||
|
- "community_tweet_non_member_closed_community"
|
||||||
place:
|
place:
|
||||||
additionalProperties: true # todo
|
additionalProperties: true # todo
|
||||||
|
|
||||||
|
|
@ -927,6 +927,7 @@ components:
|
||||||
- "symbols"
|
- "symbols"
|
||||||
- "user_mentions"
|
- "user_mentions"
|
||||||
- "urls"
|
- "urls"
|
||||||
|
- "timestamps"
|
||||||
properties:
|
properties:
|
||||||
hashtags:
|
hashtags:
|
||||||
type: array
|
type: array
|
||||||
|
|
@ -948,6 +949,10 @@ components:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/components/schemas/Media"
|
$ref: "#/components/schemas/Media"
|
||||||
|
timestamps:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/components/schemas/Timestamp"
|
||||||
|
|
||||||
Hashtag:
|
Hashtag:
|
||||||
type: object
|
type: object
|
||||||
|
|
@ -1293,3 +1298,18 @@ components:
|
||||||
resize:
|
resize:
|
||||||
type: string
|
type: string
|
||||||
enum: [crop, fit]
|
enum: [crop, fit]
|
||||||
|
|
||||||
|
Timestamp:
|
||||||
|
required:
|
||||||
|
- "indices"
|
||||||
|
- "seconds"
|
||||||
|
- "text"
|
||||||
|
properties:
|
||||||
|
indices:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
seconds:
|
||||||
|
type: integer
|
||||||
|
text:
|
||||||
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -356,3 +356,5 @@ components:
|
||||||
$ref: "./typename.yaml#/components/schemas/TypeName" # UserUnavailable
|
$ref: "./typename.yaml#/components/schemas/TypeName" # UserUnavailable
|
||||||
reason:
|
reason:
|
||||||
type: string
|
type: string
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
inputSpec: dist/compatible/openapi-3.0.yaml
|
inputSpec: dist/compatible_discriminator/openapi-3.0.yaml
|
||||||
outputDir: python_generated
|
outputDir: python_generated
|
||||||
|
|
||||||
useOneOfDiscriminatorLookup: true
|
useOneOfDiscriminatorLookup: true
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import glob
|
|
||||||
|
|
||||||
for file in glob.glob("python_generated/openapi_client/models/*.py"):
|
|
||||||
with open(file, "r") as f:
|
|
||||||
text = f.read()
|
|
||||||
|
|
||||||
indent = " "
|
|
||||||
|
|
||||||
text = text.replace(
|
|
||||||
f"{indent}{indent}try:",
|
|
||||||
f"{indent}{indent}if match == 0:",
|
|
||||||
)
|
|
||||||
text = text.replace(
|
|
||||||
f"{indent}{indent}except (ValidationError, ValueError) as e:",
|
|
||||||
f"{indent}{indent}else:",
|
|
||||||
)
|
|
||||||
text = text.replace(
|
|
||||||
f"{indent}{indent}{indent}error_messages.append(str(e))",
|
|
||||||
f"{indent}{indent}{indent}pass",
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(file, "w") as f:
|
|
||||||
f.write(text)
|
|
||||||
|
|
@ -326,6 +326,7 @@ if __name__ == "__main__":
|
||||||
"1697450269259522256",
|
"1697450269259522256",
|
||||||
"1697450278742884799",
|
"1697450278742884799",
|
||||||
"1749500209061663043",
|
"1749500209061663043",
|
||||||
|
"1759056048764469303",
|
||||||
]
|
]
|
||||||
for id in ids:
|
for id in ids:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue