-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating an Open Api specification #53
Open
4n70w4
wants to merge
7
commits into
xtrime-ru:master
Choose a base branch
from
4n70w4:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2d2cd6f
Creating an Open Api specification
4n70w4 828d6c2
remove wasted Sessions
4n70w4 66e169f
add variables for php codegen
4n70w4 5bb618c
add readme
4n70w4 dd0cdab
add /system/addSession endpoint
4n70w4 1a2c162
dev
4n70w4 45cf3a1
update
4n70w4 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"composerVendorName": "xtrime-ru", | ||
"composerProjectName": "TelegramPhpClient", | ||
"artifactVersion": "1.10.4", | ||
"invokerPackage": "xtrime-ru\\TelegramPhpClient", | ||
"packagePath": "TelegramPhpClient" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
## Download swagger-codegen binary | ||
|
||
```bash | ||
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.22/swagger-codegen-cli-3.0.22.jar -O swagger-codegen-cli.jar | ||
``` | ||
|
||
|
||
## Generate single open api yaml file | ||
|
||
```bash | ||
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate \ | ||
--input-spec /local/openapi.yaml --lang openapi-yaml --output /local/out/ -c /local/openapi-codegen-php.json | ||
``` | ||
|
||
## Generate PHP client library | ||
|
||
```bash | ||
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate \ | ||
--input-spec /local/openapi.yaml --lang php --output /local/out/ -c /local/openapi-codegen-php.json | ||
``` | ||
|
||
### Use custom codegenerator templates | ||
|
||
`--template-dir /local/php/` | ||
|
||
## Generate other | ||
|
||
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate \ | ||
--input-spec /local/openapi.yaml --lang dynamic-html --output /local/out/ -c /local/openapi-codegen-php.json | ||
|
||
docker run --rm -v ${PWD}:/local -w /local openjdk java -jar swagger-codegen-cli.jar generate \ | ||
--input-spec /local/openapi.yaml --lang html --output /local/out/ -c /local/openapi-codegen-php.json | ||
|
||
|
||
|
||
|
||
docker run --rm \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i /local/openapi.yaml \ | ||
-g asciidoc \ | ||
-o /local/out/asciidoc | ||
|
||
|
||
docker run --rm \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i /local/openapi.yaml \ | ||
-g dynamic-html \ | ||
-o /local/out/dynamic-html | ||
|
||
|
||
docker run --rm \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i /local/openapi.yaml \ | ||
-g html2 \ | ||
-o /local/out/html2 | ||
|
||
|
||
docker run --rm \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i /local/openapi.yaml \ | ||
-g openapi \ | ||
-o /local/out/openapi | ||
|
||
|
||
docker run --rm \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i /local/openapi.yaml \ | ||
-g openapi-yaml \ | ||
-o /local/out/openapi-yaml | ||
|
||
|
||
docker run --rm \ | ||
--network host \ | ||
-v $PWD:/local \ | ||
openapitools/openapi-generator-cli \ | ||
generate \ | ||
-i https://docs.api2.dev.hoqu.com/docs/api.yml \ | ||
-g openapi-yaml \ | ||
-o /local/out/hoq0-openapi-yaml | ||
|
||
|
||
Swagger-Codegen/1.10.4/php | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
openapi: 3.0.1 | ||
|
||
info: | ||
title: Telegram Api Server | ||
description: 'Fast, simple, async php telegram api server: MadelineProto + Amp HTTP | ||
Server' | ||
license: | ||
name: MIT License | ||
url: https://github.com/xtrime-ru/TelegramApiServer/blob/master/LICENSE | ||
version: 1.10.4 | ||
|
||
externalDocs: | ||
description: Async PHP client/server API for the telegram MTProto protocol | ||
url: https://github.com/danog/MadelineProto | ||
|
||
servers: | ||
- url: https://example.com/ | ||
- url: http://example.com/ | ||
|
||
#security: | ||
#- basicAuth: [] | ||
|
||
tags: | ||
- name: system | ||
description: Different settings for sessions | ||
externalDocs: | ||
description: Find out more | ||
url: https://github.com/xtrime-ru/TelegramApiServer#different-settings-for-sessions | ||
|
||
- name: api | ||
description: All methods from MadelineProto supported | ||
externalDocs: | ||
description: Methods List | ||
url: https://docs.madelineproto.xyz/API_docs/methods/ | ||
|
||
- name: login | ||
description: Login methods from MadelineProto | ||
externalDocs: | ||
description: Methods List | ||
url: https://docs.madelineproto.xyz/API_docs/methods/ | ||
|
||
paths: | ||
/system/getSessionList: | ||
$ref: './openapi/paths/system/getSessionList.yaml' | ||
|
||
/system/addSession: | ||
$ref: './openapi/paths/system/addSession.yaml' | ||
|
||
/api/{session}/phoneLogin: | ||
$ref: './openapi/paths/api/phoneLogin.yaml' | ||
|
||
/api/{session}/completePhoneLogin: | ||
$ref: './openapi/paths/api/completePhoneLogin.yaml' | ||
|
||
/api/{session}/completeSignup: | ||
$ref: './openapi/paths/api/completeSignup.yaml' | ||
|
||
|
||
|
||
# securitySchemes: | ||
# basicAuth: | ||
# type: http | ||
# scheme: basic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: object | ||
properties: | ||
_: | ||
type: string | ||
default: "account.needSignup" | ||
terms_of_service: | ||
$ref: '../api/TermsOfService.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: object | ||
properties: | ||
_: | ||
type: string | ||
default: "auth.authorization" | ||
user: | ||
$ref: '../api/User.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
type: object | ||
properties: | ||
_: | ||
type: string | ||
default: "auth.sentCode" | ||
type: | ||
$ref: '../api/SentCodeTypeSms.yaml' | ||
phone_code_hash: | ||
type: string | ||
example: "3aae168ea0609da27f" | ||
next_type: | ||
$ref: '../api/CodeTypeCall.yaml' | ||
timeout: | ||
type: integer | ||
example: 120 | ||
phone_number: | ||
type: string | ||
example: "+79636025112" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
properties: | ||
_: | ||
type: string | ||
default: "auth.codeTypeCall" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
properties: | ||
_: | ||
type: string | ||
default: "auth.sentCodeTypeSms" | ||
length: | ||
type: integer | ||
example: 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type: object | ||
properties: | ||
_: | ||
type: string | ||
default: "help.termsOfService" | ||
popup: | ||
type: boolean | ||
default: false | ||
id: | ||
$ref: '../api/TermsOfServiceId.yaml' | ||
text: | ||
type: string | ||
default: "By signing up for Telegram, you agree not to:\n\n- Use our service to send spam or scam users.\n- Promote violence on publicly viewable Telegram bots, groups or channels.\n- Post pornographic content on publicly viewable Telegram bots, groups or channels.\n\nWe reserve the right to update these Terms of Service later." | ||
entities: | ||
type: array | ||
items: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
properties: | ||
country: | ||
type: string | ||
example: "RU" | ||
min_age: | ||
type: boolean | ||
default: false | ||
terms_key: | ||
type: string | ||
example: "TERMS_OF_SERVICE" | ||
terms_lang: | ||
type: string | ||
example: "en" | ||
terms_version: | ||
type: integer | ||
default: 1 | ||
terms_hash: | ||
type: string | ||
default: "7dca806cb8d387c07c778ce9ef6aac04" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
properties: | ||
_: | ||
type: string | ||
default: "user" | ||
self: | ||
type: boolean | ||
contact: | ||
type: boolean | ||
mutual_contact: | ||
type: boolean | ||
deleted: | ||
type: boolean | ||
bot: | ||
type: boolean | ||
bot_chat_history: | ||
type: boolean | ||
bot_nochats: | ||
type: boolean | ||
verified: | ||
type: boolean | ||
restricted: | ||
type: boolean | ||
min: | ||
type: boolean | ||
bot_inline_geo: | ||
type: boolean | ||
support: | ||
type: boolean | ||
scam: | ||
type: boolean | ||
id: | ||
type: integer | ||
access_hash: | ||
type: integer | ||
example: 4963221948965825237 | ||
first_name: | ||
type: string | ||
phone: | ||
type: string | ||
example: "79636025112" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
type: object | ||
properties: | ||
file: | ||
type: string | ||
line: | ||
type: integer | ||
function: | ||
type: string | ||
class: | ||
type: string | ||
type: | ||
type: string | ||
args: | ||
type: array | ||
items: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type: array | ||
items: | ||
$ref: '../models/Backtrace.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type: object | ||
properties: | ||
exception: | ||
type: string | ||
message: | ||
type: string | ||
file: | ||
type: string | ||
line: | ||
type: integer | ||
code: | ||
type: integer | ||
backtrace: | ||
type: array | ||
items: | ||
$ref: '../common/Backtrace.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
properties: | ||
app_id: | ||
type: integer | ||
description: App api_id | ||
app_hash: | ||
type: string | ||
description: App api_hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
properties: | ||
session: | ||
type: string | ||
file: | ||
type: string | ||
status: | ||
type: string | ||
enum: | ||
- NOT_LOGGED_IN | ||
- WAITING_CODE | ||
- WAITING_PASSWORD | ||
- WAITING_SIGNUP | ||
- LOGGED_IN | ||
- LOADING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
properties: | ||
sessions: | ||
type: object | ||
additionalProperties: | ||
$ref: '../system/Session.yaml' | ||
memory: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
type: object | ||
properties: | ||
app_info: | ||
$ref: '../system/AppInfo.yaml' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
in: path | ||
name: session | ||
schema: | ||
type: string | ||
required: true | ||
description: Session name |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thinks you 10060213