mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-24 21:15:28 +00:00
implement sku creation route
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,30 @@
|
||||
import { Router, Request, Response } from "express";
|
||||
import { route } from "@spacebar/api";
|
||||
import { CreateApplicationSKUSchema, CreateApplicationSKUResponseSchema } from "@spacebar/schemas";
|
||||
|
||||
const router = Router({ mergeParams: true });
|
||||
|
||||
// this is the route the developer portal seems to use to create a sku for an app
|
||||
router.post(
|
||||
"/",
|
||||
route({
|
||||
description: "Create a new SKU for an application",
|
||||
requestBody: "CreateApplicationSKUSchema",
|
||||
responses: {
|
||||
200: {
|
||||
body: "CreateApplicationSKUResponseSchema",
|
||||
},
|
||||
},
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const { application_id } = req.params;
|
||||
const { name, sku_type, product_line } = req.body as CreateApplicationSKUSchema;
|
||||
// TODO:
|
||||
res.json({
|
||||
skus: [],
|
||||
store_listings: [],
|
||||
} as CreateApplicationSKUResponseSchema);
|
||||
},
|
||||
);
|
||||
|
||||
export default router;
|
||||
@@ -21,77 +21,77 @@ import { route } from "@spacebar/api";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
router.get("/:sku_id", route({}), (req: Request, res: Response) => {
|
||||
//TODO
|
||||
// const id = req.params.id;
|
||||
res.json({
|
||||
id: "",
|
||||
summary: "",
|
||||
sku: {
|
||||
id: "",
|
||||
type: 1,
|
||||
dependent_sku_id: null,
|
||||
application_id: "",
|
||||
manifets_labels: [],
|
||||
access_type: 2,
|
||||
name: "",
|
||||
features: [],
|
||||
release_date: "",
|
||||
premium: false,
|
||||
slug: "",
|
||||
flags: 4,
|
||||
genres: [],
|
||||
legal_notice: "",
|
||||
application: {
|
||||
id: "",
|
||||
name: "",
|
||||
icon: "",
|
||||
description: "",
|
||||
summary: "",
|
||||
cover_image: "",
|
||||
primary_sku_id: "",
|
||||
hook: true,
|
||||
slug: "",
|
||||
guild_id: "",
|
||||
bot_public: "",
|
||||
bot_require_code_grant: false,
|
||||
verify_key: "",
|
||||
publishers: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
],
|
||||
developers: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
],
|
||||
system_requirements: {},
|
||||
show_age_gate: false,
|
||||
price: {
|
||||
amount: 0,
|
||||
currency: "EUR",
|
||||
},
|
||||
locales: [],
|
||||
},
|
||||
tagline: "",
|
||||
description: "",
|
||||
carousel_items: [
|
||||
{
|
||||
asset_id: "",
|
||||
},
|
||||
],
|
||||
header_logo_dark_theme: {}, //{id: "", size: 4665, mime_type: "image/gif", width 160, height: 160}
|
||||
header_logo_light_theme: {},
|
||||
box_art: {},
|
||||
thumbnail: {},
|
||||
header_background: {},
|
||||
hero_background: {},
|
||||
assets: [],
|
||||
},
|
||||
}).status(200);
|
||||
});
|
||||
// router.get("/:sku_id", route({}), (req: Request, res: Response) => {
|
||||
// //TODO
|
||||
// // const id = req.params.id;
|
||||
// res.json({
|
||||
// id: "",
|
||||
// summary: "",
|
||||
// sku: {
|
||||
// id: "",
|
||||
// type: 1,
|
||||
// dependent_sku_id: null,
|
||||
// application_id: "",
|
||||
// manifets_labels: [],
|
||||
// access_type: 2,
|
||||
// name: "",
|
||||
// features: [],
|
||||
// release_date: "",
|
||||
// premium: false,
|
||||
// slug: "",
|
||||
// flags: 4,
|
||||
// genres: [],
|
||||
// legal_notice: "",
|
||||
// application: {
|
||||
// id: "",
|
||||
// name: "",
|
||||
// icon: "",
|
||||
// description: "",
|
||||
// summary: "",
|
||||
// cover_image: "",
|
||||
// primary_sku_id: "",
|
||||
// hook: true,
|
||||
// slug: "",
|
||||
// guild_id: "",
|
||||
// bot_public: "",
|
||||
// bot_require_code_grant: false,
|
||||
// verify_key: "",
|
||||
// publishers: [
|
||||
// {
|
||||
// id: "",
|
||||
// name: "",
|
||||
// },
|
||||
// ],
|
||||
// developers: [
|
||||
// {
|
||||
// id: "",
|
||||
// name: "",
|
||||
// },
|
||||
// ],
|
||||
// system_requirements: {},
|
||||
// show_age_gate: false,
|
||||
// price: {
|
||||
// amount: 0,
|
||||
// currency: "EUR",
|
||||
// },
|
||||
// locales: [],
|
||||
// },
|
||||
// tagline: "",
|
||||
// description: "",
|
||||
// carousel_items: [
|
||||
// {
|
||||
// asset_id: "",
|
||||
// },
|
||||
// ],
|
||||
// header_logo_dark_theme: {}, //{id: "", size: 4665, mime_type: "image/gif", width 160, height: 160}
|
||||
// header_logo_light_theme: {},
|
||||
// box_art: {},
|
||||
// thumbnail: {},
|
||||
// header_background: {},
|
||||
// hero_background: {},
|
||||
// assets: [],
|
||||
// },
|
||||
// }).status(200);
|
||||
// });
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Request, Response, Router } from "express";
|
||||
import { route } from "@spacebar/api";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
router.get("/", route({}), (req: Request, res: Response) => {
|
||||
//TODO
|
||||
// const id = req.params.id;
|
||||
res.json({
|
||||
id: "",
|
||||
summary: "",
|
||||
sku: {
|
||||
id: "",
|
||||
type: 1,
|
||||
dependent_sku_id: null,
|
||||
application_id: "",
|
||||
manifets_labels: [],
|
||||
access_type: 2,
|
||||
name: "",
|
||||
features: [],
|
||||
release_date: "",
|
||||
premium: false,
|
||||
slug: "",
|
||||
flags: 4,
|
||||
genres: [],
|
||||
legal_notice: "",
|
||||
application: {
|
||||
id: "",
|
||||
name: "",
|
||||
icon: "",
|
||||
description: "",
|
||||
summary: "",
|
||||
cover_image: "",
|
||||
primary_sku_id: "",
|
||||
hook: true,
|
||||
slug: "",
|
||||
guild_id: "",
|
||||
bot_public: "",
|
||||
bot_require_code_grant: false,
|
||||
verify_key: "",
|
||||
publishers: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
],
|
||||
developers: [
|
||||
{
|
||||
id: "",
|
||||
name: "",
|
||||
},
|
||||
],
|
||||
system_requirements: {},
|
||||
show_age_gate: false,
|
||||
price: {
|
||||
amount: 0,
|
||||
currency: "EUR",
|
||||
},
|
||||
locales: [],
|
||||
},
|
||||
tagline: "",
|
||||
description: "",
|
||||
carousel_items: [
|
||||
{
|
||||
asset_id: "",
|
||||
},
|
||||
],
|
||||
header_logo_dark_theme: {}, //{id: "", size: 4665, mime_type: "image/gif", width 160, height: 160}
|
||||
header_logo_light_theme: {},
|
||||
box_art: {},
|
||||
thumbnail: {},
|
||||
header_background: {},
|
||||
hero_background: {},
|
||||
assets: [],
|
||||
},
|
||||
}).status(200);
|
||||
});
|
||||
export default router;
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Request, Response, Router } from "express";
|
||||
import { route } from "@spacebar/api";
|
||||
import { CreateSKUSchema } from "@spacebar/schemas";
|
||||
import { SKU } from "@spacebar/util";
|
||||
|
||||
const router: Router = Router({ mergeParams: true });
|
||||
|
||||
router.post(
|
||||
"/",
|
||||
route({
|
||||
description:
|
||||
"Creates a new SKU. Returns the created SKU object on success. Requires an application with access to the store or monetization. User must be the owner of the application or member of the owning team.",
|
||||
requestBody: "CreateSKUSchema",
|
||||
}),
|
||||
async (req: Request, res: Response) => {
|
||||
const body = req.body as CreateSKUSchema;
|
||||
|
||||
const sku = await SKU.createSku(body);
|
||||
|
||||
res.json(sku).status(200);
|
||||
},
|
||||
);
|
||||
|
||||
export default router;
|
||||
@@ -16,8 +16,7 @@
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { User } from "@spacebar/util";
|
||||
import { SKUSchema } from "../store";
|
||||
import { SKU, User } from "@spacebar/util";
|
||||
import { EntitlementFulfillmentStatus } from "./EntitlementFulfillmentStatus";
|
||||
import { EntitlementGiftStyle } from "./EntitlementGiftStyle";
|
||||
import { EntitlementSpecialSourceType } from "./EntitlementSpecialSourceType";
|
||||
@@ -48,6 +47,6 @@ export interface EntitlementSchema {
|
||||
fulfilled_at?: string;
|
||||
source_type?: EntitlementSpecialSourceType;
|
||||
tenant_metadata?: Record<string, EntitlementTenantMetadataSchema>;
|
||||
sku?: SKUSchema;
|
||||
sku?: SKU;
|
||||
subscription_plan?: Partial<unknown>; // TODO: https://docs.discord.food/resources/store#subscription-plan-object
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationApprovableConsoleType {
|
||||
/**
|
||||
* Xbox
|
||||
*
|
||||
* Value: 1
|
||||
* Name: XBOX
|
||||
*/
|
||||
XBOX = 1,
|
||||
/**
|
||||
* PlayStation 5
|
||||
*
|
||||
* Value: 2
|
||||
* Name: PLAYSTATION_5
|
||||
*/
|
||||
PLAYSTATION_5 = 2,
|
||||
/**
|
||||
* PlayStation 4
|
||||
*
|
||||
* Value: 3
|
||||
* Name: PLAYSTATION_4
|
||||
*/
|
||||
PLAYSTATION_4 = 3,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export interface ApplicationCompanySchema {
|
||||
/**
|
||||
* The ID of the company
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The name of the company
|
||||
*/
|
||||
name: string;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationDiscoverabilityState {
|
||||
/**
|
||||
* This application is ineligible for the application directory
|
||||
*
|
||||
* Value: 1
|
||||
* Name: INELIGIBLE
|
||||
*/
|
||||
INELIGIBLE = 1,
|
||||
/**
|
||||
* This application is not listed in the application directory
|
||||
*
|
||||
* Value: 2
|
||||
* Name: NOT_DISCOVERABLE
|
||||
*/
|
||||
NOT_DISCOVERABLE = 2,
|
||||
/**
|
||||
* This application is listed in the application directory
|
||||
*
|
||||
* Value: 3
|
||||
* Name: DISCOVERABLE
|
||||
*/
|
||||
DISCOVERABLE = 3,
|
||||
/**
|
||||
* This application is featurable in the application directory
|
||||
*
|
||||
* Value: 4
|
||||
* Name: FEATUREABLE
|
||||
*/
|
||||
FEATUREABLE = 4,
|
||||
/**
|
||||
* This application has been blocked from appearing in the application directory
|
||||
*
|
||||
* Value: 5
|
||||
* Name: BLOCKED
|
||||
*/
|
||||
BLOCKED = 5,
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationEventWebhooksStatus {
|
||||
/**
|
||||
* Event webhooks are disabled
|
||||
*
|
||||
* Value: 1
|
||||
* Name: DISABLED
|
||||
*/
|
||||
DISABLED = 1,
|
||||
/**
|
||||
* Event webhooks are enabled
|
||||
*
|
||||
* Value: 2
|
||||
* Name: ENABLED
|
||||
*/
|
||||
ENABLED = 2,
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationEventWebhooksType {
|
||||
/**
|
||||
* Sent when a user authorizes the application
|
||||
*
|
||||
* Value: APPLICATION_AUTHORIZED
|
||||
*/
|
||||
APPLICATION_AUTHORIZED,
|
||||
/**
|
||||
* Sent when a user deauthorizes the application
|
||||
*
|
||||
* Value: APPLICATION_DEAUTHORIZED
|
||||
*/
|
||||
APPLICATION_DEAUTHORIZED,
|
||||
/**
|
||||
* Sent when a user creates an entitlement
|
||||
*
|
||||
* Value: ENTITLEMENT_CREATE
|
||||
*/
|
||||
ENTITLEMENT_CREATE,
|
||||
/**
|
||||
* Sent when an entitlement is updated
|
||||
*
|
||||
* Value: ENTITLEMENT_UPDATE
|
||||
*/
|
||||
ENTITLEMENT_UPDATE,
|
||||
/**
|
||||
* Sent when an entitlement is deleted
|
||||
*
|
||||
* Value: ENTITLEMENT_DELETE
|
||||
*/
|
||||
ENTITLEMENT_DELETE,
|
||||
/**
|
||||
* Sent when a user enrolls in a quest
|
||||
*
|
||||
* Value: QUEST_USER_ENROLLMENT
|
||||
*/
|
||||
QUEST_USER_ENROLLMENT,
|
||||
/**
|
||||
* Sent when a user sends a message in a lobby
|
||||
*
|
||||
* Value: LOBBY_MESSAGE_CREATE
|
||||
*/
|
||||
LOBBY_MESSAGE_CREATE,
|
||||
/**
|
||||
* Sent when a user updates a message in a lobby
|
||||
*
|
||||
* Value: LOBBY_MESSAGE_UPDATE
|
||||
*/
|
||||
LOBBY_MESSAGE_UPDATE,
|
||||
/**
|
||||
* Sent when a user deletes a message in a lobby
|
||||
*
|
||||
* Value: LOBBY_MESSAGE_DELETE
|
||||
*/
|
||||
LOBBY_MESSAGE_DELETE,
|
||||
/**
|
||||
* Sent when a user sends a direct message through the social layer SDK
|
||||
*
|
||||
* Value: GAME_DIRECT_MESSAGE_CREATE
|
||||
*/
|
||||
GAME_DIRECT_MESSAGE_CREATE,
|
||||
/**
|
||||
* Sent when a user updates a direct message through the social layer SDK
|
||||
*
|
||||
* Value: GAME_DIRECT_MESSAGE_UPDATE
|
||||
*/
|
||||
GAME_DIRECT_MESSAGE_UPDATE,
|
||||
/**
|
||||
* Sent when a user deletes a direct message through the social layer SDK
|
||||
*
|
||||
* Value: GAME_DIRECT_MESSAGE_DELETE
|
||||
*/
|
||||
GAME_DIRECT_MESSAGE_DELETE,
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export interface ApplicationExecutableSchema {
|
||||
/**
|
||||
* The operating system the executable can be found on
|
||||
*/
|
||||
os: string;
|
||||
/**
|
||||
* The name of the executable
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* Whether the executable is for a game launcher
|
||||
*/
|
||||
is_launcher: boolean;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationGuildRestriction {
|
||||
/**
|
||||
* The application can be authorized in any guild
|
||||
*
|
||||
* Value: 1
|
||||
* Name: JOIN_ALL
|
||||
*/
|
||||
JOIN_ALL = 1,
|
||||
/**
|
||||
* The application can only be authorized in guilds without the INTERNAL_EMPLOYEE_ONLY guild feature
|
||||
*
|
||||
* Value: 2
|
||||
* Name: JOIN_EXTERNAL_ONLY
|
||||
*/
|
||||
JOIN_EXTERNAL_ONLY = 2,
|
||||
/**
|
||||
* The application can only be authorized in guilds with the INTERNAL_EMPLOYEE_ONLY guild feature
|
||||
*
|
||||
* Value: 3
|
||||
* Name: JOIN_INTERNAL_ONLY
|
||||
*/
|
||||
JOIN_INTERNAL_ONLY = 3,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export interface ApplicationInstallParamsSchema {
|
||||
/**
|
||||
* The scopes to authorize the integration with
|
||||
*/
|
||||
scopes: string[];
|
||||
/**
|
||||
* The permissions to request for the application's bot integration role
|
||||
*/
|
||||
permissions: string;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApplicationInstallParamsSchema } from "./ApplicationInstallParamsSchema";
|
||||
|
||||
export interface ApplicationIntegrationTypeConfigurationSchema {
|
||||
/**
|
||||
* The default in-app authorization link for the installation context
|
||||
*/
|
||||
oauth2_install_params?: ApplicationInstallParamsSchema;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationInteractionsVersion {
|
||||
/**
|
||||
* Only Interaction Create events are sent as documented (default)
|
||||
*
|
||||
* Value: 1
|
||||
* Name: VERSION_1
|
||||
*/
|
||||
VERSION_1 = 1,
|
||||
/**
|
||||
* A selection of chosen events are sent
|
||||
*
|
||||
* Value: 2
|
||||
* Name: VERSION_2
|
||||
*/
|
||||
VERSION_2 = 2,
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationMonetizationState {
|
||||
/**
|
||||
* This application does not have monetization set up
|
||||
*
|
||||
* Value: 1
|
||||
* Name: NONE
|
||||
*/
|
||||
NONE = 1,
|
||||
/**
|
||||
* This application has monetization set up
|
||||
*
|
||||
* Value: 2
|
||||
* Name: ENABLED
|
||||
*/
|
||||
ENABLED = 2,
|
||||
/**
|
||||
* This application has been blocked from monetizing
|
||||
*
|
||||
* Value: 3
|
||||
* Name: BLOCKED
|
||||
*/
|
||||
BLOCKED = 3,
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* [Distributor Type](https://docs.discord.food/resources/application#distributor-type)
|
||||
*
|
||||
* FIELD TYPE DESCRIPTION
|
||||
*
|
||||
* id ?string The ID of the game
|
||||
*
|
||||
* sku ?string The SKU of the game
|
||||
*
|
||||
* distributor string The [distributor](https://docs.discord.food/resources/application#distributor-type) of the game
|
||||
*
|
||||
* TypeScript
|
||||
*/
|
||||
export enum ApplicationSKUDistributor {
|
||||
/**
|
||||
* Discord Store
|
||||
*
|
||||
* Value: discord
|
||||
*/
|
||||
discord,
|
||||
/**
|
||||
* Steam
|
||||
*
|
||||
* Value: steam
|
||||
*/
|
||||
steam,
|
||||
/**
|
||||
* Twitch
|
||||
*
|
||||
* Value: twitch
|
||||
*/
|
||||
twitch,
|
||||
/**
|
||||
* Ubisoft Connect
|
||||
*
|
||||
* Value: uplay
|
||||
*/
|
||||
uplay,
|
||||
/**
|
||||
* Battle.net
|
||||
*
|
||||
* Value: battlenet
|
||||
*/
|
||||
battlenet,
|
||||
/**
|
||||
* Origin
|
||||
*
|
||||
* Value: origin
|
||||
*/
|
||||
origin,
|
||||
/**
|
||||
* GOG.com
|
||||
*
|
||||
* Value: gog
|
||||
*/
|
||||
gog,
|
||||
/**
|
||||
* Epic Games Store
|
||||
*
|
||||
* Value: epic
|
||||
*/
|
||||
epic,
|
||||
/**
|
||||
* Microsoft Store
|
||||
*
|
||||
* Value: microsoft
|
||||
*/
|
||||
microsoft,
|
||||
/**
|
||||
* IGDB.com
|
||||
*
|
||||
* Value: igdb
|
||||
*/
|
||||
igdb,
|
||||
/**
|
||||
* Glyph.net
|
||||
*
|
||||
* Value: glyph
|
||||
*/
|
||||
glyph,
|
||||
/**
|
||||
* Google Play Store
|
||||
*
|
||||
* Value: google_play
|
||||
*/
|
||||
google_play,
|
||||
/**
|
||||
* NVIDIA Cloud Gaming
|
||||
*
|
||||
* Value: nvidia_gdn_app
|
||||
*/
|
||||
nvidia_gdn_app,
|
||||
/**
|
||||
* Gameopedia
|
||||
*
|
||||
* Value: gop
|
||||
*/
|
||||
gop,
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { ApplicationSKUDistributor } from "./ApplicationSKUDistributor";
|
||||
|
||||
export interface ApplicationSKUSchema {
|
||||
/**
|
||||
* The ID of the game
|
||||
*/
|
||||
id: string | null;
|
||||
/**
|
||||
* The SKU of the game
|
||||
*/
|
||||
sku: string | null;
|
||||
/**
|
||||
* The distributor of the game
|
||||
*/
|
||||
distributor: ApplicationSKUDistributor;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum ApplicationVerificationState {
|
||||
/**
|
||||
* This application is ineligible for verification
|
||||
*
|
||||
* Value: 1
|
||||
* Name: INELIGIBLE
|
||||
*/
|
||||
INELIGIBLE = 1,
|
||||
/**
|
||||
* This application has not yet been applied for verification
|
||||
*
|
||||
* Value: 2
|
||||
* Name: UNSUBMITTED
|
||||
*/
|
||||
UNSUBMITTED = 2,
|
||||
/**
|
||||
* This application has submitted a verification request
|
||||
*
|
||||
* Value: 3
|
||||
* Name: SUBMITTED
|
||||
*/
|
||||
SUBMITTED = 3,
|
||||
/**
|
||||
* This application has been verified manually from Discord staff or using the old verification process
|
||||
*
|
||||
* Value: 4
|
||||
* Name: APPROVED_MANUALLY
|
||||
*/
|
||||
APPROVED_MANUALLY = 4,
|
||||
/**
|
||||
* This application is blocked and cannot be verified
|
||||
*
|
||||
* Value: 5
|
||||
* Name: BLOCKED
|
||||
*/
|
||||
BLOCKED = 5,
|
||||
/**
|
||||
* This application has been verified automatically through the Stripe identity verification process
|
||||
*
|
||||
* Value: 6
|
||||
* Name: APPROVED_AUTOMATICALLY
|
||||
*/
|
||||
APPROVED_AUTOMATICALLY = 6,
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { SKUProductLine } from "./SKUProductLine";
|
||||
import { SKUType } from "./SKUType";
|
||||
|
||||
export interface CreateApplicationSKUSchema {
|
||||
name: string;
|
||||
sku_type: SKUType;
|
||||
// Added for spacebar as discord seems to only allow creating Application SKUs
|
||||
product_line?: SKUProductLine;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { LocalizedStringSchema } from "../../uncategorised";
|
||||
import { SKUAccessType } from "./SKUAccessType";
|
||||
import { SKUContentRatingSchema } from "./SKUContentRatingSchema";
|
||||
import { SKUFeature } from "./SKUFeature";
|
||||
import { SKUGenre } from "./SKUGenre";
|
||||
import { SKUSystemRequirementsSchema } from "./SKUSystemRequirementsSchema";
|
||||
import { SKUType } from "./SKUType";
|
||||
|
||||
export interface CreateSKUSchema {
|
||||
/**
|
||||
* The type of SKU
|
||||
*/
|
||||
type: SKUType;
|
||||
/**
|
||||
* The ID of the application the SKU belongs to
|
||||
*/
|
||||
application_id: string;
|
||||
/**
|
||||
* The name of the SKU (1-256 characters)
|
||||
*/
|
||||
name: LocalizedStringSchema | string;
|
||||
/**
|
||||
* The SKU flags (only AVAILABLE can be set)
|
||||
* SKUFlags bitfield
|
||||
*/
|
||||
flags?: number;
|
||||
/**
|
||||
* The legal notice for the SKU (max 1024 characters)
|
||||
*/
|
||||
legal_notice?: LocalizedStringSchema;
|
||||
/**
|
||||
* The ID of the prerequisite required to buy this SKU
|
||||
*/
|
||||
dependent_sku_id?: string;
|
||||
/**
|
||||
* The IDs of the SKUs that are included when purchasing this SKU
|
||||
*/
|
||||
bundled_skus?: string[];
|
||||
/**
|
||||
* The access level of the SKU
|
||||
*/
|
||||
access_type?: SKUAccessType;
|
||||
/**
|
||||
* The IDs of the manifest labels associated with the SKU
|
||||
*/
|
||||
manifest_labels?: string[];
|
||||
/**
|
||||
* The features of the SKU
|
||||
*/
|
||||
features?: SKUFeature[];
|
||||
/**
|
||||
* The locales the SKU is available in
|
||||
*/
|
||||
locales?: string[];
|
||||
/**
|
||||
* The genres of the SKU
|
||||
*/
|
||||
genres?: SKUGenre[];
|
||||
/**
|
||||
* The content ratings of the SKU per agency
|
||||
*/
|
||||
content_ratings?: { [agency: string]: SKUContentRatingSchema };
|
||||
/**
|
||||
* The system requirements for each operating system the SKU supports
|
||||
*/
|
||||
system_requirements?: { [os: string]: SKUSystemRequirementsSchema };
|
||||
/**
|
||||
* The base price of the SKU
|
||||
*/
|
||||
price_tier?: number;
|
||||
/**
|
||||
* Localized pricing overrides per lower-cased ISO 4217 currency code
|
||||
*/
|
||||
price?: { [currency: string]: number };
|
||||
/**
|
||||
* The sale price of the SKU
|
||||
*/
|
||||
sale_price_tier?: number;
|
||||
/**
|
||||
* Localized sale pricing overrides per lower-cased ISO 4217 currency code
|
||||
*/
|
||||
sale_price?: { [currency: string]: number };
|
||||
/**
|
||||
* When the SKU will be released
|
||||
*/
|
||||
release_date?: string;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum RPCApplicationState {
|
||||
/**
|
||||
* This application does not have access to RPC
|
||||
*
|
||||
* Value: 0
|
||||
* Name: DISABLED
|
||||
*/
|
||||
DISABLED = 0,
|
||||
/**
|
||||
* This application has not yet been applied for RPC access
|
||||
*
|
||||
* Value: 1
|
||||
* Name: UNSUBMITTED
|
||||
*/
|
||||
UNSUBMITTED = 1,
|
||||
/**
|
||||
* This application has submitted a RPC access request
|
||||
*
|
||||
* Value: 2
|
||||
* Name: SUBMITTED
|
||||
*/
|
||||
SUBMITTED = 2,
|
||||
/**
|
||||
* This application has been approved for RPC access
|
||||
*
|
||||
* Value: 3
|
||||
* Name: APPROVED
|
||||
*/
|
||||
APPROVED = 3,
|
||||
/**
|
||||
* This application has been rejected from RPC access
|
||||
*
|
||||
* Value: 4
|
||||
* Name: REJECTED
|
||||
*/
|
||||
REJECTED = 4,
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BillingPaymentGateway, LocalizedStringSchema } from "@spacebar/schemas";
|
||||
import { Application } from "@spacebar/util";
|
||||
import { SKUAccessType } from "./SKUAccessType";
|
||||
import { SKUContentRatingAgency } from "./SKUContentRatingAgency";
|
||||
import { SKUContentRatingSchema } from "./SKUContentRatingSchema";
|
||||
import { SKUExternalSKUStrategySchema } from "./SKUExternalSKUStrategySchema";
|
||||
import { SKUFeature } from "./SKUFeature";
|
||||
import { SKUGenre } from "./SKUGenre";
|
||||
import { SKUGuildPowerupMetadataSchema } from "./SKUGuildPowerupMetadataSchema";
|
||||
import { SKUOperatingSystem } from "./SKUOperatingSystem";
|
||||
import { SKUPriceSchema } from "./SKUPriceSchema";
|
||||
import { SKUProductLine } from "./SKUProductLine";
|
||||
import { SKUSystemRequirementsSchema } from "./SKUSystemRequirementsSchema";
|
||||
import { SKUTenantMetadataSchema } from "./SKUTenantMetadataSchema";
|
||||
import { SKUType } from "./SKUType";
|
||||
|
||||
export interface SKUSchema {
|
||||
id: string;
|
||||
type: SKUType;
|
||||
application_id: string;
|
||||
application?: Partial<Application>;
|
||||
product_line: SKUProductLine | null;
|
||||
product_id?: string;
|
||||
flags: bigint; // SKUFlags
|
||||
name: LocalizedStringSchema;
|
||||
summary?: LocalizedStringSchema;
|
||||
description?: LocalizedStringSchema;
|
||||
legal_notice?: LocalizedStringSchema;
|
||||
slug: string;
|
||||
thumbnail_asset_id?: string;
|
||||
dependent_sku_id?: string | null;
|
||||
bundled_skus?: SKUSchema[];
|
||||
bundled_sku_ids?: string[];
|
||||
access_type: SKUAccessType;
|
||||
manifest_labels?: string[] | null;
|
||||
features: SKUFeature[];
|
||||
locales?: string[];
|
||||
genres?: SKUGenre[];
|
||||
available_regions?: string[];
|
||||
content_rating?: SKUContentRatingSchema;
|
||||
content_rating_agency?: SKUContentRatingAgency;
|
||||
content_ratings?: Record<SKUContentRatingAgency, SKUContentRatingSchema>;
|
||||
system_requirements?: Record<SKUOperatingSystem, SKUSystemRequirementsSchema>;
|
||||
price?: SKUPriceSchema | Record<string, unknown>; // discord.food says map[string, integer] but i dont think thats true, its probably SKUPriceSchema
|
||||
sale_price_tier?: number;
|
||||
sale_price?: Record<string, unknown>; // same here, discord.food says map[string, integer] which i dont believe
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
release_date?: string;
|
||||
preorder_approximate_release_date?: string;
|
||||
preorder_released_at?: string;
|
||||
external_purchase_url?: string;
|
||||
external_sku_strategies?: Record<BillingPaymentGateway, SKUExternalSKUStrategySchema>;
|
||||
eligible_payment_gateways?: BillingPaymentGateway[];
|
||||
premium: boolean;
|
||||
show_age_gate: boolean;
|
||||
restricted?: boolean;
|
||||
exclusive?: boolean;
|
||||
deleted?: boolean;
|
||||
tenant_metadata?: SKUTenantMetadataSchema;
|
||||
powerup_metadata?: SKUGuildPowerupMetadataSchema;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum StoreApplicationState {
|
||||
/**
|
||||
* This application does not have a commerce license
|
||||
*
|
||||
* Value: 1
|
||||
* Name: NONE
|
||||
*/
|
||||
NONE = 1,
|
||||
/**
|
||||
* This application has a commerce license but has not yet submitted a store approval request
|
||||
*
|
||||
* Value: 2
|
||||
* Name: PAID
|
||||
*/
|
||||
PAID = 2,
|
||||
/**
|
||||
* This application has submitted a store approval request
|
||||
*
|
||||
* Value: 3
|
||||
* Name: SUBMITTED
|
||||
*/
|
||||
SUBMITTED = 3,
|
||||
/**
|
||||
* This application has been approved for the store
|
||||
*
|
||||
* Value: 4
|
||||
* Name: APPROVED
|
||||
*/
|
||||
APPROVED = 4,
|
||||
/**
|
||||
* This application has been rejected from the store
|
||||
*
|
||||
* Value: 5
|
||||
* Name: REJECTED
|
||||
*/
|
||||
REJECTED = 5,
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export interface StoreAssetSchema {
|
||||
/**
|
||||
* The ID of the asset
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The size of the asset in bytes
|
||||
*/
|
||||
size: number;
|
||||
/**
|
||||
* The asset's media type
|
||||
*/
|
||||
mime_type: string;
|
||||
/**
|
||||
* The filename of the asset
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* The width of the asset in pixels
|
||||
*/
|
||||
width: number;
|
||||
/**
|
||||
* The height of the asset in pixels
|
||||
*/
|
||||
height: number;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { StoreListingIconSchema } from "./StoreListingIconSchema";
|
||||
|
||||
export interface StoreListingBenefitSchema {
|
||||
/**
|
||||
* The ID of the benefit
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The name of the benefit
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The description of the benefit
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* The icon for the benefit
|
||||
*/
|
||||
icon: StoreListingIconSchema;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
export enum StoreListingIconType {
|
||||
/**
|
||||
* Icon is a store asset
|
||||
*
|
||||
* Value: 1
|
||||
* Name: STORE_ASSET
|
||||
*/
|
||||
STORE_ASSET = 1,
|
||||
/**
|
||||
* Icon is a unicode emoji
|
||||
*
|
||||
* Value: 2
|
||||
* Name: EMOJI
|
||||
*/
|
||||
EMOJI = 2,
|
||||
}
|
||||
|
||||
export interface StoreListingIconSchema {
|
||||
/**
|
||||
* The type of icon
|
||||
*/
|
||||
type: StoreListingIconType;
|
||||
/**
|
||||
* The store asset ID for the icon
|
||||
*/
|
||||
store_asset_id: string;
|
||||
/**
|
||||
* The unicode emoji for the icon
|
||||
*/
|
||||
emoji: string;
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Guild, SKU } from "@spacebar/util";
|
||||
import { LocalizedStringSchema } from "../../uncategorised";
|
||||
import { SKUGuildPowerupMetadataSchema } from "./SKUGuildPowerupMetadataSchema";
|
||||
import { StoreAssetSchema } from "./StoreAssetSchema";
|
||||
import { StoreCarouselItemSchema } from "./StoreCarouselItemSchema";
|
||||
import { StoreListingBenefitSchema } from "./StoreListingBenefitSchema";
|
||||
import { StoreNoteSchema } from "./StoreNoteSchema";
|
||||
|
||||
/**
|
||||
* Store listing objects can either be localized or unlocalized. Localized listings only serialize strings and pricing for the user's location, while unlocalized listings serialize all strings and pricing for all locales. All objects serialized in the listing inherit this behavior.
|
||||
*/
|
||||
export interface StoreListingSchema {
|
||||
/**
|
||||
* The ID of the listing
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The SKU associated with the listing
|
||||
*/
|
||||
sku: SKU;
|
||||
/**
|
||||
* The child SKUs associated with the category listing
|
||||
*/
|
||||
child_skus?: SKU[];
|
||||
/**
|
||||
* Alternative SKUs for the listing
|
||||
*/
|
||||
alternative_skus?: SKU[];
|
||||
/**
|
||||
* A summary of the listing
|
||||
*/
|
||||
summary: LocalizedStringSchema;
|
||||
/**
|
||||
* A description of the listing
|
||||
*/
|
||||
description?: LocalizedStringSchema;
|
||||
/**
|
||||
* A tagline for the listing
|
||||
*/
|
||||
tagline?: LocalizedStringSchema | null;
|
||||
/**
|
||||
* Flavor text for the listing
|
||||
*/
|
||||
flavor_text?: string | null;
|
||||
/**
|
||||
* The benefits of the listing
|
||||
*/
|
||||
benefits?: StoreListingBenefitSchema[];
|
||||
/**
|
||||
* Whether the listing is published
|
||||
*/
|
||||
published?: boolean;
|
||||
/**
|
||||
* The carousel items for the listing
|
||||
*/
|
||||
carousel_items?: StoreCarouselItemSchema[];
|
||||
/**
|
||||
* Notes from staff about the listing
|
||||
*/
|
||||
staff_notes?: StoreNoteSchema;
|
||||
/**
|
||||
* The public guild associated with the listing
|
||||
*/
|
||||
guild?: Partial<Guild> | null;
|
||||
/**
|
||||
* The store assets for the listing
|
||||
*/
|
||||
assets?: StoreAssetSchema[];
|
||||
/**
|
||||
* The thumbnail for the listing
|
||||
*/
|
||||
thumbnail?: StoreAssetSchema;
|
||||
/**
|
||||
* The preview video for the listing
|
||||
*/
|
||||
preview_video?: StoreAssetSchema;
|
||||
/**
|
||||
* The header background for the listing
|
||||
*/
|
||||
header_background?: StoreAssetSchema;
|
||||
/**
|
||||
* The dark theme header logo for the listing
|
||||
*/
|
||||
header_logo_dark_theme?: StoreAssetSchema;
|
||||
/**
|
||||
* The light theme header logo for the listing
|
||||
*/
|
||||
header_logo_light_theme?: StoreAssetSchema;
|
||||
/**
|
||||
* The box art for the listing
|
||||
*/
|
||||
box_art?: StoreAssetSchema;
|
||||
/**
|
||||
* The hero background for the listing
|
||||
*/
|
||||
hero_background?: StoreAssetSchema;
|
||||
/**
|
||||
* The hero video for the listing
|
||||
*/
|
||||
hero_video?: StoreAssetSchema;
|
||||
/**
|
||||
* The application branch ID granted by the listing
|
||||
*/
|
||||
entitlement_branch_id?: string | null;
|
||||
/**
|
||||
* When the listing was published
|
||||
*/
|
||||
published_at?: string;
|
||||
/**
|
||||
* When the listing was unpublished
|
||||
*/
|
||||
unpublished_at?: string;
|
||||
/**
|
||||
* The guild powerup metadata for the listing
|
||||
*/
|
||||
powerup_metadata?: Partial<SKUGuildPowerupMetadataSchema>;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { User } from "@spacebar/util";
|
||||
|
||||
export interface StoreNoteSchema {
|
||||
/**
|
||||
* The user who made the note
|
||||
*/
|
||||
user: Partial<User> | null;
|
||||
/**
|
||||
* The note content
|
||||
*/
|
||||
content: string;
|
||||
}
|
||||
@@ -37,7 +37,6 @@ export * from "./SKUPEGIContentRating";
|
||||
export * from "./SKUPremiumPriceSchema";
|
||||
export * from "./SKUPriceSchema";
|
||||
export * from "./SKUProductLine";
|
||||
export * from "./SKUSchema";
|
||||
export * from "./SKUSystemRequirementSchema";
|
||||
export * from "./SKUSystemRequirementsSchema";
|
||||
export * from "./SKUTenantMetadataSchema";
|
||||
@@ -68,3 +67,26 @@ export * from "./CollectibleProfileEffectAnimationType";
|
||||
export * from "./CollectibleNameplateColorPalette";
|
||||
export * from "./SortedSKUIDsSchema";
|
||||
export * from "./SubscriptionPlanPurchaseType";
|
||||
export * from "./CreateApplicationSKUSchema";
|
||||
export * from "./StoreAssetSchema";
|
||||
export * from "./StoreListingSchema";
|
||||
export * from "./StoreListingIconSchema";
|
||||
export * from "./StoreListingBenefitSchema";
|
||||
export * from "./StoreNoteSchema";
|
||||
export * from "./ApplicationExecutableSchema";
|
||||
export * from "./ApplicationSKUSchema";
|
||||
export * from "./ApplicationSKUDistributor";
|
||||
export * from "./ApplicationCompanySchema";
|
||||
export * from "./ApplicationGuildRestriction";
|
||||
export * from "./ApplicationInteractionsVersion";
|
||||
export * from "./ApplicationEventWebhooksStatus";
|
||||
export * from "./ApplicationEventWebhooksType";
|
||||
export * from "./ApplicationIntegrationTypeConfigurationSchema";
|
||||
export * from "./ApplicationInstallParamsSchema";
|
||||
export * from "./ApplicationVerificationState";
|
||||
export * from "./StoreApplicationState";
|
||||
export * from "./RPCApplicationState";
|
||||
export * from "./ApplicationDiscoverabilityState";
|
||||
export * from "./ApplicationMonetizationState";
|
||||
export * from "./ApplicationApprovableConsoleType";
|
||||
export * from "./CreateSKUSchema";
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2025 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { StoreListingSchema } from "@spacebar/schemas";
|
||||
import { SKU } from "../../util";
|
||||
|
||||
export interface CreateApplicationSKUResponseSchema {
|
||||
skus: SKU[];
|
||||
store_listings: StoreListingSchema[];
|
||||
}
|
||||
@@ -72,3 +72,4 @@ export * from "./UserRelationsResponse";
|
||||
export * from "./VirtualCurrencyResponseSchema";
|
||||
export * from "./WebAuthnCreateResponse";
|
||||
export * from "./WebhookCreateResponse";
|
||||
export * from "./CreateApplicationSKUResponseSchema";
|
||||
|
||||
@@ -18,5 +18,5 @@
|
||||
|
||||
export interface LocalizedStringSchema {
|
||||
default: string;
|
||||
localizations?: Record<string, string>;
|
||||
localizations?: { [key: string]: string };
|
||||
}
|
||||
|
||||
@@ -21,6 +21,22 @@ import { BaseClass } from "./BaseClass";
|
||||
import { Team } from "./Team";
|
||||
import { User } from "./User";
|
||||
import { Guild } from "./Guild";
|
||||
import {
|
||||
ApplicationApprovableConsoleType,
|
||||
ApplicationCompanySchema,
|
||||
ApplicationDiscoverabilityState,
|
||||
ApplicationEventWebhooksStatus,
|
||||
ApplicationEventWebhooksType,
|
||||
ApplicationExecutableSchema,
|
||||
ApplicationGuildRestriction,
|
||||
ApplicationIntegrationTypeConfigurationSchema,
|
||||
ApplicationInteractionsVersion,
|
||||
ApplicationMonetizationState,
|
||||
ApplicationSKUSchema,
|
||||
ApplicationVerificationState,
|
||||
RPCApplicationState,
|
||||
StoreApplicationState,
|
||||
} from "@spacebar/schemas";
|
||||
|
||||
@Entity({
|
||||
name: "applications",
|
||||
@@ -45,9 +61,11 @@ export class Application extends BaseClass {
|
||||
hook: boolean = true;
|
||||
|
||||
@Column()
|
||||
// deprecated
|
||||
bot_public?: boolean = true;
|
||||
|
||||
@Column()
|
||||
// deprecated
|
||||
bot_require_code_grant?: boolean = false;
|
||||
|
||||
@Column()
|
||||
@@ -57,21 +75,21 @@ export class Application extends BaseClass {
|
||||
@ManyToOne(() => User, { onDelete: "CASCADE" })
|
||||
owner: User;
|
||||
|
||||
// TODO: enum this? https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
@Column()
|
||||
// ApplicationFlags bitfield
|
||||
flags: number = 0;
|
||||
|
||||
@Column({ type: "simple-array", nullable: true })
|
||||
redirect_uris: string[] = [];
|
||||
|
||||
@Column({ nullable: true })
|
||||
rpc_application_state: number = 0;
|
||||
@Column()
|
||||
rpc_application_state: RPCApplicationState = RPCApplicationState.DISABLED;
|
||||
|
||||
@Column({ nullable: true })
|
||||
store_application_state: number = 1;
|
||||
@Column()
|
||||
store_application_state: StoreApplicationState = StoreApplicationState.NONE;
|
||||
|
||||
@Column({ nullable: true })
|
||||
verification_state: number = 1;
|
||||
@Column()
|
||||
verification_state: ApplicationVerificationState = ApplicationVerificationState.INELIGIBLE;
|
||||
|
||||
@Column({ nullable: true })
|
||||
interactions_endpoint_url?: string;
|
||||
@@ -83,10 +101,10 @@ export class Application extends BaseClass {
|
||||
integration_require_code_grant: boolean = false;
|
||||
|
||||
@Column({ nullable: true })
|
||||
discoverability_state: number = 1;
|
||||
discoverability_state: ApplicationDiscoverabilityState = ApplicationDiscoverabilityState.INELIGIBLE;
|
||||
|
||||
@Column({ nullable: true })
|
||||
discovery_eligibility_flags: number = 2240;
|
||||
discovery_eligibility_flags: number = 0; // ApplicationDiscoveryEligibilityFlags bitfield
|
||||
|
||||
@JoinColumn({ name: "bot_user_id" })
|
||||
@OneToOne(() => User, { onDelete: "CASCADE" })
|
||||
@@ -118,16 +136,131 @@ export class Application extends BaseClass {
|
||||
@Column({ nullable: true })
|
||||
custom_install_url?: string;
|
||||
|
||||
//just for us
|
||||
@Column({ nullable: true })
|
||||
splash?: string;
|
||||
|
||||
//@Column({ type: "simple-array", nullable: true })
|
||||
//rpc_origins?: string[];
|
||||
@Column({ nullable: true })
|
||||
primary_sku_id?: string; // if this application is a game sold, this field will be the id of the "Game SKU" that is created,
|
||||
|
||||
//@Column({ nullable: true })
|
||||
//primary_sku_id?: string; // if this application is a game sold, this field will be the id of the "Game SKU" that is created,
|
||||
@Column({ nullable: true })
|
||||
eula_id?: string;
|
||||
|
||||
//@Column({ nullable: true })
|
||||
//slug?: string; // if this application is a game sold, this field will be the URL slug that links to the store page
|
||||
@Column({ nullable: true })
|
||||
slug?: string; // if this application is a game sold, this field will be the URL slug that links to the store page
|
||||
|
||||
@Column({ type: "simple-array", nullable: true })
|
||||
aliases?: string[];
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
executables?: ApplicationExecutableSchema[];
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
third_party_skus?: ApplicationSKUSchema[];
|
||||
|
||||
@Column({ nullable: true })
|
||||
overlay?: boolean = false;
|
||||
|
||||
@Column({ nullable: true })
|
||||
overlay_methods?: number; // only one right now is 1 << 0 OUT_OF_PROCESS
|
||||
|
||||
@Column({ nullable: true })
|
||||
overlay_warn?: boolean = false;
|
||||
|
||||
@Column({ nullable: true })
|
||||
overlay_compatibility_hook?: boolean = false;
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
developers?: ApplicationCompanySchema[];
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
publishers?: ApplicationCompanySchema[];
|
||||
|
||||
@Column({ type: "simple-array", nullable: true })
|
||||
rpc_origins?: string[];
|
||||
|
||||
@Column({ nullable: true })
|
||||
deeplink_uri?: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
bot_disabled?: boolean = false;
|
||||
|
||||
@Column({ nullable: true })
|
||||
bot_quarantined?: boolean = false;
|
||||
|
||||
@Column({ nullable: true })
|
||||
bot_approximate_guild_count?: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
approximate_guild_count?: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
approximate_user_install_count?: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
approximate_user_authorization_count?: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
internal_guild_restriction?: ApplicationGuildRestriction;
|
||||
|
||||
@Column({ nullable: true, type: "text" })
|
||||
role_connections_verification_url: string | null = null;
|
||||
|
||||
@Column()
|
||||
interactions_version: ApplicationInteractionsVersion = ApplicationInteractionsVersion.VERSION_1;
|
||||
|
||||
@Column({ type: "simple-array" })
|
||||
interactions_event_types: ApplicationEventWebhooksType[] = [];
|
||||
|
||||
@Column({ nullable: true })
|
||||
event_webhooks_status?: ApplicationEventWebhooksStatus;
|
||||
|
||||
@Column({ nullable: true })
|
||||
event_webhooks_url?: string;
|
||||
|
||||
@Column({ type: "simple-array", nullable: true })
|
||||
event_webhooks_types?: ApplicationEventWebhooksType[];
|
||||
|
||||
@Column()
|
||||
explicit_content_filter: number = 0; // Inherits the guild's explicit content filter
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
integration_types_config?: Record<number, ApplicationIntegrationTypeConfigurationSchema>;
|
||||
|
||||
@Column({ nullable: true })
|
||||
connection_entrypoint_url?: string;
|
||||
|
||||
@Column()
|
||||
is_verified: boolean = false;
|
||||
|
||||
@Column()
|
||||
creator_monetization_state: number = 0; // unknown values
|
||||
|
||||
@Column()
|
||||
is_discoverable: boolean = false;
|
||||
|
||||
@Column()
|
||||
is_monetized: boolean = false;
|
||||
|
||||
@Column()
|
||||
storefront_available: boolean = false;
|
||||
|
||||
@Column()
|
||||
monetization_state: ApplicationMonetizationState = ApplicationMonetizationState.NONE;
|
||||
|
||||
@Column({ nullable: true })
|
||||
monetization_eligibility_flags?: number = 0; // ApplicationMonetizationEligibilityFlags
|
||||
|
||||
@Column({ nullable: true })
|
||||
max_participants?: number; // max participants for embedded applications, -1 for unlimited
|
||||
|
||||
@Column({ type: "simple-json", nullable: true })
|
||||
embedded_activity_config?: object; // dont feel like making types for this rn
|
||||
|
||||
@Column({ type: "simple-array" })
|
||||
approved_consoles: ApplicationApprovableConsoleType[] = [];
|
||||
|
||||
// @Column()
|
||||
// pricing_localization_strategy: string;
|
||||
|
||||
@JoinColumn({ name: "team_id" })
|
||||
@ManyToOne(() => Team, {
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BaseEntity, Column, Entity, JoinColumn, ManyToOne, OneToMany, Unique } from "typeorm";
|
||||
import { BaseClass } from "./BaseClass";
|
||||
import { User } from "./User";
|
||||
import { Application } from "./Application";
|
||||
import {
|
||||
BillingPaymentGateway,
|
||||
CreateSKUSchema,
|
||||
LocalizedStringSchema,
|
||||
SKUAccessType,
|
||||
SKUContentRatingAgency,
|
||||
SKUContentRatingSchema,
|
||||
SKUExternalSKUStrategySchema,
|
||||
SKUFeature,
|
||||
SKUGenre,
|
||||
SKUOperatingSystem,
|
||||
SKUPriceSchema,
|
||||
SKUProductLine,
|
||||
SKUSystemRequirementsSchema,
|
||||
SKUTenantMetadataSchema,
|
||||
SKUType,
|
||||
} from "@spacebar/schemas";
|
||||
import { SKUGuildPowerupMetadataSchema } from "../../schemas/api/store/SKUGuildPowerupMetadataSchema";
|
||||
import { slugify } from "../util";
|
||||
|
||||
@Entity({
|
||||
name: "skus",
|
||||
})
|
||||
export class SKU extends BaseClass {
|
||||
@Column()
|
||||
type: SKUType;
|
||||
|
||||
@Column()
|
||||
application_id: string;
|
||||
|
||||
@JoinColumn({ name: "application_id" })
|
||||
@ManyToOne(() => Application, { onDelete: "CASCADE" })
|
||||
application: Application;
|
||||
|
||||
@Column()
|
||||
product_line: SKUProductLine;
|
||||
|
||||
@Column()
|
||||
product_id?: string;
|
||||
|
||||
@Column({ type: "bigint" })
|
||||
flags: number = 0; // SKUFlags
|
||||
|
||||
@Column({ type: "simple-json" })
|
||||
name: LocalizedStringSchema;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
summary?: LocalizedStringSchema;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
description?: LocalizedStringSchema;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
legal_notice?: LocalizedStringSchema;
|
||||
|
||||
@Column()
|
||||
slug: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
thumbnail_asset_id?: string;
|
||||
|
||||
@Column({ nullable: true, type: "text" })
|
||||
dependent_sku_id?: string | null;
|
||||
|
||||
@JoinColumn({ name: "bundled_sku_ids" })
|
||||
@OneToMany(() => SKU, (sku: SKU) => sku.id, {
|
||||
cascade: true,
|
||||
orphanedRowAction: "delete",
|
||||
onDelete: "CASCADE",
|
||||
})
|
||||
bundled_skus?: SKU[];
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
bundled_sku_ids?: string[];
|
||||
|
||||
@Column()
|
||||
access_type: SKUAccessType;
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
manifest_labels?: string[] | null;
|
||||
|
||||
@Column({ type: "simple-array" })
|
||||
features: SKUFeature[];
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
locales?: string[];
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
genres?: SKUGenre[];
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
available_regions?: string[];
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
// only for localized skus
|
||||
content_rating?: SKUContentRatingSchema;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
// only for localized skus
|
||||
content_rating_agency?: SKUContentRatingAgency;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
// only for unlocalized skus
|
||||
content_ratings?: Record<SKUContentRatingAgency, SKUContentRatingSchema>;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
system_requirements?: Record<SKUOperatingSystem, SKUSystemRequirementsSchema>;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
// used for localized skus
|
||||
price?: SKUPriceSchema | Record<string, unknown>; // discord.food says map[string, integer] but i dont think thats true, its probably SKUPriceSchema
|
||||
|
||||
@Column({ nullable: true })
|
||||
// used for unlocalized skus
|
||||
price_tier?: number;
|
||||
|
||||
@Column({ nullable: true })
|
||||
// used for unlocalized skus
|
||||
sale_price_tier?: number;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
// used for localized skus
|
||||
sale_price?: Record<string, unknown>; // same here, discord.food says map[string, integer] which i dont believe
|
||||
|
||||
@Column()
|
||||
created_at: Date;
|
||||
|
||||
@Column()
|
||||
updated_at: Date;
|
||||
|
||||
@Column({ nullable: true, type: Date })
|
||||
release_date?: Date | null;
|
||||
|
||||
@Column({ nullable: true })
|
||||
preorder_approximate_release_date?: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
preorder_released_at?: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
external_purchase_url?: string;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
external_sku_strategies?: Record<BillingPaymentGateway, SKUExternalSKUStrategySchema>;
|
||||
|
||||
@Column({ nullable: true, type: "simple-array" })
|
||||
eligible_payment_gateways?: BillingPaymentGateway[];
|
||||
|
||||
@Column()
|
||||
premium: boolean;
|
||||
|
||||
@Column()
|
||||
show_age_gate: boolean;
|
||||
|
||||
@Column({ nullable: true })
|
||||
// only for localized skus
|
||||
restricted?: boolean;
|
||||
|
||||
@Column({ nullable: true })
|
||||
exclusive?: boolean;
|
||||
|
||||
@Column({ nullable: true, default: false })
|
||||
deleted?: boolean = false;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
tenant_metadata?: SKUTenantMetadataSchema;
|
||||
|
||||
@Column({ nullable: true, type: "simple-json" })
|
||||
powerup_metadata?: SKUGuildPowerupMetadataSchema;
|
||||
|
||||
static async createSku(data: CreateSKUSchema): Promise<SKU> {
|
||||
const n = {
|
||||
...data,
|
||||
bundled_skus: undefined,
|
||||
name: undefined,
|
||||
slug: undefined,
|
||||
};
|
||||
|
||||
// convert string to localized string or use as is
|
||||
const name = typeof data.name === "string" ? { default: data.name } : data.name;
|
||||
|
||||
const sku = await SKU.create({
|
||||
product_line: SKUProductLine.APPLICATION,
|
||||
dependent_sku_id: null,
|
||||
manifest_labels: null,
|
||||
access_type: SKUAccessType.FULL,
|
||||
features: [],
|
||||
release_date: null,
|
||||
premium: false,
|
||||
flags: 0,
|
||||
show_age_gate: false,
|
||||
tenant_metadata: {},
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
...n,
|
||||
bundled_sku_ids: data.bundled_skus,
|
||||
name,
|
||||
slug: slugify(name.default),
|
||||
});
|
||||
|
||||
return sku;
|
||||
}
|
||||
}
|
||||
@@ -62,3 +62,4 @@ export * from "./UserSettingsProtos";
|
||||
export * from "./ValidRegistrationTokens";
|
||||
export * from "./VoiceState";
|
||||
export * from "./Webhook";
|
||||
export * from "./SKU";
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class ApplicationDiscoveryEligibilityFlags extends BitField {
|
||||
static FLAGS = {
|
||||
VERIFIED: BigInt(1) << BigInt(0),
|
||||
TAG: BigInt(1) << BigInt(1),
|
||||
DESCRIPTION: BigInt(1) << BigInt(2),
|
||||
TERMS_OF_SERVICE: BigInt(1) << BigInt(3),
|
||||
PRIVACY_POLICY: BigInt(1) << BigInt(4),
|
||||
INSTALL_PARAMS: BigInt(1) << BigInt(5),
|
||||
SAFE_NAME: BigInt(1) << BigInt(6),
|
||||
SAFE_DESCRIPTION: BigInt(1) << BigInt(7),
|
||||
APPROVED_COMMANDS: BigInt(1) << BigInt(8),
|
||||
SUPPORT_GUILD: BigInt(1) << BigInt(9),
|
||||
SAFE_COMMANDS: BigInt(1) << BigInt(10),
|
||||
MFA: BigInt(1) << BigInt(11),
|
||||
SAFE_DIRECTORY_OVERVIEW: BigInt(1) << BigInt(12),
|
||||
SUPPORTED_LOCALES: BigInt(1) << BigInt(13),
|
||||
SAFE_SHORT_DESCRIPTION: BigInt(1) << BigInt(14),
|
||||
SAFE_ROLE_CONNECTIONS: BigInt(1) << BigInt(15),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class ApplicationFlags extends BitField {
|
||||
static FLAGS = {
|
||||
EMBEDDED_RELEASED: BigInt(1) << BigInt(1),
|
||||
MANAGED_EMOJI: BigInt(1) << BigInt(2),
|
||||
EMBEDDED_IAP: BigInt(1) << BigInt(3),
|
||||
GROUP_DM_CREATE: BigInt(1) << BigInt(4),
|
||||
RPC_PRIVATE_BETA: BigInt(1) << BigInt(5),
|
||||
AUTO_MODERATION_RULE_CREATE_BADGE: BigInt(1) << BigInt(6),
|
||||
GAME_PROFILE_DISABLED: BigInt(1) << BigInt(7),
|
||||
PUBLIC_OAUTH2_CLIENT: BigInt(1) << BigInt(8),
|
||||
CONTEXTLESS_ACTIVITY: BigInt(1) << BigInt(9),
|
||||
SOCIAL_LAYER_INTEGRATION_LIMITED: BigInt(1) << BigInt(10),
|
||||
CLOUD_GAMING_DEMO: BigInt(1) << BigInt(11),
|
||||
GATEWAY_PRESENCE: BigInt(1) << BigInt(12),
|
||||
GATEWAY_PRESENCE_LIMITED: BigInt(1) << BigInt(13),
|
||||
GATEWAY_GUILD_MEMBERS: BigInt(1) << BigInt(14),
|
||||
GATEWAY_GUILD_MEMBERS_LIMITED: BigInt(1) << BigInt(15),
|
||||
VERIFICATION_PENDING_GUILD_LIMIT: BigInt(1) << BigInt(16),
|
||||
EMBEDDED: BigInt(1) << BigInt(17),
|
||||
GATEWAY_MESSAGE_CONTENT: BigInt(1) << BigInt(18),
|
||||
GATEWAY_MESSAGE_CONTENT_LIMITED: BigInt(1) << BigInt(19),
|
||||
EMBEDDED_FIRST_PARTY: BigInt(1) << BigInt(20),
|
||||
APPLICATION_COMMAND_MIGRATED: BigInt(1) << BigInt(21),
|
||||
APPLICATION_COMMAND_BADGE: BigInt(1) << BigInt(23),
|
||||
ACTIVE: BigInt(1) << BigInt(24),
|
||||
ACTIVE_GRACE_PERIOD: BigInt(1) << BigInt(25),
|
||||
IFRAME_MODAL: BigInt(1) << BigInt(26),
|
||||
SOCIAL_LAYER_INTEGRATION: BigInt(1) << BigInt(27),
|
||||
PROMOTED: BigInt(1) << BigInt(29),
|
||||
PARTNER: BigInt(1) << BigInt(30),
|
||||
PARENT: BigInt(1) << BigInt(33),
|
||||
DISABLE_RELATIONSHIP_ACCESS: BigInt(1) << BigInt(34),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Spacebar: A FOSS re-implementation and extension of the Discord.com backend.
|
||||
Copyright (C) 2023 Spacebar and Spacebar Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { BitField } from "./BitField";
|
||||
|
||||
export class ApplicationMonetizationEligibilityFlags extends BitField {
|
||||
static FLAGS = {
|
||||
VERIFIED: BigInt(1) << BigInt(0),
|
||||
HAS_TEAM: BigInt(1) << BigInt(1),
|
||||
APPROVED_COMMANDS: BigInt(1) << BigInt(2),
|
||||
TERMS_OF_SERVICE: BigInt(1) << BigInt(3),
|
||||
PRIVACY_POLICY: BigInt(1) << BigInt(4),
|
||||
SAFE_NAME: BigInt(1) << BigInt(5),
|
||||
SAFE_DESCRIPTION: BigInt(1) << BigInt(6),
|
||||
SAFE_ROLE_CONNECTIONS: BigInt(1) << BigInt(7),
|
||||
USER_IS_TEAM_OWNER: BigInt(1) << BigInt(8),
|
||||
NOT_QUARANTINED: BigInt(1) << BigInt(9),
|
||||
USER_LOCALE_SUPPORTED: BigInt(1) << BigInt(10),
|
||||
USER_AGE_SUPPORTED: BigInt(1) << BigInt(11),
|
||||
USER_DATE_OF_BIRTH_DEFINED: BigInt(1) << BigInt(12),
|
||||
USER_MFA_ENABLED: BigInt(1) << BigInt(13),
|
||||
USER_EMAIL_VERIFIED: BigInt(1) << BigInt(14),
|
||||
TEAM_MEMBERS_EMAIL_VERIFIED: BigInt(1) << BigInt(15),
|
||||
TEAM_MEMBERS_MFA_ENABLED: BigInt(1) << BigInt(16),
|
||||
NO_BLOCKING_ISSUES: BigInt(1) << BigInt(17),
|
||||
VALID_PAYOUT_STATUS: BigInt(1) << BigInt(18),
|
||||
};
|
||||
}
|
||||
@@ -56,3 +56,7 @@ export * from "./Random";
|
||||
export * from "./Url";
|
||||
export * from "./SKUFlags";
|
||||
export * from "./EntitlementGiftCodeFlags";
|
||||
export * from "./slugify";
|
||||
export * from "./ApplicationDiscoveryEligibilityFlags";
|
||||
export * from "./ApplicationFlags";
|
||||
export * from "./ApplicationMonetizationEligibilityFlags";
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
export function slugify(text: string): string {
|
||||
// return as url friendly slug
|
||||
return text
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.trim()
|
||||
.replace(/\s+/g, "-")
|
||||
.replace(/[^\w\\-]+/g, "")
|
||||
.replace(/\\-\\-+/g, "-");
|
||||
}
|
||||
Reference in New Issue
Block a user