discord-slim
Advanced tools
Comparing version 2.0.0-dev.9 to 2.0.0-dev.10
/// <reference types="node" /> | ||
import { RequestOptions } from './request'; | ||
import { RequestOptions, TokenTypes } from './request'; | ||
import type * as helpers from './helpers'; | ||
@@ -407,1 +407,28 @@ import type * as types from './types'; | ||
}; | ||
export declare const OAuth2: { | ||
TokenExchange: (params: { | ||
client_id: string; | ||
client_secret: string; | ||
redirect_uri: string; | ||
scope: helpers.OAuth2Scopes | string; | ||
} & ({ | ||
grant_type: helpers.OAuth2GrantTypes.AUTHORIZATION_CODE; | ||
code: string; | ||
} | { | ||
grant_type: helpers.OAuth2GrantTypes.REFRESH_TOKEN; | ||
refresh_token: string; | ||
})) => Promise<{ | ||
access_token: string; | ||
token_type: TokenTypes.BEARER; | ||
expires_in: number; | ||
refresh_token: string; | ||
scope: helpers.OAuth2Scopes | string; | ||
}>; | ||
GetCurrentApplicationInformation: (requestOptions?: RequestOptions | undefined) => Promise<types.Application>; | ||
GetCurrentAuthorizationInformation: (requestOptions?: RequestOptions | undefined) => Promise<{ | ||
application: types.Application; | ||
scopes: string[]; | ||
expires: string; | ||
user?: types.User; | ||
}>; | ||
}; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Application = exports.Webhook = exports.Voice = exports.User = exports.Template = exports.Invite = exports.Widget = exports.Integration = exports.Role = exports.Ban = exports.Member = exports.Emoji = exports.Guild = exports.GroupDM = exports.PinnedMessage = exports.Reaction = exports.Message = exports.Channel = void 0; | ||
exports.OAuth2 = exports.Application = exports.Webhook = exports.Voice = exports.User = exports.Template = exports.Invite = exports.Widget = exports.Integration = exports.Role = exports.Ban = exports.Member = exports.Emoji = exports.Guild = exports.GroupDM = exports.PinnedMessage = exports.Reaction = exports.Message = exports.Channel = void 0; | ||
const request_1 = require("./request"); | ||
@@ -166,1 +166,6 @@ const querystring_1 = __importDefault(require("querystring")); | ||
}; | ||
exports.OAuth2 = { | ||
TokenExchange: (params) => request_1.Request("POST", "/oauth2" + "/token?" + querystring_1.default.stringify(params)), | ||
GetCurrentApplicationInformation: (requestOptions) => request_1.Request("GET", "/oauth2" + "/applications" + "/@me", requestOptions), | ||
GetCurrentAuthorizationInformation: (requestOptions) => request_1.Request("GET", "/oauth2" + "/@me", requestOptions), | ||
}; |
@@ -282,1 +282,32 @@ export declare const HOST: "https://discord.com", API: "https://discord.com/api", API_VERSION = 8, API_PATH: "https://discord.com/api/v8", CDN = "https://cdn.discordapp.com"; | ||
} | ||
export declare enum OAuth2Scopes { | ||
BOT = "bot", | ||
CONNECTIONS = "connections", | ||
EMAIL = "email", | ||
IDENTIFY = "identify", | ||
GUILDS = "guilds", | ||
GUILDS_JOIN = "guilds.join", | ||
GDM_JOIN = "gdm.join", | ||
MESSAGES_READ = "messages.read", | ||
RPC = "rpc", | ||
RPC_API = "rpc.api", | ||
RPC_NOTIFICATIONS_READ = "rpc.notifications.read", | ||
WEBHOOK_INCOMING = "webhook.incoming", | ||
APPLICATIONS_BUILDS_UPLOAD = "applications.builds.upload", | ||
APPLICATIONS_BUILDS_READ = "applications.builds.read", | ||
APPLICATIONS_STORE_UPDATE = "applications.store.update", | ||
APPLICATIONS_ENTITLEMENTS = "applications.entitlements", | ||
RELATIONSHIPS_READ = "relationships.read", | ||
ACTIVITIES_READ = "activities.read", | ||
ACTIVITIES_WRITE = "activities.write", | ||
APPLICATIONS_COMMANDS = "applications.commands", | ||
APPLICATIONS_COMMANDS_UPDATE = "applications.commands.update" | ||
} | ||
export declare enum OAuth2GrantTypes { | ||
AUTHORIZATION_CODE = "authorization_code", | ||
REFRESH_TOKEN = "refresh_token" | ||
} | ||
export declare enum MembershipStates { | ||
INVITED = 1, | ||
ACCEPTED = 2 | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InteractionResponseFlags = exports.InteractionResponseTypes = exports.InteractionTypes = exports.ApplicationCommandOptionTypes = exports.ActivityFlags = exports.WebhookTypes = exports.VisibilityTypes = exports.PremiumTypes = exports.UserFlags = exports.WidgetStyleOptions = exports.StatusTypes = exports.ActivityTypes = exports.TargetUserTypes = exports.PremiumTier = exports.IntegrationExpireBehaviors = exports.GuildFeatures = exports.SystemChannelFlags = exports.VerificationLevel = exports.MFA_Level = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.AllowedMentionTypes = exports.PermissionsOverwriteTypes = exports.MessageStickerFormatTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.ChannelTypes = exports.AuditLogEvents = exports.Intents = exports.Permissions = exports.CDN = exports.API_PATH = exports.API_VERSION = exports.API = exports.HOST = void 0; | ||
exports.MembershipStates = exports.OAuth2GrantTypes = exports.OAuth2Scopes = exports.InteractionResponseFlags = exports.InteractionResponseTypes = exports.InteractionTypes = exports.ApplicationCommandOptionTypes = exports.ActivityFlags = exports.WebhookTypes = exports.VisibilityTypes = exports.PremiumTypes = exports.UserFlags = exports.WidgetStyleOptions = exports.StatusTypes = exports.ActivityTypes = exports.TargetUserTypes = exports.PremiumTier = exports.IntegrationExpireBehaviors = exports.GuildFeatures = exports.SystemChannelFlags = exports.VerificationLevel = exports.MFA_Level = exports.ExplicitContentFilterLevel = exports.DefaultMessageNotificationLevel = exports.AllowedMentionTypes = exports.PermissionsOverwriteTypes = exports.MessageStickerFormatTypes = exports.MessageFlags = exports.MessageActivityTypes = exports.MessageTypes = exports.ChannelTypes = exports.AuditLogEvents = exports.Intents = exports.Permissions = exports.CDN = exports.API_PATH = exports.API_VERSION = exports.API = exports.HOST = void 0; | ||
exports.HOST = 'https://discord.com', exports.API = `${exports.HOST}/api`, exports.API_VERSION = 8, exports.API_PATH = `${exports.API}/v${exports.API_VERSION}`, exports.CDN = 'https://cdn.discordapp.com'; | ||
@@ -315,1 +315,35 @@ exports.Permissions = { | ||
})(InteractionResponseFlags = exports.InteractionResponseFlags || (exports.InteractionResponseFlags = {})); | ||
var OAuth2Scopes; | ||
(function (OAuth2Scopes) { | ||
OAuth2Scopes["BOT"] = "bot"; | ||
OAuth2Scopes["CONNECTIONS"] = "connections"; | ||
OAuth2Scopes["EMAIL"] = "email"; | ||
OAuth2Scopes["IDENTIFY"] = "identify"; | ||
OAuth2Scopes["GUILDS"] = "guilds"; | ||
OAuth2Scopes["GUILDS_JOIN"] = "guilds.join"; | ||
OAuth2Scopes["GDM_JOIN"] = "gdm.join"; | ||
OAuth2Scopes["MESSAGES_READ"] = "messages.read"; | ||
OAuth2Scopes["RPC"] = "rpc"; | ||
OAuth2Scopes["RPC_API"] = "rpc.api"; | ||
OAuth2Scopes["RPC_NOTIFICATIONS_READ"] = "rpc.notifications.read"; | ||
OAuth2Scopes["WEBHOOK_INCOMING"] = "webhook.incoming"; | ||
OAuth2Scopes["APPLICATIONS_BUILDS_UPLOAD"] = "applications.builds.upload"; | ||
OAuth2Scopes["APPLICATIONS_BUILDS_READ"] = "applications.builds.read"; | ||
OAuth2Scopes["APPLICATIONS_STORE_UPDATE"] = "applications.store.update"; | ||
OAuth2Scopes["APPLICATIONS_ENTITLEMENTS"] = "applications.entitlements"; | ||
OAuth2Scopes["RELATIONSHIPS_READ"] = "relationships.read"; | ||
OAuth2Scopes["ACTIVITIES_READ"] = "activities.read"; | ||
OAuth2Scopes["ACTIVITIES_WRITE"] = "activities.write"; | ||
OAuth2Scopes["APPLICATIONS_COMMANDS"] = "applications.commands"; | ||
OAuth2Scopes["APPLICATIONS_COMMANDS_UPDATE"] = "applications.commands.update"; | ||
})(OAuth2Scopes = exports.OAuth2Scopes || (exports.OAuth2Scopes = {})); | ||
var OAuth2GrantTypes; | ||
(function (OAuth2GrantTypes) { | ||
OAuth2GrantTypes["AUTHORIZATION_CODE"] = "authorization_code"; | ||
OAuth2GrantTypes["REFRESH_TOKEN"] = "refresh_token"; | ||
})(OAuth2GrantTypes = exports.OAuth2GrantTypes || (exports.OAuth2GrantTypes = {})); | ||
var MembershipStates; | ||
(function (MembershipStates) { | ||
MembershipStates[MembershipStates["INVITED"] = 1] = "INVITED"; | ||
MembershipStates[MembershipStates["ACCEPTED"] = 2] = "ACCEPTED"; | ||
})(MembershipStates = exports.MembershipStates || (exports.MembershipStates = {})); |
@@ -608,1 +608,31 @@ import type * as helpers from './helpers'; | ||
}; | ||
export declare type Application = { | ||
id: string; | ||
name: string; | ||
icon: string | null; | ||
description: string; | ||
rpc_origins?: string[]; | ||
bot_public: boolean; | ||
bot_require_code_grant: boolean; | ||
owner: User; | ||
summary?: string; | ||
verify_key: string; | ||
team?: Team; | ||
guild_id?: string; | ||
primary_sku_id?: string; | ||
slug?: string; | ||
cover_image?: string; | ||
flags?: number; | ||
}; | ||
export declare type Team = { | ||
icon: string | null; | ||
id: string; | ||
members: TeamMember[]; | ||
owner_user_id: string; | ||
}; | ||
export declare type TeamMember = { | ||
membership_state: helpers.MembershipStates; | ||
permissions: string[]; | ||
team_id: string; | ||
user: User; | ||
}; |
{ | ||
"name": "discord-slim", | ||
"version": "2.0.0-dev.9", | ||
"version": "2.0.0-dev.10", | ||
"description": "Lightweight Discord bot API for Node.js.", | ||
@@ -5,0 +5,0 @@ "author": "Hanabishi", |
123926
2630