1
Fork 0
mirror of https://github.com/thegeneralist01/twitter-openapi synced 2026-01-11 23:50:26 +01:00
Signed-off-by: ふぁ <yuki@yuki0311.com>
This commit is contained in:
ふぁ 2023-04-27 20:18:39 +09:00
parent a69d2fa7d8
commit 5eedd4146d
No known key found for this signature in database
GPG key ID: 83A8A5E74872A8AA
6 changed files with 283 additions and 163 deletions

View file

@ -6,18 +6,6 @@ paths:
/parameters: /parameters:
get: get:
parameters: parameters:
- name: variables
in: query
required: true
schema:
type: string
example: "{{Variables}}"
- name: features
in: query
required: true
schema:
type: string
example: "{{Features}}"
- name: queryId - name: queryId
in: query in: query
required: true required: true
@ -26,6 +14,45 @@ paths:
default: "{{Query}}" default: "{{Query}}"
example: "{{Query}}" example: "{{Query}}"
# {% if get_parameters == string %}
- name: variables
in: query
required: true
schema:
type: string
default: "{{Variables}}"
example: "{{Variables}}"
- name: features
in: query
required: true
schema:
type: string
default: "{{Features}}"
example: "{{Features}}"
# {% endif %}
# {% if get_parameters == object %}
- name: variables
in: query
required: true
schema:
type: object
- name: features
in: query
required: true
schema:
type: object
- name: queryId
in: query
required: true
schema:
type: object
# {% endif %}
# {% if header == parameters %} # {% if header == parameters %}
- name: authorization - name: authorization
@ -58,62 +85,71 @@ paths:
description: "UserAgent, some APIs may be rejected if changed." description: "UserAgent, some APIs may be rejected if changed."
# {% endif %} # {% endif %}
responses:
post: "200":
parameters: description: ""
- name: variables
in: query post:
required: true # {% if header == parameters %}
schema:
type: object parameters:
example: "{{Variables}}" - name: authorization
- name: features in: header
in: query required: true
required: true schema:
schema: type: string
type: object default: "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA"
example: "{{Features}}" description: "It is a constant value and does not need to be changed."
- name: queryId - name: x-twitter-active-user
in: query in: header
required: true required: true
schema: schema:
type: string type: string
default: "{{Query}}" default: "yes"
example: "{{Query}}" description: "Unknown what this value means."
- name: x-twitter-client-language
# {% if header == parameters %} in: header
required: true
- name: authorization schema:
in: header type: string
required: true default: "en"
schema: description: "language code."
type: string - name: user-agent
default: "Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA" in: header
description: "It is a constant value and does not need to be changed." required: true
- name: x-twitter-active-user schema:
in: header type: string
required: true default: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36"
schema: description: "UserAgent, some APIs may be rejected if changed."
type: string
default: "yes" # {% endif %}
description: "Unknown what this value means."
- name: x-twitter-client-language # {% if post_parameters == object %}
in: header
required: true requestBody:
schema: required: true
type: string content:
default: "en" application/json:
description: "language code." schema:
- name: user-agent required:
in: header - "queryId"
required: true - "variables"
schema: - "features"
type: string properties:
default: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36" queryId:
description: "UserAgent, some APIs may be rejected if changed." type: string
default: "{{Query}}"
# {% endif %} example: "{{Query}}"
variables:
type: object
# default: "{{Variables}}"
example: "{{Variables}}"
features:
type: object
# default: "{{Features}}"
example: "{{Features}}"
# {% endif %}
responses: responses:
"200": "200":
description: "" description: ""

View file

@ -364,29 +364,25 @@
"Query": "lI07N6Otwv1PhnEgXILM7A", "Query": "lI07N6Otwv1PhnEgXILM7A",
"Variables": { "Variables": {
"tweet_id": "1349129669258448897" "tweet_id": "1349129669258448897"
}, }
"Features": {}
}, },
"UnfavoriteTweet": { "UnfavoriteTweet": {
"Query": "ZYKSe-w7KEslx3JhSIk5LA", "Query": "ZYKSe-w7KEslx3JhSIk5LA",
"Variables": { "Variables": {
"tweet_id": "1349129669258448897" "tweet_id": "1349129669258448897"
}, }
"Features": {}
}, },
"CreateRetweet": { "CreateRetweet": {
"Query": "ojPdsZsimiJrUGLR1sjUtA", "Query": "ojPdsZsimiJrUGLR1sjUtA",
"Variables": { "Variables": {
"tweet_id": "1349129669258448897" "tweet_id": "1349129669258448897"
}, }
"Features": {}
}, },
"DeleteRetweet": { "DeleteRetweet": {
"Query": "iQtK4dl5hBmXewYZuEOKVw", "Query": "iQtK4dl5hBmXewYZuEOKVw",
"Variables": { "Variables": {
"tweet_id": "1349129669258448897" "tweet_id": "1349129669258448897"
}, }
"Features": {}
}, },
"CreateTweet": { "CreateTweet": {
"Query": "1RyAhNwby-gzGCRVsMxKbQ", "Query": "1RyAhNwby-gzGCRVsMxKbQ",
@ -396,7 +392,8 @@
"media_entities": [], "media_entities": [],
"possibly_sensitive": false "possibly_sensitive": false
}, },
"semantic_annotation_ids": [] "semantic_annotation_ids": [],
"dark_request": false
}, },
"Features": { "Features": {
"tweetypie_unmention_optimization_enabled": true, "tweetypie_unmention_optimization_enabled": true,
@ -424,8 +421,7 @@
"Query": "VaenaVgh5q5ih7kvyVjgtg", "Query": "VaenaVgh5q5ih7kvyVjgtg",
"Variables": { "Variables": {
"tweet_id": "1349129669258448897" "tweet_id": "1349129669258448897"
}, }
"Features": {}
}, },
"Template": { "Template": {
"Query": "", "Query": "",

View file

@ -1,8 +1,17 @@
{ {
"dart": { "dart": {
"header": "parameters" "header": "parameters",
"get_parameters": "string",
"post_parameters": "object"
}, },
"typescript": { "typescript": {
"header": "securitySchemes" "header": "securitySchemes",
"get_parameters": "string",
"post_parameters": "object"
},
"test": {
"header": "securitySchemes",
"get_parameters": "string",
"post_parameters": "string"
} }
} }

View file

@ -6,7 +6,7 @@ info:
paths: paths:
/{{FavoriteTweetQuery}}/FavoriteTweet: /{{FavoriteTweetQuery}}/FavoriteTweet:
post: post:
operationId: favoriteTweet operationId: postFavoriteTweet
description: favorite Tweet description: favorite Tweet
responses: responses:
"200": "200":
@ -20,7 +20,7 @@ paths:
/{{UnfavoriteTweetQuery}}/UnfavoriteTweet: /{{UnfavoriteTweetQuery}}/UnfavoriteTweet:
post: post:
operationId: unfavoriteTweet operationId: postUnfavoriteTweet
description: unfavorite Tweet description: unfavorite Tweet
responses: responses:
"200": "200":
@ -34,7 +34,7 @@ paths:
/{{CreateRetweetQuery}}/CreateRetweet: /{{CreateRetweetQuery}}/CreateRetweet:
post: post:
operationId: createRetweet operationId: postCreateRetweet
description: create Retweet description: create Retweet
responses: responses:
"200": "200":
@ -48,7 +48,7 @@ paths:
/{{DeleteRetweetQuery}}/DeleteRetweet: /{{DeleteRetweetQuery}}/DeleteRetweet:
post: post:
operationId: deleteRetweet operationId: postDeleteRetweet
description: delete Retweet description: delete Retweet
responses: responses:
"200": "200":
@ -62,7 +62,7 @@ paths:
/{{CreateTweetQuery}}/CreateTweet: /{{CreateTweetQuery}}/CreateTweet:
post: post:
operationId: createTweet operationId: postCreateTweet
description: create Tweet description: create Tweet
responses: responses:
"200": "200":
@ -76,7 +76,7 @@ paths:
/{{DeleteTweetQuery}}/DeleteTweet: /{{DeleteTweetQuery}}/DeleteTweet:
post: post:
operationId: deleteTweet operationId: postDeleteTweet
description: delete Retweet description: delete Retweet
responses: responses:
"200": "200":
@ -95,14 +95,28 @@ components:
- "data" - "data"
properties: properties:
data: data:
$ref: "./../schemas/post.yaml#/components/schemas/FavoriteTweet" $ref: "#/components/schemas/FavoriteTweet"
FavoriteTweet:
required:
- "favorite_tweet"
properties:
favorite_tweet:
type: string
UnfavoriteTweetResponseData: UnfavoriteTweetResponseData:
required: required:
- "data" - "data"
properties: properties:
data: data:
$ref: "./../schemas/post.yaml#/components/schemas/UnfavoriteTweet" $ref: "#/components/schemas/UnfavoriteTweet"
UnfavoriteTweet:
required:
- "unfavorite_tweet"
properties:
unfavorite_tweet:
type: string
# ---Retweet--- # ---Retweet---
@ -125,7 +139,30 @@ components:
- "retweet_results" - "retweet_results"
properties: properties:
retweet_results: retweet_results:
$ref: "./../schemas/post.yaml#/components/schemas/CreateRetweet" $ref: "#/components/schemas/CreateRetweet"
CreateRetweet:
required:
- "result"
properties:
result:
type: object
items:
$ref: "#/components/schemas/Retweet"
Retweet:
required:
- "rest_id"
- "legacy"
properties:
rest_id:
type: string
legacy:
type: object
items:
properties:
full_text:
type: string
DeleteRetweetResponse: DeleteRetweetResponse:
required: required:
@ -146,7 +183,16 @@ components:
- "source_tweet_results" - "source_tweet_results"
properties: properties:
retweet_results: retweet_results:
$ref: "./../schemas/post.yaml#/components/schemas/DeleteRetweet" $ref: "#/components/schemas/DeleteRetweet"
DeleteRetweet:
required:
- "result"
properties:
result:
type: object
items:
$ref: "#/components/schemas/Retweet"
# ---Tweet--- # ---Tweet---
@ -169,7 +215,14 @@ components:
- "tweet_results" - "tweet_results"
properties: properties:
tweet_results: tweet_results:
$ref: "./../schemas/post.yaml#/components/schemas/CreateTweet" $ref: "#/components/schemas/CreateTweet"
CreateTweet:
required:
- "result"
properties:
result:
$ref: "./../schemas/tweet.yaml#/components/schemas/Tweet"
DeleteTweetResponse: DeleteTweetResponse:
required: required:

View file

@ -0,0 +1,97 @@
openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
schemas:
ErrorResponse:
type: object
required:
- errors
- data
properties:
errors:
$ref: "#/components/schemas/Errors"
Errors:
type: array
items:
$ref: "#/components/schemas/Error"
Error:
type: object
required:
- message
- locations
- path
- extensions
- code
- kind
- name
- source
- tracing
properties:
message:
type: string
locations:
type: array
items:
$ref: "#/components/schemas/Location"
path:
type: array
items:
type: string
extensions:
$ref: "#/components/schemas/Extensions"
code:
type: integer
kind:
type: string
name:
type: string
source:
type: string
tracing:
$ref: "#/components/schemas/Tracing"
Location:
type: object
required:
- line
- column
properties:
line:
type: integer
column:
type: integer
Extensions:
type: object
required:
- name
- source
- code
- kind
- tracing
properties:
name:
type: string
source:
type: string
code:
type: integer
kind:
type: string
tracing:
$ref: "#/components/schemas/Tracing"
Tracing:
type: object
required:
- trace_id
properties:
trace_id:
type: string

View file

@ -1,71 +0,0 @@
openapi: 3.0.3
info:
title: Twitter OpenAPI
version: 0.0.1
paths: {}
components:
schemas:
FavoriteTweet:
required:
- "favorite_tweet"
properties:
favorite_tweet:
type: string
UnfavoriteTweet:
required:
- "unfavorite_tweet"
properties:
unfavorite_tweet:
type: string
# ---Retweet---
CreateRetweet:
required:
- "result"
properties:
result:
type: object
items:
$ref: "#/components/schemas/Retweet"
DeleteRetweet:
required:
- "result"
properties:
result:
type: object
items:
$ref: "#/components/schemas/Retweet"
Retweet:
required:
- "rest_id"
- "legacy"
properties:
rest_id:
type: string
legacy:
type: object
items:
properties:
full_text:
type: string
# ---Tweet---
CreateTweet:
required:
- "result"
properties:
result:
type: object
items:
$ref: "./tweet.yaml#/components/schemas/Tweet"
DeleteTweet:
properties:
result:
type: object