Skip to content
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

feat: Telegram api #434

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,44 @@ const docTemplate = `{
]
}
},
"/data/telegram/channel/{username}/messages": {
"get": {
"description": "Retrieves messages from a specified Telegram channel.",
"tags": ["Telegram"],
"summary": "Get Telegram Channel Messages",
"parameters": [
{
"name": "username",
"in": "path",
"description": "Telegram Username",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "Successfully retrieved messages",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Message"
}
}
},
"400": {
"description": "Invalid username or error fetching messages",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
},
"security": [
{
"Bearer": []
}
]
}
},
"/data/web": {
"post": {
"description": "Retrieves data from the web",
Expand Down Expand Up @@ -848,6 +886,45 @@ const docTemplate = `{
}
}
},
"/sentiment/telegram": {
"post": {
"description": "Searches for Telegram messages and analyzes their sentiment",
"tags": ["Sentiment"],
"summary": "Analyze Sentiment of Telegram Messages",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "query",
"in": "body",
"description": "Search Query",
"required": true,
"schema": {
"type": "object",
"properties": {
"query": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Successfully analyzed sentiment of Telegram messages",
"schema": {
"$ref": "#/definitions/SentimentAnalysisResponse"
}
},
"400": {
"description": "Error analyzing sentiment of Telegram messages",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/sentiment/discord": {
"post": {
"description": "Searches for Discord messages and analyzes their sentiment",
Expand Down Expand Up @@ -932,6 +1009,115 @@ const docTemplate = `{
}
}
},
"/auth/telegram/start": {
"post": {
"description": "Initiates the authentication process with Telegram by sending a code to the provided phone number.",
"tags": ["Authentication"],
"summary": "Start Telegram Authentication",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "phone_number",
"in": "body",
"description": "Phone Number",
"required": true,
"schema": {
"type": "object",
"properties": {
"phone_number": {
"type": "string"
}
}
}
}
],
"responses": {
"200": {
"description": "Successfully sent authentication code",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Failed to initialize Telegram client or to start authentication",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/auth/telegram/complete": {
"post": {
"description": "Completes the authentication process with Telegram using the code sent to the phone number.",
"tags": ["Authentication"],
"summary": "Complete Telegram Authentication",
"consumes": ["application/json"],
"produces": ["application/json"],
"parameters": [
{
"name": "phone_number",
"in": "body",
"description": "Phone Number",
"required": true,
"schema": {
"type": "object",
"properties": {
"phone_number": {
"type": "string"
},
"code": {
"type": "string"
},
"phone_code_hash": {
"type": "string"
}
},
"required": ["phone_number", "code", "phone_code_hash"]
}
}
],
"responses": {
"200": {
"description": "Successfully authenticated",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"401": {
"description": "Two-factor authentication is required",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
},
"500": {
"description": "Failed to initialize Telegram client or to complete authentication",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/sentiment/web": {
"post": {
"description": "Searches for web content and analyzes its sentiment",
Expand Down
Loading
Loading