diff --git a/package.json b/package.json index 1495fea..2bbfb22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@countbot/countbot-api-types", - "version": "1.41.0", + "version": "2.0.0", "description": "API types for CountBot", "author": { "name": "CountBot", diff --git a/src/index.ts b/src/index.ts index da23cb4..0b9f8f9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,2 @@ export * from './payloads/index.js'; -export * from './rest/index.js'; export * from './utils/index.js'; diff --git a/src/payloads/Channel.ts b/src/payloads/Channel.ts index 810af77..261a29e 100644 --- a/src/payloads/Channel.ts +++ b/src/payloads/Channel.ts @@ -1,4 +1,19 @@ -import type { CountingMode } from '../rest/Channel.js'; +export const CountingModes = [ + 'DEFAULT', + 'EVEN', + 'ODD', + 'THREE', + 'FOUR', + 'FIVE', + 'SIX', + 'SEVEN', + 'EIGHT', + 'NINE', + 'TEN', + 'PRIME', +] as const; + +export type CountingMode = (typeof CountingModes)[number]; export interface CountingChannelGoal { /** @@ -73,7 +88,7 @@ export interface CountingChannelConfig { /** * The counting mode */ - mode: CountingMode; + mode: string; } export interface CountingChannelNotifications { diff --git a/src/payloads/ChannelModifiers.ts b/src/payloads/ChannelModifiers.ts index 807db40..196a1f0 100644 --- a/src/payloads/ChannelModifiers.ts +++ b/src/payloads/ChannelModifiers.ts @@ -1,4 +1,4 @@ -import type { Modifiers } from '../utils/modifiers.js'; +import type { Modifiers } from '../utils/BaseModifier.js'; export interface APICountingChannelModifiers { /** diff --git a/src/payloads/UserModifiers.ts b/src/payloads/UserModifiers.ts index 09877a8..acb2f5d 100644 --- a/src/payloads/UserModifiers.ts +++ b/src/payloads/UserModifiers.ts @@ -1,4 +1,4 @@ -import type { Modifiers } from '../utils/modifiers.js'; +import type { Modifiers } from '../utils/BaseModifier.js'; export interface APICountingUserModifiers { /** diff --git a/src/rest/Channel.ts b/src/rest/Channel.ts deleted file mode 100644 index f7c3fb0..0000000 --- a/src/rest/Channel.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { APICountingChannel } from '../payloads/Channel.js'; -import type { BaseAuthRouteOptions } from '../utils/base.js'; - -export const CountingModes = [ - 'DEFAULT', - 'EVEN', - 'ODD', - 'THREE', - 'FOUR', - 'FIVE', - 'SIX', - 'SEVEN', - 'EIGHT', - 'NINE', - 'TEN', - 'PRIME', -] as const; - -export type CountingMode = (typeof CountingModes)[number]; - -export interface RESTGetAPICountingChannels extends BaseAuthRouteOptions | null> { - Querystring: { - channelId?: string; - guildId?: string; - }; -} - -export interface RESTGetAPICountingChannel extends BaseAuthRouteOptions | null> { - Params: { - channelId: string; - }; -} - -export interface RESTGetAPICountingChannelLeaderboard extends BaseAuthRouteOptions[]> { - Querystring: { - page?: number; - }; -} diff --git a/src/rest/ChannelModifiers.ts b/src/rest/ChannelModifiers.ts deleted file mode 100644 index e3f9e09..0000000 --- a/src/rest/ChannelModifiers.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { APICountingChannelModifiers } from '../payloads/ChannelModifiers.js'; -import { BaseAuthRouteOptions } from '../utils/base.js'; - -export interface RESTGetAPIChannelModifiers extends BaseAuthRouteOptions | null> { - Params: { - channelId: string; - }; -} diff --git a/src/rest/Guild.ts b/src/rest/Guild.ts deleted file mode 100644 index 812dab0..0000000 --- a/src/rest/Guild.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type { APICountingGuild } from '../payloads/Guild.js'; -import type { BaseAuthRouteOptions, LanguageCode } from '../utils/index.js'; - -export interface RESTGetAPIGuilds extends BaseAuthRouteOptions | null> { - Querystring: { - guildId?: string; - }; -} - -export interface RESTGetAPIGuild extends BaseAuthRouteOptions | null> { - Params: { - guildId: string; - }; -} - -export interface RESTPatchAPIGuild extends BaseAuthRouteOptions | null> { - Params: { - guildId: string; - }; - Body: { - language?: LanguageCode; - }; -} - -export interface RESTPostAPIGuild extends BaseAuthRouteOptions | null> { - Body: { - guildId: string; - }; -} diff --git a/src/rest/Status.ts b/src/rest/Status.ts deleted file mode 100644 index 20a8a56..0000000 --- a/src/rest/Status.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { APIStatus } from '../payloads/Status.js'; -import type { BaseAuthRouteOptions } from '../utils/base.js'; - -export type RESTGetAPIStatus = BaseAuthRouteOptions; diff --git a/src/rest/Summary.ts b/src/rest/Summary.ts deleted file mode 100644 index ca934ac..0000000 --- a/src/rest/Summary.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { APICountingSummary } from '../payloads/Summary.js'; -import type { BaseAuthRouteOptions } from '../utils/base.js'; - -export type RESTGetAPISummaries = BaseAuthRouteOptions[] | null>; -export interface RESTGetAPIDailySummary extends BaseAuthRouteOptions | null> { - Params: { - summaryId: string; - }; -} diff --git a/src/rest/User.ts b/src/rest/User.ts deleted file mode 100644 index 86069a3..0000000 --- a/src/rest/User.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { APIAchievement } from '../payloads/Achievement.js'; -import type { APICountingUser } from '../payloads/User.js'; -import type { BaseAuthRouteOptions } from '../utils/base.js'; - -export interface RESTGetAPICountingUsers extends BaseAuthRouteOptions | null> { - Querystring: { - userId?: string; - }; -} - -export interface RESTGetAPICountingUser extends BaseAuthRouteOptions | null> { - Params: { - userId: string; - }; -} - -export interface RESTGetAPICountingUserLeaderboard extends BaseAuthRouteOptions[]> { - Querystring: { - page?: number; - }; -} - -export interface RESTGetAPICountingUserAchievements extends BaseAuthRouteOptions[] | null> { - Params: { - userId: string; - }; -} diff --git a/src/rest/UserModifiers.ts b/src/rest/UserModifiers.ts deleted file mode 100644 index a952081..0000000 --- a/src/rest/UserModifiers.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { APICountingUserModifiers } from '../payloads/UserModifiers.js'; -import type { BaseAuthRouteOptions } from '../utils/base.js'; - -export interface RESTGetAPICountingUserModifiers extends BaseAuthRouteOptions | null> { - Params: { - userId: string; - }; -} diff --git a/src/rest/index.ts b/src/rest/index.ts deleted file mode 100644 index 4b03409..0000000 --- a/src/rest/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './Channel.js'; -export * from './ChannelModifiers.js'; -export * from './Guild.js'; -export * from './Status.js'; -export * from './Summary.js'; -export * from './User.js'; -export * from './UserModifiers.js'; diff --git a/src/utils/modifiers.ts b/src/utils/BaseModifier.ts similarity index 100% rename from src/utils/modifiers.ts rename to src/utils/BaseModifier.ts diff --git a/src/utils/BaseReply.ts b/src/utils/BaseReply.ts new file mode 100644 index 0000000..3e6c5e1 --- /dev/null +++ b/src/utils/BaseReply.ts @@ -0,0 +1,5 @@ +export interface BaseReply { + error: boolean; + code?: C; + data?: R; +} diff --git a/src/utils/languages.ts b/src/utils/LanguageCode.ts similarity index 100% rename from src/utils/languages.ts rename to src/utils/LanguageCode.ts diff --git a/src/utils/ResponseCodes.ts b/src/utils/ResponseCodes.ts new file mode 100644 index 0000000..36b8058 --- /dev/null +++ b/src/utils/ResponseCodes.ts @@ -0,0 +1,22 @@ +export enum UserBuyItemCode { + Success, + NotEnoughCoins, + InventoryFull, +} + +export enum UserAddAchievementCode { + Success, + AlreadyHasAchievement, +} + +export enum ChannelTransferCode { + Success, + FailOldChannelNotExists, + FailChannelsEqual, + FailNewChannelAlreadyExists, +} + +export enum ChannelDeleteCode { + Success, + FailChannelNotExists, +} diff --git a/src/utils/base.ts b/src/utils/base.ts deleted file mode 100644 index 48711b0..0000000 --- a/src/utils/base.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { StatusCodePhrases } from './codes.js'; - -export interface BaseAuthRouteOptions { - Header: { - Authorization: string; - }; - Reply: { - error: boolean; - message: StatusCodePhrases; - data: Response; - }; -} diff --git a/src/utils/codes.ts b/src/utils/codes.ts deleted file mode 100644 index b23ee26..0000000 --- a/src/utils/codes.ts +++ /dev/null @@ -1,37 +0,0 @@ -export enum StatusCodePhrases { - Ok = 'Ok', - BadRequest = 'BadRequest', - NotFound = 'NotFound', - ChannelCreated = 'ChannelCreated', - ChannelFound = 'ChannelFound', - ChannelNotFound = 'ChannelNotFound', - ChannelUpdated = 'ChannelUpdated', - ChannelAlreadyExists = 'ChannelAlreadyExists', - GuildAlreadyExists = 'GuildAlreadyExists', - GuildCreated = 'GuildCreated', - GuildFound = 'GuildFound', - GuildNotFound = 'GuildNotFound', - GuildUpdated = 'GuildUpdated', - UserAlreadyExists = 'UserAlreadyExists', - UserCreated = 'UserCreated', - UserFound = 'UserFound', - UserNotFound = 'UserNotFound', - UserUpdated = 'UserUpdated', - RouteNotFound = 'RouteNotFound', - MethodNotAllowed = 'MethodNotAllowed', - Forbidden = 'Forbidden', - Unauthorized = 'Unauthorized', - InternalServerError = 'InternalServerError', - SummaryFound = 'SummaryFound', - SummaryNotFound = 'SummaryNotFound', - InvalidObjectId = 'InvalidObjectId', - PremiumGuildActivated = 'PremiumGuildActivated', - PremiumGuildCancelled = 'PremiumGuildCancelled', - PremiumGuildLifetimeActivated = 'PremiumGuildLifetimeActivated', - PremiumOnly = 'PremiumOnly', - ChannelLeaderboardFound = 'ChannelLeaderboardFound', - UserLeaderboardFound = 'UserLeaderboardFound', - TokenCreated = 'TokenCreated', - TooManyRequests = 'TooManyRequests', - VoteSuccess = 'VoteSuccess', -} diff --git a/src/utils/index.ts b/src/utils/index.ts index ca01329..6cdf2ef 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,5 +1,5 @@ -export * from './base.js'; -export * from './codes.js'; +export * from './BaseReply.js'; +export * from './ResponseCodes.js'; export * from './items.js'; -export * from './languages.js'; -export * from './modifiers.js'; +export * from './LanguageCode.js'; +export * from './BaseModifier.js';