Discord (Independent Publisher) (#996)

* Init Discord Connector

* Added connector details

* Added Michael's company name
This commit is contained in:
Daniel Laskewitz 2021-09-02 02:46:44 +02:00 коммит произвёл GitHub
Родитель d1e611cbde
Коммит cb1df7fbbe
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 467 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,395 @@
{
"swagger": "2.0",
"info": {
"title": "Discord",
"description": "Discord is a voice, video and text communication service used by over a hundred million people to hang out and talk with their friends and communities.",
"version": "1.0",
"contact": {
"name": "Daniel Laskewitz | Sogeti",
"url": "https://youtube.com/daniellaskewitz",
"email": "connectorsupport@laskewitz.io"
}
},
"x-ms-connector-metadata": [
{
"propertyName": "Website",
"propertyValue": "https://discord.com"
},
{
"propertyName": "Privacy policy",
"propertyValue": "https://discord.com/privacy"
},
{
"propertyName": "Categories",
"propertyValue": "Lifestyle and Entertainment;Social Media"
}
],
"host": "discord.com",
"basePath": "/api",
"schemes": ["https"],
"consumes": [],
"produces": [],
"paths": {
"/v9/users/@me": {
"get": {
"responses": {
"200": {
"description": "default",
"schema": {
"$ref": "#/definitions/User"
}
}
},
"summary": "Get Current User",
"description": "Returns the user object of the requestors account.",
"operationId": "GetCurrentUser",
"parameters": []
}
},
"/v9/users/@me/connections": {
"get": {
"responses": {
"200": {
"description": "default",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Connection"
}
}
}
},
"summary": "Get User Connections",
"description": "Returns a list of connection objects.",
"operationId": "GetUserConnections",
"parameters": []
}
},
"/v9/users/@me/guilds": {
"get": {
"responses": {
"200": {
"description": "default",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Guild"
}
}
}
},
"parameters": [],
"summary": "Get Current User Guilds",
"description": "Returns a list of partial guild objects the current user is a member of.",
"operationId": "GetCurrentUserGuilds"
}
},
"/v9/webhooks/{webhook.id}/{webhook.token}": {
"post": {
"consumes": ["application/json"],
"responses": {
"200": {
"description": "default",
"schema": {
"$ref": "#/definitions/Webhook"
}
}
},
"summary": "Execute Webhook",
"description": "This request executes a webhook by using a webhook id and token.",
"operationId": "ExecuteWebhook",
"parameters": [
{
"$ref": "#/parameters/WebhookID"
},
{
"$ref": "#/parameters/WebhookToken"
},
{
"name": "content-type",
"in": "header",
"required": false,
"type": "string",
"default": "application/json",
"enum": ["application/json", "multipart/form-data"],
"x-ms-summary": "Content-Type",
"description": "The content type of the request."
},
{
"name": "body",
"in": "body",
"required": false,
"schema": {
"type": "object",
"properties": {
"content": {
"type": "string",
"x-ms-summary": "Content",
"description": "The message contents (up to 2000 characters)."
},
"username": {
"type": "string",
"x-ms-summary": "Username",
"description": "Override the default username of the webhook."
},
"avatar-url": {
"type": "string",
"x-ms-summary": "Avatar URL",
"description": "Override the default avatar of the webhook."
}
}
}
}
]
}
}
},
"definitions": {
"Channel": {},
"Connection": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "type"
},
"id": {
"type": "string",
"description": "id"
},
"name": {
"type": "string",
"description": "name"
},
"visibility": {
"type": "integer",
"format": "int32",
"description": "visibility"
},
"friend_sync": {
"type": "boolean",
"description": "friend_sync"
},
"show_activity": {
"type": "boolean",
"description": "show_activity"
},
"verified": {
"type": "boolean",
"description": "verified"
}
}
},
"Guild": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "id"
},
"name": {
"type": "string",
"description": "name"
},
"icon": {
"type": "string",
"description": "icon"
},
"owner": {
"type": "boolean",
"description": "owner"
},
"permissions": {
"type": "string",
"description": "permissions"
},
"features": {
"type": "array",
"items": {
"type": "string"
},
"description": "features"
}
}
},
"User": {
"type": "object",
"properties": {
"id": {
"type": "string",
"x-ms-summary": "ID",
"description": "The user's id."
},
"username": {
"type": "string",
"x-ms-summary": "Username",
"description": "The user's username, not unique across the platform."
},
"discriminator": {
"type": "string",
"x-ms-summary": "Discriminator",
"description": "The user's 4-digit discord-tag."
},
"avatar": {
"type": "string",
"x-ms-summary": "Avatar",
"description": "The user's avatar hash."
},
"bot": {
"type": "boolean",
"x-ms-summary": "Bot",
"description": "Whether the user belongs to an OAuth2 application."
},
"system": {
"type": "boolean",
"x-ms-summary": "System",
"description": "Whether the user is an Official Discord System user (part of the urgent message system)."
},
"mfa_enabled": {
"type": "boolean",
"x-ms-summary": "MFA Enabled",
"description": "Whether the user has two factor enabled on their account."
},
"locale": {
"type": "string",
"x-ms-summary": "Locale",
"description": "The user's chosen language option."
},
"verified": {
"type": "boolean",
"x-ms-summary": "Verified",
"description": "Whether the email on this account has been verified."
},
"email": {
"type": "string",
"x-ms-summary": "Email",
"description": "The user's email."
},
"flags": {
"type": "integer",
"format": "int32",
"x-ms-summary": "Flags",
"description": "The flags on a user's account."
},
"premium_type": {
"type": "integer",
"format": "int32",
"x-ms-summary": "Premium Type",
"description": "The type of Nitro subscription on a user's account."
},
"public_flags": {
"type": "integer",
"format": "int32",
"x-ms-summary": "Public Flags",
"description": "The public flags on a user's account."
}
}
},
"Webhook": {
"type": "object",
"properties": {
"id": {
"type": "string",
"x-ms-summary": "ID",
"description": "The id of the webhook."
},
"type": {
"type": "integer",
"x-ms-summary": "Type",
"description": "The type of webhook."
},
"guild_id": {
"type": "string",
"x-ms-summary": "Guild ID",
"description": "The guild id this webhook is for, if any."
},
"channel_id": {
"type": "string",
"x-ms-summary": "Channel ID",
"description": "The channel id this webhook is for, if any."
},
"user": {
"$ref": "#/definitions/User"
},
"name": {
"type": "string",
"x-ms-summary": "Name",
"description": "The default name of the webhook."
},
"avatar": {
"type": "string",
"x-ms-summary": "Avatar",
"description": "The default user avatar hash of the webhook."
},
"token": {
"type": "string",
"x-ms-summary": "Token",
"description": "The secure token of the webhook (returned for Incoming Webhooks)."
},
"application_id": {
"type": "string",
"x-ms-summary": "Application ID",
"description": "The bot/OAuth2 application that created this webhook."
},
"source_guild": {
"$ref": "#/definitions/Guild"
},
"source_channel": {
"$ref": "#/definitions/Channel"
}
}
}
},
"parameters": {
"GuildID": {
"name": "guild.id",
"in": "path",
"required": true,
"type": "string",
"x-ms-summary": "Guild",
"description": "Select the guild (server).",
"x-ms-url-encoding": "single",
"x-ms-dynamic-values": {
"operationId": "GetCurrentUserGuilds",
"value-path": "id",
"value-title": "name"
}
},
"WebhookID": {
"name": "webhook.id",
"in": "path",
"required": true,
"type": "string",
"x-ms-summary": "Webhook ID",
"description": "The ID of the webhook.",
"x-ms-url-encoding": "single"
},
"WebhookToken": {
"name": "webhook.token",
"in": "path",
"required": true,
"type": "string",
"x-ms-summary": "Webhook Token",
"description": "The token of the webhook.",
"x-ms-url-encoding": "single"
}
},
"responses": {},
"securityDefinitions": {
"undefined": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://discord.com/api/oauth2/authorize",
"tokenUrl": "https://discord.com/api/oauth2/token",
"scopes": {
"identify email guilds connections webhook.incoming": "identify email guilds connections webhook.incoming"
}
}
},
"security": [
{
"undefined": ["identify email guilds connections webhook.incoming"]
}
],
"tags": []
}

Просмотреть файл

@ -0,0 +1,35 @@
{
"properties": {
"connectionParameters": {
"token": {
"type": "oauthSetting",
"oAuthSettings": {
"identityProvider": "oauth2",
"clientId": "",
"scopes": ["identify email guilds connections webhook.incoming"],
"redirectMode": "Global",
"redirectUrl": "https://global.consent.azure-apim.net/redirect",
"properties": {
"IsFirstParty": "False",
"IsOnbehalfofLoginSupported": false
},
"customParameters": {
"authorizationUrl": {
"value": "https://discord.com/api/oauth2/authorize"
},
"tokenUrl": {
"value": "https://discord.com/api/oauth2/token"
},
"refreshUrl": {
"value": "https://discord.com/api/oauth2/token"
}
}
}
}
},
"iconBrandColor": "#000000",
"capabilities": [],
"publisher": "Daniel Laskewitz | Sogeti",
"stackOwner": "Discord"
}
}

Просмотреть файл

@ -0,0 +1,37 @@
# Discord
Discord is a voice, video and text communication service used by over a hundred million people to hang out and talk with their friends and communities.
## Publisher: Daniel Laskewitz | Sogeti & Michael Guzowski | Developico
## Prerequisites
You need to have a Discord account. You can [get started](https://support.discord.com/hc/en-us/articles/360033931551-Getting-Started) for free or get a premium (Discord Nitro) account.
## Supported Operations
### Get Current User
Returns the user object of the requestors account.
### Get User Connections
Returns a list of connection objects.
### Get Current User Guilds
Returns a list of partial guild objects the current user is a member of.
### Execute Webhook
This request executes a webhook by using a webhook id and token.
## Obtaining Credentials
Go to the [Discord Developer Portal](https://discord.com/developers/applications) and login. Click the purple "New Application" button and provide a name for the app. Next, click on the purple "Create" button.
From the following page you can grab your client ID and navigate to the OAuth2 page to grab the client secret. On the OAuth2 page, you can also add the redirect URL.
## Known Issues and Limitations
No issues and limitations are known at this time.