mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-05 06:26:08 +00:00
refactor: separate api types (#71)
* refactor: better api types boundaries * fix: fmt
This commit is contained in:
parent
aff4bf2e92
commit
47d20cb6e0
2
mod.ts
2
mod.ts
@ -5,4 +5,6 @@ export default Session;
|
|||||||
export * from './packages/biscuit/mod.ts';
|
export * from './packages/biscuit/mod.ts';
|
||||||
export * from './packages/discordeno/mod.ts';
|
export * from './packages/discordeno/mod.ts';
|
||||||
export * from './packages/cache/mod.ts';
|
export * from './packages/cache/mod.ts';
|
||||||
|
export * from './packages/api-types/discord.ts';
|
||||||
|
export * from './packages/api-types/shared.ts';
|
||||||
export { default as enableCache } from './packages/cache/mod.ts';
|
export { default as enableCache } from './packages/cache/mod.ts';
|
||||||
|
@ -446,5 +446,5 @@ export function GUILD_WIDGET(guildId: Snowflake, options: GetWidget = {get: 'set
|
|||||||
url += '.png';
|
url += '.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
return url
|
return url;
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { DiscordGatewayPayload } from '../../types/discord.ts';
|
import { DiscordGatewayPayload } from '../../../api-types/discord.ts';
|
||||||
import { GatewayBot, PickPartial } from '../../types/shared.ts';
|
import { GatewayBot, PickPartial } from '../../../api-types/shared.ts';
|
||||||
import { LeakyBucket } from '../../util/bucket.ts';
|
import { LeakyBucket } from '../../util/bucket.ts';
|
||||||
import { CreateShard, createShard } from '../shard/createShard.ts';
|
import { CreateShard, createShard } from '../shard/createShard.ts';
|
||||||
import { Shard, ShardGatewayConfig } from '../shard/types.ts';
|
import { Shard, ShardGatewayConfig } from '../shard/types.ts';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DiscordGatewayPayload } from '../../types/discord.ts';
|
import { DiscordGatewayPayload } from '../../../api-types/discord.ts';
|
||||||
import { PickPartial } from '../../types/shared.ts';
|
import { PickPartial } from '../../../api-types/shared.ts';
|
||||||
import { CreateShard, createShard } from '../shard/createShard.ts';
|
import { CreateShard, createShard } from '../shard/createShard.ts';
|
||||||
import { Shard, ShardGatewayConfig } from '../shard/types.ts';
|
import { Shard, ShardGatewayConfig } from '../shard/types.ts';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayIntents } from '../../types/shared.ts';
|
import { GatewayIntents } from '../../../api-types/shared.ts';
|
||||||
import { createLeakyBucket } from '../../util/bucket.ts';
|
import { createLeakyBucket } from '../../util/bucket.ts';
|
||||||
import { createShard } from '../shard/createShard.ts';
|
import { createShard } from '../shard/createShard.ts';
|
||||||
import { Shard } from '../shard/types.ts';
|
import { Shard } from '../shard/types.ts';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayIntents } from '../../types/shared.ts';
|
import { GatewayIntents } from '../../../api-types/shared.ts';
|
||||||
import { createShard } from '../shard/createShard.ts';
|
import { createShard } from '../shard/createShard.ts';
|
||||||
import { GatewayManager } from './gatewayManager.ts';
|
import { GatewayManager } from './gatewayManager.ts';
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import { connect } from './connect.ts';
|
|||||||
import { close } from './close.ts';
|
import { close } from './close.ts';
|
||||||
import { shutdown } from './shutdown.ts';
|
import { shutdown } from './shutdown.ts';
|
||||||
import { isOpen } from './isOpen.ts';
|
import { isOpen } from './isOpen.ts';
|
||||||
import { DiscordGatewayPayload, DiscordStatusUpdate } from '../../types/discord.ts';
|
import { DiscordGatewayPayload, DiscordStatusUpdate } from '../../../api-types/discord.ts';
|
||||||
import { GatewayIntents, PickPartial } from '../../types/shared.ts';
|
import { GatewayIntents, PickPartial } from '../../../api-types/shared.ts';
|
||||||
import { API_VERSION } from '../../util/constants.ts';
|
import { API_VERSION } from '../../util/constants.ts';
|
||||||
|
|
||||||
// TODO: debug
|
// TODO: debug
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayCloseEventCodes } from '../../types/shared.ts';
|
import { GatewayCloseEventCodes } from '../../../api-types/shared.ts';
|
||||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
||||||
|
|
||||||
export async function handleClose(shard: Shard, close: CloseEvent): Promise<void> {
|
export async function handleClose(shard: Shard, close: CloseEvent): Promise<void> {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DiscordGatewayPayload, DiscordHello, DiscordReady } from '../../types/discord.ts';
|
import { DiscordGatewayPayload, DiscordHello, DiscordReady } from '../../../api-types/discord.ts';
|
||||||
import { GatewayOpcodes } from '../../types/shared.ts';
|
import { GatewayOpcodes } from '../../../api-types/shared.ts';
|
||||||
import { createLeakyBucket } from '../../util/bucket.ts';
|
import { createLeakyBucket } from '../../util/bucket.ts';
|
||||||
import { delay } from '../../util/delay.ts';
|
import { delay } from '../../util/delay.ts';
|
||||||
import { decompressWith } from './deps.ts';
|
import { decompressWith } from './deps.ts';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayOpcodes } from '../../types/shared.ts';
|
import { GatewayOpcodes } from '../../../api-types/shared.ts';
|
||||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
||||||
|
|
||||||
export async function identify(shard: Shard): Promise<void> {
|
export async function identify(shard: Shard): Promise<void> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayOpcodes } from '../../types/shared.ts';
|
import { GatewayOpcodes } from '../../../api-types/shared.ts';
|
||||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
||||||
|
|
||||||
export async function resume(shard: Shard): Promise<void> {
|
export async function resume(shard: Shard): Promise<void> {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { GatewayOpcodes } from '../../types/shared.ts';
|
import { GatewayOpcodes } from '../../../api-types/shared.ts';
|
||||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
import { Shard, ShardSocketCloseCodes, ShardState } from './types.ts';
|
||||||
|
|
||||||
export function startHeartbeating(shard: Shard, interval: number) {
|
export function startHeartbeating(shard: Shard, interval: number) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DiscordGatewayPayload } from '../../types/discord.ts';
|
import { DiscordGatewayPayload } from '../../../api-types/discord.ts';
|
||||||
import { GatewayOpcodes } from '../../types/shared.ts';
|
import { GatewayOpcodes } from '../../../api-types/shared.ts';
|
||||||
import { createShard } from './createShard.ts';
|
import { createShard } from './createShard.ts';
|
||||||
|
|
||||||
// TODO: think whether we also need an identifiedShard function
|
// TODO: think whether we also need an identifiedShard function
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export * from './gateway/mod.ts';
|
export * from './gateway/mod.ts';
|
||||||
export * from './rest/mod.ts';
|
export * from './rest/mod.ts';
|
||||||
export * from './types/mod.ts';
|
|
||||||
export * from './util/constants.ts';
|
export * from './util/constants.ts';
|
||||||
export * from './util/token.ts';
|
export * from './util/token.ts';
|
||||||
|
export * from '../api-types/discord.ts';
|
||||||
|
export * from '../api-types/shared.ts';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { RestManager } from './restManager.ts';
|
import { RestManager } from './restManager.ts';
|
||||||
import { FileContent } from '../types/shared.ts';
|
import { FileContent } from '../../api-types/shared.ts';
|
||||||
import { USER_AGENT } from '../util/constants.ts';
|
import { USER_AGENT } from '../util/constants.ts';
|
||||||
import { RequestMethod, RestPayload, RestRequest } from './rest.ts';
|
import { RequestMethod, RestPayload, RestRequest } from './rest.ts';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { RestManager } from './restManager.ts';
|
import { RestManager } from './restManager.ts';
|
||||||
import { HTTPResponseCodes } from '../types/shared.ts';
|
import { HTTPResponseCodes } from '../../api-types/shared.ts';
|
||||||
|
|
||||||
export async function processGlobalQueue(rest: RestManager) {
|
export async function processGlobalQueue(rest: RestManager) {
|
||||||
// IF QUEUE IS EMPTY EXIT
|
// IF QUEUE IS EMPTY EXIT
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { HTTPResponseCodes } from '../types/shared.ts';
|
import { HTTPResponseCodes } from '../../api-types/shared.ts';
|
||||||
import { BASE_URL } from '../util/constants.ts';
|
import { BASE_URL } from '../util/constants.ts';
|
||||||
import { RequestMethod } from './rest.ts';
|
import { RequestMethod } from './rest.ts';
|
||||||
import { RestManager } from './restManager.ts';
|
import { RestManager } from './restManager.ts';
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
export * from './discord.ts';
|
|
||||||
export * from './shared.ts';
|
|
@ -1,4 +1,4 @@
|
|||||||
import { PickPartial } from '../types/shared.ts';
|
import { PickPartial } from '../../api-types/shared.ts';
|
||||||
import { delay } from './delay.ts';
|
import { delay } from './delay.ts';
|
||||||
|
|
||||||
/** A Leaky Bucket.
|
/** A Leaky Bucket.
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
export * from './bucket.ts';
|
|
||||||
export * from './collection.ts';
|
|
||||||
export * from './constants.ts';
|
|
||||||
export * from './delay.ts';
|
|
||||||
export * from './token.ts';
|
|
Loading…
x
Reference in New Issue
Block a user