topgg-api-types 0.0.7 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/v1/validators.cjs +6 -9
- package/dist/v1/validators.cjs.map +1 -1
- package/dist/v1/validators.d.cts +13 -8
- package/dist/v1/validators.d.ts +13 -8
- package/dist/v1/validators.js +5 -9
- package/dist/v1/validators.js.map +1 -1
- package/dist/v1.d.cts +1 -1
- package/dist/v1.d.ts +1 -1
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -14,7 +14,7 @@ exports.IntegrationCreateResponseSchema = require_v1_validators.IntegrationCreat
|
|
|
14
14
|
exports.IntegrationCreateWebhookPayloadSchema = require_v1_validators.IntegrationCreateWebhookPayloadSchema;
|
|
15
15
|
exports.IntegrationDeleteDataSchema = require_v1_validators.IntegrationDeleteDataSchema;
|
|
16
16
|
exports.IntegrationDeleteWebhookPayloadSchema = require_v1_validators.IntegrationDeleteWebhookPayloadSchema;
|
|
17
|
-
exports.
|
|
17
|
+
exports.IntegrationWebhookEventTypeSchema = require_v1_validators.IntegrationWebhookEventTypeSchema;
|
|
18
18
|
exports.ProjectPlatformTypeSchema = require_v1_validators.ProjectPlatformTypeSchema;
|
|
19
19
|
exports.ProjectTypeSchema = require_v1_validators.ProjectTypeSchema;
|
|
20
20
|
exports.ProjectVoteSchema = require_v1_validators.ProjectVoteSchema;
|
|
@@ -25,6 +25,7 @@ exports.VoteCreateDataSchema = require_v1_validators.VoteCreateDataSchema;
|
|
|
25
25
|
exports.VoteCreateWebhookPayloadSchema = require_v1_validators.VoteCreateWebhookPayloadSchema;
|
|
26
26
|
exports.VoteSchema = require_v1_validators.VoteSchema;
|
|
27
27
|
exports.WebhookEventTypeSchema = require_v1_validators.WebhookEventTypeSchema;
|
|
28
|
+
exports.WebhookEventTypesSchema = require_v1_validators.WebhookEventTypesSchema;
|
|
28
29
|
exports.WebhookPayloadBaseSchema = require_v1_validators.WebhookPayloadBaseSchema;
|
|
29
30
|
exports.WebhookPayloadSchema = require_v1_validators.WebhookPayloadSchema;
|
|
30
31
|
exports.WebhookTestDataSchema = require_v1_validators.WebhookTestDataSchema;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BaseProject, ErrorResponse, GetProjectResponse, GetProjectVotesQuery, GetProjectVotesResponse, GetVoteStatusByUserQuery, GetVoteStatusByUserResponse, IntegrationCreateData, IntegrationCreateResponse, IntegrationCreateWebhookPayload, IntegrationDeleteData, IntegrationDeleteWebhookPayload, IntegrationWebhookEventType, ProjectPlatformType, ProjectType, ProjectVote, User, UserSource, Vote, VoteCreateData, VoteCreateWebhookPayload, WebhookEventType, WebhookEventTypes, WebhookPayload, WebhookPayloadBase, WebhookTestData, WebhookTestWebhookPayload } from "./v1.cjs";
|
|
2
2
|
import { n as SnowflakeSchema, t as ISO8601DateSchema } from "./validators-jGzHB8WZ.cjs";
|
|
3
|
-
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
4
|
-
export { BaseProject, BaseProjectSchema, ErrorResponse, ErrorSchema, GetProjectResponse, GetProjectResponseSchema, GetProjectVotesQuery, GetProjectVotesQuerySchema, GetProjectVotesResponse, GetProjectVotesResponseSchema, GetVoteStatusByUserQuery, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponse, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateData, IntegrationCreateDataSchema, IntegrationCreateResponse, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayload, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteData, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayload, IntegrationDeleteWebhookPayloadSchema,
|
|
3
|
+
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema } from "./v1/validators.cjs";
|
|
4
|
+
export { BaseProject, BaseProjectSchema, ErrorResponse, ErrorSchema, GetProjectResponse, GetProjectResponseSchema, GetProjectVotesQuery, GetProjectVotesQuerySchema, GetProjectVotesResponse, GetProjectVotesResponseSchema, GetVoteStatusByUserQuery, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponse, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateData, IntegrationCreateDataSchema, IntegrationCreateResponse, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayload, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteData, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayload, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventType, IntegrationWebhookEventTypeSchema, ProjectPlatformType, ProjectPlatformTypeSchema, ProjectType, ProjectTypeSchema, ProjectVote, ProjectVoteSchema, SnowflakeSchema, User, UserSchema, UserSource, UserSourceSchema, Vote, VoteCreateData, VoteCreateDataSchema, VoteCreateWebhookPayload, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventType, WebhookEventTypeSchema, WebhookEventTypes, WebhookEventTypesSchema, WebhookPayload, WebhookPayloadBase, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestData, WebhookTestDataSchema, WebhookTestWebhookPayload, WebhookTestWebhookPayloadSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { BaseProject, ErrorResponse, GetProjectResponse, GetProjectVotesQuery, GetProjectVotesResponse, GetVoteStatusByUserQuery, GetVoteStatusByUserResponse, IntegrationCreateData, IntegrationCreateResponse, IntegrationCreateWebhookPayload, IntegrationDeleteData, IntegrationDeleteWebhookPayload, IntegrationWebhookEventType, ProjectPlatformType, ProjectType, ProjectVote, User, UserSource, Vote, VoteCreateData, VoteCreateWebhookPayload, WebhookEventType, WebhookEventTypes, WebhookPayload, WebhookPayloadBase, WebhookTestData, WebhookTestWebhookPayload } from "./v1.js";
|
|
2
2
|
import { n as SnowflakeSchema, t as ISO8601DateSchema } from "./validators-kCo2qI41.js";
|
|
3
|
-
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
4
|
-
export { BaseProject, BaseProjectSchema, ErrorResponse, ErrorSchema, GetProjectResponse, GetProjectResponseSchema, GetProjectVotesQuery, GetProjectVotesQuerySchema, GetProjectVotesResponse, GetProjectVotesResponseSchema, GetVoteStatusByUserQuery, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponse, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateData, IntegrationCreateDataSchema, IntegrationCreateResponse, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayload, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteData, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayload, IntegrationDeleteWebhookPayloadSchema,
|
|
3
|
+
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema } from "./v1/validators.js";
|
|
4
|
+
export { BaseProject, BaseProjectSchema, ErrorResponse, ErrorSchema, GetProjectResponse, GetProjectResponseSchema, GetProjectVotesQuery, GetProjectVotesQuerySchema, GetProjectVotesResponse, GetProjectVotesResponseSchema, GetVoteStatusByUserQuery, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponse, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateData, IntegrationCreateDataSchema, IntegrationCreateResponse, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayload, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteData, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayload, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventType, IntegrationWebhookEventTypeSchema, ProjectPlatformType, ProjectPlatformTypeSchema, ProjectType, ProjectTypeSchema, ProjectVote, ProjectVoteSchema, SnowflakeSchema, User, UserSchema, UserSource, UserSourceSchema, Vote, VoteCreateData, VoteCreateDataSchema, VoteCreateWebhookPayload, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventType, WebhookEventTypeSchema, WebhookEventTypes, WebhookEventTypesSchema, WebhookPayload, WebhookPayloadBase, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestData, WebhookTestDataSchema, WebhookTestWebhookPayload, WebhookTestWebhookPayloadSchema };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { n as SnowflakeSchema, t as ISO8601DateSchema } from "./validators-Mlu16sBg.js";
|
|
2
|
-
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
2
|
+
import { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema } from "./v1/validators.js";
|
|
3
3
|
|
|
4
|
-
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
4
|
+
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, SnowflakeSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema };
|
package/dist/v1/validators.cjs
CHANGED
|
@@ -8,12 +8,7 @@ zod_mini = require_validators.__toESM(zod_mini);
|
|
|
8
8
|
*
|
|
9
9
|
* Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.
|
|
10
10
|
*/
|
|
11
|
-
const
|
|
12
|
-
"webhook.test",
|
|
13
|
-
"integration.create",
|
|
14
|
-
"integration.delete",
|
|
15
|
-
"vote.create"
|
|
16
|
-
]);
|
|
11
|
+
const IntegrationWebhookEventTypeSchema = zod_mini.enum(["integration.create", "integration.delete"]);
|
|
17
12
|
/**
|
|
18
13
|
* The type of a project helps top.gg synchronize features.
|
|
19
14
|
* For example, a discord bot may have a support server, but this would not make any sense for a discord server.
|
|
@@ -39,7 +34,8 @@ const UserSourceSchema = zod_mini.enum(["discord", "topgg"]);
|
|
|
39
34
|
/**
|
|
40
35
|
* Webhook scopes that are supported for integrations.
|
|
41
36
|
*/
|
|
42
|
-
const
|
|
37
|
+
const WebhookEventTypeSchema = zod_mini.enum(["webhook.test", "vote.create"]);
|
|
38
|
+
const WebhookEventTypesSchema = zod_mini.union([WebhookEventTypeSchema, IntegrationWebhookEventTypeSchema]);
|
|
43
39
|
/**
|
|
44
40
|
* All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.
|
|
45
41
|
*/
|
|
@@ -109,7 +105,7 @@ const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema("integrat
|
|
|
109
105
|
*/
|
|
110
106
|
const IntegrationCreateResponseSchema = zod_mini.object({
|
|
111
107
|
webhook_url: zod_mini.url(),
|
|
112
|
-
routes: zod_mini.array(
|
|
108
|
+
routes: zod_mini.array(IntegrationWebhookEventTypeSchema).check(zod_mini.refine((arr) => arr.length === new Set(arr).size, "Duplicate webhook scopes are not allowed"))
|
|
113
109
|
});
|
|
114
110
|
/**
|
|
115
111
|
* Data included when an integration connection is deleted.
|
|
@@ -222,7 +218,7 @@ exports.IntegrationCreateResponseSchema = IntegrationCreateResponseSchema;
|
|
|
222
218
|
exports.IntegrationCreateWebhookPayloadSchema = IntegrationCreateWebhookPayloadSchema;
|
|
223
219
|
exports.IntegrationDeleteDataSchema = IntegrationDeleteDataSchema;
|
|
224
220
|
exports.IntegrationDeleteWebhookPayloadSchema = IntegrationDeleteWebhookPayloadSchema;
|
|
225
|
-
exports.
|
|
221
|
+
exports.IntegrationWebhookEventTypeSchema = IntegrationWebhookEventTypeSchema;
|
|
226
222
|
exports.ProjectPlatformTypeSchema = ProjectPlatformTypeSchema;
|
|
227
223
|
exports.ProjectTypeSchema = ProjectTypeSchema;
|
|
228
224
|
exports.ProjectVoteSchema = ProjectVoteSchema;
|
|
@@ -233,6 +229,7 @@ exports.VoteCreateDataSchema = VoteCreateDataSchema;
|
|
|
233
229
|
exports.VoteCreateWebhookPayloadSchema = VoteCreateWebhookPayloadSchema;
|
|
234
230
|
exports.VoteSchema = VoteSchema;
|
|
235
231
|
exports.WebhookEventTypeSchema = WebhookEventTypeSchema;
|
|
232
|
+
exports.WebhookEventTypesSchema = WebhookEventTypesSchema;
|
|
236
233
|
exports.WebhookPayloadBaseSchema = WebhookPayloadBaseSchema;
|
|
237
234
|
exports.WebhookPayloadSchema = WebhookPayloadSchema;
|
|
238
235
|
exports.WebhookTestDataSchema = WebhookTestDataSchema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.cjs","names":["z","SnowflakeSchema","ISO8601DateSchema"],"sources":["../../src/v1/validators.ts"],"sourcesContent":["import * as z from \"zod/mini\";\nimport { ISO8601DateSchema, SnowflakeSchema } from \"@utils/validators\";\nexport * from \"@utils/validators\";\n\n// # General and Base Schemas\n\n// ## Enums and Constants\n\n/**\n * The type of a webhook event. This is used to identify the type of the event that is being delivered to your webhook endpoint.\n *\n * Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.\n */\nexport const WebhookEventTypeSchema = z.enum([\n \"webhook.test\",\n \"integration.create\",\n \"integration.delete\",\n \"vote.create\",\n]);\n\n/**\n * The type of a project helps top.gg synchronize features.\n * For example, a discord bot may have a support server, but this would not make any sense for a discord server.\n *\n * You can use this to further find out the specificity of the project.\n */\nexport const ProjectTypeSchema = z.enum([\"bot\", \"server\", \"game\"]);\n\n/**\n * A Platform is used to identify where the corresponding ID links towards.\n */\nexport const ProjectPlatformTypeSchema = z.enum([\"discord\", \"roblox\"]);\n\n/**\n * A User Source is an enum that represents a user account from an external platform that is linked to a Top.gg user account.\n * Each source has a unique identifer type that we might validate against.\n *\n * If none is passed to any endpoint that accepts a source parameter, it will default to topgg.\n */\nexport const UserSourceSchema = z.enum([\"discord\", \"topgg\"]);\n\n/**\n * Webhook scopes that are supported for integrations.\n */\nexport const IntegrationSupportedWebhookScopesSchema = z.enum([\"webhook.test\", \"vote.create\"]);\n\n/**\n * All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.\n */\nexport const ErrorSchema = z.object({\n type: z.string(),\n title: z.string(),\n status: z.number(),\n detail: z.string(),\n});\n\n/**\n * Represents a user on Top.gg.\n */\nexport const UserSchema = z.object({\n /**\n * The user's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The user's platform ID (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The user's username.\n */\n name: z.string(),\n /**\n * The URL of the user's avatar.\n */\n avatar_url: z.url(),\n});\n\n/**\n * Base project information shared across all project-related responses.\n */\nexport const BaseProjectSchema = z.object({\n /**\n * The project's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The platform the project is on (e.g., \"discord\").\n */\n platform: ProjectPlatformTypeSchema,\n /**\n * The platform-specific ID of the project (e.g., Discord Bot ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The type of project (e.g., \"bot\").\n */\n type: ProjectTypeSchema,\n});\n\n/**\n * Represents a vote on Top.gg.\n */\nexport const VoteSchema = z.object({\n /**\n * The Top.gg ID of the user who voted.\n */\n user_id: SnowflakeSchema,\n /**\n * The user's ID on the project's platform (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n /**\n * The timestamp of when the user voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the vote expires (i.e., when the user can vote again).\n * This is typically 12 hours after the `created_at` timestamp, but may vary based on the user's voting history and other factors.\n */\n expires_at: ISO8601DateSchema,\n});\n\n/**\n * Represents a vote for a specific project.\n */\nexport const ProjectVoteSchema = z.clone(VoteSchema);\n\nexport const WebhookPayloadBaseSchema = <\n T extends z.infer<typeof WebhookEventTypeSchema>,\n Data extends z.ZodMiniObject,\n>(\n type: T,\n data: Data\n) =>\n z.object({\n type: z.literal(type),\n data: data,\n });\n\n// # Specific Schemas\n\n// ## Integration Schemas\n\n/**\n * Data included when an integration connection is created.\n */\nexport const IntegrationCreateDataSchema = z.object({\n /**\n * The unique identifier for this integration connection.\n */\n connection_id: SnowflakeSchema,\n /**\n * The webhook secret used to verify webhook requests from Top.gg for this connection.\n */\n webhook_secret: z.string().check(z.regex(/^whs_[a-zA-Z0-9]+$/, \"Invalid webhook secret\")),\n /**\n * The project this integration is connected to.\n */\n project: BaseProjectSchema,\n /**\n * The user who created this integration connection.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is created.\n * This will be sent if a user clicks \"Connect\" for your integration on the dashboard.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#2-topgg-sends-integrationcreate\n */\nexport const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.create\",\n IntegrationCreateDataSchema\n);\n\n/**\n * The response you must return from your webhook endpoint when you receive an `integration.create` event.\n * This tells Top.gg where to deliver webhook events for this integration connection and which events to deliver.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#3-respond-with-configuration\n */\nexport const IntegrationCreateResponseSchema = z.object({\n /**\n * The URL where Top.gg should deliver webhook events for this connection.\n */\n webhook_url: z.url(),\n /**\n * An array of webhook scopes to subscribe to.\n *\n * @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes\n */\n routes: z\n .array(IntegrationSupportedWebhookScopesSchema)\n .check(\n z.refine(\n (arr) => arr.length === new Set(arr).size,\n \"Duplicate webhook scopes are not allowed\"\n )\n ),\n});\n\n/**\n * Data included when an integration connection is deleted.\n */\nexport const IntegrationDeleteDataSchema = z.object({\n /**\n * The unique identifier for the integration connection that was deleted.\n */\n connection_id: SnowflakeSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is deleted.\n */\nexport const IntegrationDeleteWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.delete\",\n IntegrationDeleteDataSchema\n);\n\n// ## Vote Schemas\n\n/**\n * Data included when a vote is created.\n */\nexport const VoteCreateDataSchema = z.extend(VoteSchema, {\n /**\n * The project that was voted for.\n */\n project: BaseProjectSchema,\n /**\n * The user who voted.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when a user votes for your project and you have subscribed to the `vote.create` event.\n */\nexport const VoteCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"vote.create\",\n VoteCreateDataSchema\n);\n\n// ## Webhook Test Schema\n\n/**\n * Data included in a webhook test event.\n */\nexport const WebhookTestDataSchema = z.object({\n /**\n * A test user.\n */\n user: UserSchema,\n /**\n * A test project.\n */\n project: BaseProjectSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when you send a test webhook from the dashboard or via the API.\n */\nexport const WebhookTestWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"webhook.test\",\n WebhookTestDataSchema\n);\n\n// ## Webhook\n\nexport const WebhookPayloadSchema = z.discriminatedUnion(\"type\", [\n IntegrationCreateWebhookPayloadSchema,\n IntegrationDeleteWebhookPayloadSchema,\n VoteCreateWebhookPayloadSchema,\n WebhookTestWebhookPayloadSchema,\n]);\n\n// ## Project Schemas\n\n/**\n * Response schema for getting the authenticated project.\n *\n * - GET `/v1/projects/@me`\n *\n * @see https://docs.top.gg/docs/API/v1/projects#get-current-project\n */\nexport const GetProjectResponseSchema = z.extend(BaseProjectSchema, {\n /**\n * The project's name.\n */\n name: z.string(),\n /**\n * The project's headline/tagline.\n */\n headline: z.string(),\n /**\n * Tags associated with the project.\n */\n tags: z.array(z.string()),\n /**\n * The number of votes this month.\n */\n votes: z.number(),\n /**\n * The total number of votes all time.\n */\n votes_total: z.number(),\n /**\n * The average review score.\n */\n review_score: z.number(),\n /**\n * The number of reviews.\n */\n review_count: z.number(),\n});\n\n/**\n * Query parameters for getting project votes.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * Either `cursor` or `startDate` must be provided.\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesQuerySchema = z\n .object({\n /**\n * Pagination cursor for fetching the next page of votes. if provided, `startDate` is ignored.\n *\n * From the previous response.\n */\n cursor: z.optional(z.string()),\n /**\n * The start date for fetching votes. Only votes created after this date will be returned. Required if `cursor` is not provided.\n *\n * Maximum 1 year in the past.\n *\n * ISO 8601 date string.\n */\n startDate: z.optional(ISO8601DateSchema),\n })\n .check(\n z.refine((data) => data.cursor || data.startDate, \"Either cursor or startDate must be provided\")\n );\n\n/**\n * Response schema for the Get Project Votes endpoint.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesResponseSchema = z.object({\n /**\n * Cursor for fetching the next page of votes.\n */\n cursor: z.string(),\n /**\n * An array of votes for the project.\n */\n data: z.array(ProjectVoteSchema),\n});\n\n/**\n * Query parameters for getting vote status by user.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserQuerySchema = z.object({\n /**\n * The source of the user ID. Defaults to \"topgg\".\n */\n source: z.optional(UserSourceSchema),\n});\n\n/**\n * Response schema for the Get Vote Status By User endpoint.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserResponseSchema = z.object({\n /**\n * The timestamp of when the user last voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the user's vote expires (i.e., when they can vote again).\n */\n expires_at: ISO8601DateSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n});\n"],"mappings":";;;;;;;;;;AAaA,MAAa,yBAAyBA,SAAE,KAAK;CAC3C;CACA;CACA;CACA;CACD,CAAC;;;;;;;AAQF,MAAa,oBAAoBA,SAAE,KAAK;CAAC;CAAO;CAAU;CAAO,CAAC;;;;AAKlE,MAAa,4BAA4BA,SAAE,KAAK,CAAC,WAAW,SAAS,CAAC;;;;;;;AAQtE,MAAa,mBAAmBA,SAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;;;;AAK5D,MAAa,0CAA0CA,SAAE,KAAK,CAAC,gBAAgB,cAAc,CAAC;;;;AAK9F,MAAa,cAAcA,SAAE,OAAO;CAClC,MAAMA,SAAE,QAAQ;CAChB,OAAOA,SAAE,QAAQ;CACjB,QAAQA,SAAE,QAAQ;CAClB,QAAQA,SAAE,QAAQ;CACnB,CAA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BAC7C,gBACA,sBACD;AAID,MAAa,uBAAuBA,SAAE,mBAAmB,QAAQ;CAC/D;CACA;CACA;CACA;CACD,CAAC;;;;;;;;AAWF,MAAa,2BAA2BA,SAAE,OAAO,mBAAmB;CAIlE,MAAMA,SAAE,QAAQ;CAIhB,UAAUA,SAAE,QAAQ;CAIpB,MAAMA,SAAE,MAAMA,SAAE,QAAQ,CAAC;CAIzB,OAAOA,SAAE,QAAQ;CAIjB,aAAaA,SAAE,QAAQ;CAIvB,cAAcA,SAAE,QAAQ;CAIxB,cAAcA,SAAE,QAAQ;CACzB,CAAC;;;;;;;;;;AAWF,MAAa,6BAA6BA,SACvC,OAAO;CAMN,QAAQA,SAAE,SAASA,SAAE,QAAQ,CAAC;CAQ9B,WAAWA,SAAE,SAASE,qCAAkB;CACzC,CAAC,CACD,MACCF,SAAE,QAAQ,SAAS,KAAK,UAAU,KAAK,WAAW,8CAA8C,CACjG;;;;;;;;AASH,MAAa,gCAAgCA,SAAE,OAAO;CAIpD,QAAQA,SAAE,QAAQ;CAIlB,MAAMA,SAAE,MAAM,kBAAkB;CACjC,CAAC;;;;;;;;AASF,MAAa,iCAAiCA,SAAE,OAAO,EAIrD,QAAQA,SAAE,SAAS,iBAAiB,EACrC,CAAC;;;;;;;;AASF,MAAa,oCAAoCA,SAAE,OAAO;CAIxD,YAAYE;CAIZ,YAAYA;CAIZ,QAAQF,SAAE,QAAQ;CACnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"validators.cjs","names":["z","SnowflakeSchema","ISO8601DateSchema"],"sources":["../../src/v1/validators.ts"],"sourcesContent":["import * as z from \"zod/mini\";\nimport { ISO8601DateSchema, SnowflakeSchema } from \"@utils/validators\";\nexport * from \"@utils/validators\";\n\n// # General and Base Schemas\n\n// ## Enums and Constants\n\n/**\n * The type of a webhook event. This is used to identify the type of the event that is being delivered to your webhook endpoint.\n *\n * Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.\n */\nexport const IntegrationWebhookEventTypeSchema = z.enum([\n \"integration.create\",\n \"integration.delete\",\n]);\n\n/**\n * The type of a project helps top.gg synchronize features.\n * For example, a discord bot may have a support server, but this would not make any sense for a discord server.\n *\n * You can use this to further find out the specificity of the project.\n */\nexport const ProjectTypeSchema = z.enum([\"bot\", \"server\", \"game\"]);\n\n/**\n * A Platform is used to identify where the corresponding ID links towards.\n */\nexport const ProjectPlatformTypeSchema = z.enum([\"discord\", \"roblox\"]);\n\n/**\n * A User Source is an enum that represents a user account from an external platform that is linked to a Top.gg user account.\n * Each source has a unique identifer type that we might validate against.\n *\n * If none is passed to any endpoint that accepts a source parameter, it will default to topgg.\n */\nexport const UserSourceSchema = z.enum([\"discord\", \"topgg\"]);\n\n/**\n * Webhook scopes that are supported for integrations.\n */\nexport const WebhookEventTypeSchema = z.enum([\"webhook.test\", \"vote.create\"]);\n\nexport const WebhookEventTypesSchema = z.union([\n WebhookEventTypeSchema,\n IntegrationWebhookEventTypeSchema,\n]);\n\n/**\n * All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.\n */\nexport const ErrorSchema = z.object({\n type: z.string(),\n title: z.string(),\n status: z.number(),\n detail: z.string(),\n});\n\n/**\n * Represents a user on Top.gg.\n */\nexport const UserSchema = z.object({\n /**\n * The user's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The user's platform ID (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The user's username.\n */\n name: z.string(),\n /**\n * The URL of the user's avatar.\n */\n avatar_url: z.url(),\n});\n\n/**\n * Base project information shared across all project-related responses.\n */\nexport const BaseProjectSchema = z.object({\n /**\n * The project's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The platform the project is on (e.g., \"discord\").\n */\n platform: ProjectPlatformTypeSchema,\n /**\n * The platform-specific ID of the project (e.g., Discord Bot ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The type of project (e.g., \"bot\").\n */\n type: ProjectTypeSchema,\n});\n\n/**\n * Represents a vote on Top.gg.\n */\nexport const VoteSchema = z.object({\n /**\n * The Top.gg ID of the user who voted.\n */\n user_id: SnowflakeSchema,\n /**\n * The user's ID on the project's platform (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n /**\n * The timestamp of when the user voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the vote expires (i.e., when the user can vote again).\n * This is typically 12 hours after the `created_at` timestamp, but may vary based on the user's voting history and other factors.\n */\n expires_at: ISO8601DateSchema,\n});\n\n/**\n * Represents a vote for a specific project.\n */\nexport const ProjectVoteSchema = z.clone(VoteSchema);\n\nexport const WebhookPayloadBaseSchema = <\n T extends z.infer<typeof WebhookEventTypesSchema>,\n Data extends z.ZodMiniObject,\n>(\n type: T,\n data: Data\n) =>\n z.object({\n type: z.literal(type),\n data: data,\n });\n\n// # Specific Schemas\n\n// ## Integration Schemas\n\n/**\n * Data included when an integration connection is created.\n */\nexport const IntegrationCreateDataSchema = z.object({\n /**\n * The unique identifier for this integration connection.\n */\n connection_id: SnowflakeSchema,\n /**\n * The webhook secret used to verify webhook requests from Top.gg for this connection.\n */\n webhook_secret: z.string().check(z.regex(/^whs_[a-zA-Z0-9]+$/, \"Invalid webhook secret\")),\n /**\n * The project this integration is connected to.\n */\n project: BaseProjectSchema,\n /**\n * The user who created this integration connection.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is created.\n * This will be sent if a user clicks \"Connect\" for your integration on the dashboard.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#2-topgg-sends-integrationcreate\n */\nexport const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.create\",\n IntegrationCreateDataSchema\n);\n\n/**\n * The response you must return from your webhook endpoint when you receive an `integration.create` event.\n * This tells Top.gg where to deliver webhook events for this integration connection and which events to deliver.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#3-respond-with-configuration\n */\nexport const IntegrationCreateResponseSchema = z.object({\n /**\n * The URL where Top.gg should deliver webhook events for this connection.\n */\n webhook_url: z.url(),\n /**\n * An array of webhook scopes to subscribe to.\n *\n * @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes\n */\n routes: z\n .array(IntegrationWebhookEventTypeSchema)\n .check(\n z.refine(\n (arr) => arr.length === new Set(arr).size,\n \"Duplicate webhook scopes are not allowed\"\n )\n ),\n});\n\n/**\n * Data included when an integration connection is deleted.\n */\nexport const IntegrationDeleteDataSchema = z.object({\n /**\n * The unique identifier for the integration connection that was deleted.\n */\n connection_id: SnowflakeSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is deleted.\n */\nexport const IntegrationDeleteWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.delete\",\n IntegrationDeleteDataSchema\n);\n\n// ## Vote Schemas\n\n/**\n * Data included when a vote is created.\n */\nexport const VoteCreateDataSchema = z.extend(VoteSchema, {\n /**\n * The project that was voted for.\n */\n project: BaseProjectSchema,\n /**\n * The user who voted.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when a user votes for your project and you have subscribed to the `vote.create` event.\n */\nexport const VoteCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"vote.create\",\n VoteCreateDataSchema\n);\n\n// ## Webhook Test Schema\n\n/**\n * Data included in a webhook test event.\n */\nexport const WebhookTestDataSchema = z.object({\n /**\n * A test user.\n */\n user: UserSchema,\n /**\n * A test project.\n */\n project: BaseProjectSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when you send a test webhook from the dashboard or via the API.\n */\nexport const WebhookTestWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"webhook.test\",\n WebhookTestDataSchema\n);\n\n// ## Webhook\n\nexport const WebhookPayloadSchema = z.discriminatedUnion(\"type\", [\n IntegrationCreateWebhookPayloadSchema,\n IntegrationDeleteWebhookPayloadSchema,\n VoteCreateWebhookPayloadSchema,\n WebhookTestWebhookPayloadSchema,\n]);\n\n// ## Project Schemas\n\n/**\n * Response schema for getting the authenticated project.\n *\n * - GET `/v1/projects/@me`\n *\n * @see https://docs.top.gg/docs/API/v1/projects#get-current-project\n */\nexport const GetProjectResponseSchema = z.extend(BaseProjectSchema, {\n /**\n * The project's name.\n */\n name: z.string(),\n /**\n * The project's headline/tagline.\n */\n headline: z.string(),\n /**\n * Tags associated with the project.\n */\n tags: z.array(z.string()),\n /**\n * The number of votes this month.\n */\n votes: z.number(),\n /**\n * The total number of votes all time.\n */\n votes_total: z.number(),\n /**\n * The average review score.\n */\n review_score: z.number(),\n /**\n * The number of reviews.\n */\n review_count: z.number(),\n});\n\n/**\n * Query parameters for getting project votes.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * Either `cursor` or `startDate` must be provided.\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesQuerySchema = z\n .object({\n /**\n * Pagination cursor for fetching the next page of votes. if provided, `startDate` is ignored.\n *\n * From the previous response.\n */\n cursor: z.optional(z.string()),\n /**\n * The start date for fetching votes. Only votes created after this date will be returned. Required if `cursor` is not provided.\n *\n * Maximum 1 year in the past.\n *\n * ISO 8601 date string.\n */\n startDate: z.optional(ISO8601DateSchema),\n })\n .check(\n z.refine((data) => data.cursor || data.startDate, \"Either cursor or startDate must be provided\")\n );\n\n/**\n * Response schema for the Get Project Votes endpoint.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesResponseSchema = z.object({\n /**\n * Cursor for fetching the next page of votes.\n */\n cursor: z.string(),\n /**\n * An array of votes for the project.\n */\n data: z.array(ProjectVoteSchema),\n});\n\n/**\n * Query parameters for getting vote status by user.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserQuerySchema = z.object({\n /**\n * The source of the user ID. Defaults to \"topgg\".\n */\n source: z.optional(UserSourceSchema),\n});\n\n/**\n * Response schema for the Get Vote Status By User endpoint.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserResponseSchema = z.object({\n /**\n * The timestamp of when the user last voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the user's vote expires (i.e., when they can vote again).\n */\n expires_at: ISO8601DateSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n});\n"],"mappings":";;;;;;;;;;AAaA,MAAa,oCAAoCA,SAAE,KAAK,CACtD,sBACA,qBACD,CAAC;;;;;;;AAQF,MAAa,oBAAoBA,SAAE,KAAK;CAAC;CAAO;CAAU;CAAO,CAAC;;;;AAKlE,MAAa,4BAA4BA,SAAE,KAAK,CAAC,WAAW,SAAS,CAAC;;;;;;;AAQtE,MAAa,mBAAmBA,SAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;;;;AAK5D,MAAa,yBAAyBA,SAAE,KAAK,CAAC,gBAAgB,cAAc,CAAC;AAE7E,MAAa,0BAA0BA,SAAE,MAAM,CAC7C,wBACA,kCACD,CAAC;;;;AAKF,MAAa,cAAcA,SAAE,OAAO;CAClC,MAAMA,SAAE,QAAQ;CAChB,OAAOA,SAAE,QAAQ;CACjB,QAAQA,SAAE,QAAQ;CAClB,QAAQA,SAAE,QAAQ;CACnB,CAAC;;;;AAKF,MAAa,aAAaA,SAAE,OAAO;CAIjC,IAAIC;CAIJ,aAAaA;CAIb,MAAMD,SAAE,QAAQ;CAIhB,YAAYA,SAAE,KAAK;CACpB,CAAC;;;;AAKF,MAAa,oBAAoBA,SAAE,OAAO;CAIxC,IAAIC;CAIJ,UAAU;CAIV,aAAaA;CAIb,MAAM;CACP,CAAC;;;;AAKF,MAAa,aAAaD,SAAE,OAAO;CAIjC,SAASC;CAIT,aAAaA;CAIb,QA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AIvB,cAAcA,SAAE,QAAQ;CAIxB,cAAcA,SAAE,QAAQ;CACzB,CAAC;;;;;;;;;;AAWF,MAAa,6BAA6BA,SACvC,OAAO;CAMN,QAAQA,SAAE,SAASA,SAAE,QAAQ,CAAC;CAQ9B,WAAWA,SAAE,SAASE,qCAAkB;CACzC,CAAC,CACD,MACCF,SAAE,QAAQ,SAAS,KAAK,UAAU,KAAK,WAAW,8CAA8C,CACjG;;;;;;;;AASH,MAAa,gCAAgCA,SAAE,OAAO;CAIpD,QAAQA,SAAE,QAAQ;CAIlB,MAAMA,SAAE,MAAM,kBAAkB;CACjC,CAAC;;;;;;;;AASF,MAAa,iCAAiCA,SAAE,OAAO,EAIrD,QAAQA,SAAE,SAAS,iBAAiB,EACrC,CAAC;;;;;;;;AASF,MAAa,oCAAoCA,SAAE,OAAO;CAIxD,YAAYE;CAIZ,YAAYA;CAIZ,QAAQF,SAAE,QAAQ;CACnB,CAAC"}
|
package/dist/v1/validators.d.cts
CHANGED
|
@@ -8,11 +8,9 @@ import * as z from "zod/mini";
|
|
|
8
8
|
*
|
|
9
9
|
* Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.
|
|
10
10
|
*/
|
|
11
|
-
declare const
|
|
12
|
-
"webhook.test": "webhook.test";
|
|
11
|
+
declare const IntegrationWebhookEventTypeSchema: z.ZodMiniEnum<{
|
|
13
12
|
"integration.create": "integration.create";
|
|
14
13
|
"integration.delete": "integration.delete";
|
|
15
|
-
"vote.create": "vote.create";
|
|
16
14
|
}>;
|
|
17
15
|
/**
|
|
18
16
|
* The type of a project helps top.gg synchronize features.
|
|
@@ -45,10 +43,17 @@ declare const UserSourceSchema: z.ZodMiniEnum<{
|
|
|
45
43
|
/**
|
|
46
44
|
* Webhook scopes that are supported for integrations.
|
|
47
45
|
*/
|
|
48
|
-
declare const
|
|
46
|
+
declare const WebhookEventTypeSchema: z.ZodMiniEnum<{
|
|
49
47
|
"webhook.test": "webhook.test";
|
|
50
48
|
"vote.create": "vote.create";
|
|
51
49
|
}>;
|
|
50
|
+
declare const WebhookEventTypesSchema: z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
51
|
+
"webhook.test": "webhook.test";
|
|
52
|
+
"vote.create": "vote.create";
|
|
53
|
+
}>, z.ZodMiniEnum<{
|
|
54
|
+
"integration.create": "integration.create";
|
|
55
|
+
"integration.delete": "integration.delete";
|
|
56
|
+
}>]>;
|
|
52
57
|
/**
|
|
53
58
|
* All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.
|
|
54
59
|
*/
|
|
@@ -159,7 +164,7 @@ declare const ProjectVoteSchema: z.ZodMiniObject<{
|
|
|
159
164
|
*/
|
|
160
165
|
expires_at: z.iso.ZodMiniISODate;
|
|
161
166
|
}, z.core.$strip>;
|
|
162
|
-
declare const WebhookPayloadBaseSchema: <T extends z.infer<typeof
|
|
167
|
+
declare const WebhookPayloadBaseSchema: <T extends z.infer<typeof WebhookEventTypesSchema>, Data extends z.ZodMiniObject>(type: T, data: Data) => z.ZodMiniObject<{
|
|
163
168
|
type: z.ZodMiniLiteral<T>;
|
|
164
169
|
data: Data;
|
|
165
170
|
}, z.core.$strip>;
|
|
@@ -310,8 +315,8 @@ declare const IntegrationCreateResponseSchema: z.ZodMiniObject<{
|
|
|
310
315
|
* @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes
|
|
311
316
|
*/
|
|
312
317
|
routes: z.ZodMiniArray<z.ZodMiniEnum<{
|
|
313
|
-
"
|
|
314
|
-
"
|
|
318
|
+
"integration.create": "integration.create";
|
|
319
|
+
"integration.delete": "integration.delete";
|
|
315
320
|
}>>;
|
|
316
321
|
}, z.core.$strip>;
|
|
317
322
|
/**
|
|
@@ -859,5 +864,5 @@ declare const GetVoteStatusByUserResponseSchema: z.ZodMiniObject<{
|
|
|
859
864
|
weight: z.ZodMiniNumber<number>;
|
|
860
865
|
}, z.core.$strip>;
|
|
861
866
|
//#endregion
|
|
862
|
-
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
867
|
+
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, SnowflakeSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema };
|
|
863
868
|
//# sourceMappingURL=validators.d.cts.map
|
package/dist/v1/validators.d.ts
CHANGED
|
@@ -8,11 +8,9 @@ import * as z from "zod/mini";
|
|
|
8
8
|
*
|
|
9
9
|
* Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.
|
|
10
10
|
*/
|
|
11
|
-
declare const
|
|
12
|
-
"webhook.test": "webhook.test";
|
|
11
|
+
declare const IntegrationWebhookEventTypeSchema: z.ZodMiniEnum<{
|
|
13
12
|
"integration.create": "integration.create";
|
|
14
13
|
"integration.delete": "integration.delete";
|
|
15
|
-
"vote.create": "vote.create";
|
|
16
14
|
}>;
|
|
17
15
|
/**
|
|
18
16
|
* The type of a project helps top.gg synchronize features.
|
|
@@ -45,10 +43,17 @@ declare const UserSourceSchema: z.ZodMiniEnum<{
|
|
|
45
43
|
/**
|
|
46
44
|
* Webhook scopes that are supported for integrations.
|
|
47
45
|
*/
|
|
48
|
-
declare const
|
|
46
|
+
declare const WebhookEventTypeSchema: z.ZodMiniEnum<{
|
|
49
47
|
"webhook.test": "webhook.test";
|
|
50
48
|
"vote.create": "vote.create";
|
|
51
49
|
}>;
|
|
50
|
+
declare const WebhookEventTypesSchema: z.ZodMiniUnion<readonly [z.ZodMiniEnum<{
|
|
51
|
+
"webhook.test": "webhook.test";
|
|
52
|
+
"vote.create": "vote.create";
|
|
53
|
+
}>, z.ZodMiniEnum<{
|
|
54
|
+
"integration.create": "integration.create";
|
|
55
|
+
"integration.delete": "integration.delete";
|
|
56
|
+
}>]>;
|
|
52
57
|
/**
|
|
53
58
|
* All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.
|
|
54
59
|
*/
|
|
@@ -159,7 +164,7 @@ declare const ProjectVoteSchema: z.ZodMiniObject<{
|
|
|
159
164
|
*/
|
|
160
165
|
expires_at: z.iso.ZodMiniISODate;
|
|
161
166
|
}, z.core.$strip>;
|
|
162
|
-
declare const WebhookPayloadBaseSchema: <T extends z.infer<typeof
|
|
167
|
+
declare const WebhookPayloadBaseSchema: <T extends z.infer<typeof WebhookEventTypesSchema>, Data extends z.ZodMiniObject>(type: T, data: Data) => z.ZodMiniObject<{
|
|
163
168
|
type: z.ZodMiniLiteral<T>;
|
|
164
169
|
data: Data;
|
|
165
170
|
}, z.core.$strip>;
|
|
@@ -310,8 +315,8 @@ declare const IntegrationCreateResponseSchema: z.ZodMiniObject<{
|
|
|
310
315
|
* @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes
|
|
311
316
|
*/
|
|
312
317
|
routes: z.ZodMiniArray<z.ZodMiniEnum<{
|
|
313
|
-
"
|
|
314
|
-
"
|
|
318
|
+
"integration.create": "integration.create";
|
|
319
|
+
"integration.delete": "integration.delete";
|
|
315
320
|
}>>;
|
|
316
321
|
}, z.core.$strip>;
|
|
317
322
|
/**
|
|
@@ -859,5 +864,5 @@ declare const GetVoteStatusByUserResponseSchema: z.ZodMiniObject<{
|
|
|
859
864
|
weight: z.ZodMiniNumber<number>;
|
|
860
865
|
}, z.core.$strip>;
|
|
861
866
|
//#endregion
|
|
862
|
-
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
867
|
+
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, SnowflakeSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema };
|
|
863
868
|
//# sourceMappingURL=validators.d.ts.map
|
package/dist/v1/validators.js
CHANGED
|
@@ -7,12 +7,7 @@ import * as z from "zod/mini";
|
|
|
7
7
|
*
|
|
8
8
|
* Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
11
|
-
"webhook.test",
|
|
12
|
-
"integration.create",
|
|
13
|
-
"integration.delete",
|
|
14
|
-
"vote.create"
|
|
15
|
-
]);
|
|
10
|
+
const IntegrationWebhookEventTypeSchema = z.enum(["integration.create", "integration.delete"]);
|
|
16
11
|
/**
|
|
17
12
|
* The type of a project helps top.gg synchronize features.
|
|
18
13
|
* For example, a discord bot may have a support server, but this would not make any sense for a discord server.
|
|
@@ -38,7 +33,8 @@ const UserSourceSchema = z.enum(["discord", "topgg"]);
|
|
|
38
33
|
/**
|
|
39
34
|
* Webhook scopes that are supported for integrations.
|
|
40
35
|
*/
|
|
41
|
-
const
|
|
36
|
+
const WebhookEventTypeSchema = z.enum(["webhook.test", "vote.create"]);
|
|
37
|
+
const WebhookEventTypesSchema = z.union([WebhookEventTypeSchema, IntegrationWebhookEventTypeSchema]);
|
|
42
38
|
/**
|
|
43
39
|
* All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.
|
|
44
40
|
*/
|
|
@@ -108,7 +104,7 @@ const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema("integrat
|
|
|
108
104
|
*/
|
|
109
105
|
const IntegrationCreateResponseSchema = z.object({
|
|
110
106
|
webhook_url: z.url(),
|
|
111
|
-
routes: z.array(
|
|
107
|
+
routes: z.array(IntegrationWebhookEventTypeSchema).check(z.refine((arr) => arr.length === new Set(arr).size, "Duplicate webhook scopes are not allowed"))
|
|
112
108
|
});
|
|
113
109
|
/**
|
|
114
110
|
* Data included when an integration connection is deleted.
|
|
@@ -208,5 +204,5 @@ const GetVoteStatusByUserResponseSchema = z.object({
|
|
|
208
204
|
});
|
|
209
205
|
|
|
210
206
|
//#endregion
|
|
211
|
-
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema,
|
|
207
|
+
export { BaseProjectSchema, ErrorSchema, GetProjectResponseSchema, GetProjectVotesQuerySchema, GetProjectVotesResponseSchema, GetVoteStatusByUserQuerySchema, GetVoteStatusByUserResponseSchema, ISO8601DateSchema, IntegrationCreateDataSchema, IntegrationCreateResponseSchema, IntegrationCreateWebhookPayloadSchema, IntegrationDeleteDataSchema, IntegrationDeleteWebhookPayloadSchema, IntegrationWebhookEventTypeSchema, ProjectPlatformTypeSchema, ProjectTypeSchema, ProjectVoteSchema, SnowflakeSchema, UserSchema, UserSourceSchema, VoteCreateDataSchema, VoteCreateWebhookPayloadSchema, VoteSchema, WebhookEventTypeSchema, WebhookEventTypesSchema, WebhookPayloadBaseSchema, WebhookPayloadSchema, WebhookTestDataSchema, WebhookTestWebhookPayloadSchema };
|
|
212
208
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","names":[],"sources":["../../src/v1/validators.ts"],"sourcesContent":["import * as z from \"zod/mini\";\nimport { ISO8601DateSchema, SnowflakeSchema } from \"@utils/validators\";\nexport * from \"@utils/validators\";\n\n// # General and Base Schemas\n\n// ## Enums and Constants\n\n/**\n * The type of a webhook event. This is used to identify the type of the event that is being delivered to your webhook endpoint.\n *\n * Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.\n */\nexport const WebhookEventTypeSchema = z.enum([\n \"webhook.test\",\n \"integration.create\",\n \"integration.delete\",\n \"vote.create\",\n]);\n\n/**\n * The type of a project helps top.gg synchronize features.\n * For example, a discord bot may have a support server, but this would not make any sense for a discord server.\n *\n * You can use this to further find out the specificity of the project.\n */\nexport const ProjectTypeSchema = z.enum([\"bot\", \"server\", \"game\"]);\n\n/**\n * A Platform is used to identify where the corresponding ID links towards.\n */\nexport const ProjectPlatformTypeSchema = z.enum([\"discord\", \"roblox\"]);\n\n/**\n * A User Source is an enum that represents a user account from an external platform that is linked to a Top.gg user account.\n * Each source has a unique identifer type that we might validate against.\n *\n * If none is passed to any endpoint that accepts a source parameter, it will default to topgg.\n */\nexport const UserSourceSchema = z.enum([\"discord\", \"topgg\"]);\n\n/**\n * Webhook scopes that are supported for integrations.\n */\nexport const IntegrationSupportedWebhookScopesSchema = z.enum([\"webhook.test\", \"vote.create\"]);\n\n/**\n * All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.\n */\nexport const ErrorSchema = z.object({\n type: z.string(),\n title: z.string(),\n status: z.number(),\n detail: z.string(),\n});\n\n/**\n * Represents a user on Top.gg.\n */\nexport const UserSchema = z.object({\n /**\n * The user's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The user's platform ID (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The user's username.\n */\n name: z.string(),\n /**\n * The URL of the user's avatar.\n */\n avatar_url: z.url(),\n});\n\n/**\n * Base project information shared across all project-related responses.\n */\nexport const BaseProjectSchema = z.object({\n /**\n * The project's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The platform the project is on (e.g., \"discord\").\n */\n platform: ProjectPlatformTypeSchema,\n /**\n * The platform-specific ID of the project (e.g., Discord Bot ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The type of project (e.g., \"bot\").\n */\n type: ProjectTypeSchema,\n});\n\n/**\n * Represents a vote on Top.gg.\n */\nexport const VoteSchema = z.object({\n /**\n * The Top.gg ID of the user who voted.\n */\n user_id: SnowflakeSchema,\n /**\n * The user's ID on the project's platform (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n /**\n * The timestamp of when the user voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the vote expires (i.e., when the user can vote again).\n * This is typically 12 hours after the `created_at` timestamp, but may vary based on the user's voting history and other factors.\n */\n expires_at: ISO8601DateSchema,\n});\n\n/**\n * Represents a vote for a specific project.\n */\nexport const ProjectVoteSchema = z.clone(VoteSchema);\n\nexport const WebhookPayloadBaseSchema = <\n T extends z.infer<typeof WebhookEventTypeSchema>,\n Data extends z.ZodMiniObject,\n>(\n type: T,\n data: Data\n) =>\n z.object({\n type: z.literal(type),\n data: data,\n });\n\n// # Specific Schemas\n\n// ## Integration Schemas\n\n/**\n * Data included when an integration connection is created.\n */\nexport const IntegrationCreateDataSchema = z.object({\n /**\n * The unique identifier for this integration connection.\n */\n connection_id: SnowflakeSchema,\n /**\n * The webhook secret used to verify webhook requests from Top.gg for this connection.\n */\n webhook_secret: z.string().check(z.regex(/^whs_[a-zA-Z0-9]+$/, \"Invalid webhook secret\")),\n /**\n * The project this integration is connected to.\n */\n project: BaseProjectSchema,\n /**\n * The user who created this integration connection.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is created.\n * This will be sent if a user clicks \"Connect\" for your integration on the dashboard.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#2-topgg-sends-integrationcreate\n */\nexport const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.create\",\n IntegrationCreateDataSchema\n);\n\n/**\n * The response you must return from your webhook endpoint when you receive an `integration.create` event.\n * This tells Top.gg where to deliver webhook events for this integration connection and which events to deliver.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#3-respond-with-configuration\n */\nexport const IntegrationCreateResponseSchema = z.object({\n /**\n * The URL where Top.gg should deliver webhook events for this connection.\n */\n webhook_url: z.url(),\n /**\n * An array of webhook scopes to subscribe to.\n *\n * @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes\n */\n routes: z\n .array(IntegrationSupportedWebhookScopesSchema)\n .check(\n z.refine(\n (arr) => arr.length === new Set(arr).size,\n \"Duplicate webhook scopes are not allowed\"\n )\n ),\n});\n\n/**\n * Data included when an integration connection is deleted.\n */\nexport const IntegrationDeleteDataSchema = z.object({\n /**\n * The unique identifier for the integration connection that was deleted.\n */\n connection_id: SnowflakeSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is deleted.\n */\nexport const IntegrationDeleteWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.delete\",\n IntegrationDeleteDataSchema\n);\n\n// ## Vote Schemas\n\n/**\n * Data included when a vote is created.\n */\nexport const VoteCreateDataSchema = z.extend(VoteSchema, {\n /**\n * The project that was voted for.\n */\n project: BaseProjectSchema,\n /**\n * The user who voted.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when a user votes for your project and you have subscribed to the `vote.create` event.\n */\nexport const VoteCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"vote.create\",\n VoteCreateDataSchema\n);\n\n// ## Webhook Test Schema\n\n/**\n * Data included in a webhook test event.\n */\nexport const WebhookTestDataSchema = z.object({\n /**\n * A test user.\n */\n user: UserSchema,\n /**\n * A test project.\n */\n project: BaseProjectSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when you send a test webhook from the dashboard or via the API.\n */\nexport const WebhookTestWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"webhook.test\",\n WebhookTestDataSchema\n);\n\n// ## Webhook\n\nexport const WebhookPayloadSchema = z.discriminatedUnion(\"type\", [\n IntegrationCreateWebhookPayloadSchema,\n IntegrationDeleteWebhookPayloadSchema,\n VoteCreateWebhookPayloadSchema,\n WebhookTestWebhookPayloadSchema,\n]);\n\n// ## Project Schemas\n\n/**\n * Response schema for getting the authenticated project.\n *\n * - GET `/v1/projects/@me`\n *\n * @see https://docs.top.gg/docs/API/v1/projects#get-current-project\n */\nexport const GetProjectResponseSchema = z.extend(BaseProjectSchema, {\n /**\n * The project's name.\n */\n name: z.string(),\n /**\n * The project's headline/tagline.\n */\n headline: z.string(),\n /**\n * Tags associated with the project.\n */\n tags: z.array(z.string()),\n /**\n * The number of votes this month.\n */\n votes: z.number(),\n /**\n * The total number of votes all time.\n */\n votes_total: z.number(),\n /**\n * The average review score.\n */\n review_score: z.number(),\n /**\n * The number of reviews.\n */\n review_count: z.number(),\n});\n\n/**\n * Query parameters for getting project votes.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * Either `cursor` or `startDate` must be provided.\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesQuerySchema = z\n .object({\n /**\n * Pagination cursor for fetching the next page of votes. if provided, `startDate` is ignored.\n *\n * From the previous response.\n */\n cursor: z.optional(z.string()),\n /**\n * The start date for fetching votes. Only votes created after this date will be returned. Required if `cursor` is not provided.\n *\n * Maximum 1 year in the past.\n *\n * ISO 8601 date string.\n */\n startDate: z.optional(ISO8601DateSchema),\n })\n .check(\n z.refine((data) => data.cursor || data.startDate, \"Either cursor or startDate must be provided\")\n );\n\n/**\n * Response schema for the Get Project Votes endpoint.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesResponseSchema = z.object({\n /**\n * Cursor for fetching the next page of votes.\n */\n cursor: z.string(),\n /**\n * An array of votes for the project.\n */\n data: z.array(ProjectVoteSchema),\n});\n\n/**\n * Query parameters for getting vote status by user.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserQuerySchema = z.object({\n /**\n * The source of the user ID. Defaults to \"topgg\".\n */\n source: z.optional(UserSourceSchema),\n});\n\n/**\n * Response schema for the Get Vote Status By User endpoint.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserResponseSchema = z.object({\n /**\n * The timestamp of when the user last voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the user's vote expires (i.e., when they can vote again).\n */\n expires_at: ISO8601DateSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n});\n"],"mappings":";;;;;;;;;AAaA,MAAa,yBAAyB,E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;CAIZ,YAAY;CAIZ,QAAQ,EAAE,QAAQ;CACnB,CAAC"}
|
|
1
|
+
{"version":3,"file":"validators.js","names":[],"sources":["../../src/v1/validators.ts"],"sourcesContent":["import * as z from \"zod/mini\";\nimport { ISO8601DateSchema, SnowflakeSchema } from \"@utils/validators\";\nexport * from \"@utils/validators\";\n\n// # General and Base Schemas\n\n// ## Enums and Constants\n\n/**\n * The type of a webhook event. This is used to identify the type of the event that is being delivered to your webhook endpoint.\n *\n * Not all webhook events are allowed to be set by an integration - use the `IntegrationSupportedWebhookScopesSchema` to find out which events you can subscribe to as an integration.\n */\nexport const IntegrationWebhookEventTypeSchema = z.enum([\n \"integration.create\",\n \"integration.delete\",\n]);\n\n/**\n * The type of a project helps top.gg synchronize features.\n * For example, a discord bot may have a support server, but this would not make any sense for a discord server.\n *\n * You can use this to further find out the specificity of the project.\n */\nexport const ProjectTypeSchema = z.enum([\"bot\", \"server\", \"game\"]);\n\n/**\n * A Platform is used to identify where the corresponding ID links towards.\n */\nexport const ProjectPlatformTypeSchema = z.enum([\"discord\", \"roblox\"]);\n\n/**\n * A User Source is an enum that represents a user account from an external platform that is linked to a Top.gg user account.\n * Each source has a unique identifer type that we might validate against.\n *\n * If none is passed to any endpoint that accepts a source parameter, it will default to topgg.\n */\nexport const UserSourceSchema = z.enum([\"discord\", \"topgg\"]);\n\n/**\n * Webhook scopes that are supported for integrations.\n */\nexport const WebhookEventTypeSchema = z.enum([\"webhook.test\", \"vote.create\"]);\n\nexport const WebhookEventTypesSchema = z.union([\n WebhookEventTypeSchema,\n IntegrationWebhookEventTypeSchema,\n]);\n\n/**\n * All error responses follow the [`application/problem+json`](https://datatracker.ietf.org/doc/html/rfc7807) specification.\n */\nexport const ErrorSchema = z.object({\n type: z.string(),\n title: z.string(),\n status: z.number(),\n detail: z.string(),\n});\n\n/**\n * Represents a user on Top.gg.\n */\nexport const UserSchema = z.object({\n /**\n * The user's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The user's platform ID (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The user's username.\n */\n name: z.string(),\n /**\n * The URL of the user's avatar.\n */\n avatar_url: z.url(),\n});\n\n/**\n * Base project information shared across all project-related responses.\n */\nexport const BaseProjectSchema = z.object({\n /**\n * The project's Top.gg ID.\n */\n id: SnowflakeSchema,\n /**\n * The platform the project is on (e.g., \"discord\").\n */\n platform: ProjectPlatformTypeSchema,\n /**\n * The platform-specific ID of the project (e.g., Discord Bot ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The type of project (e.g., \"bot\").\n */\n type: ProjectTypeSchema,\n});\n\n/**\n * Represents a vote on Top.gg.\n */\nexport const VoteSchema = z.object({\n /**\n * The Top.gg ID of the user who voted.\n */\n user_id: SnowflakeSchema,\n /**\n * The user's ID on the project's platform (e.g., Discord ID).\n */\n platform_id: SnowflakeSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n /**\n * The timestamp of when the user voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the vote expires (i.e., when the user can vote again).\n * This is typically 12 hours after the `created_at` timestamp, but may vary based on the user's voting history and other factors.\n */\n expires_at: ISO8601DateSchema,\n});\n\n/**\n * Represents a vote for a specific project.\n */\nexport const ProjectVoteSchema = z.clone(VoteSchema);\n\nexport const WebhookPayloadBaseSchema = <\n T extends z.infer<typeof WebhookEventTypesSchema>,\n Data extends z.ZodMiniObject,\n>(\n type: T,\n data: Data\n) =>\n z.object({\n type: z.literal(type),\n data: data,\n });\n\n// # Specific Schemas\n\n// ## Integration Schemas\n\n/**\n * Data included when an integration connection is created.\n */\nexport const IntegrationCreateDataSchema = z.object({\n /**\n * The unique identifier for this integration connection.\n */\n connection_id: SnowflakeSchema,\n /**\n * The webhook secret used to verify webhook requests from Top.gg for this connection.\n */\n webhook_secret: z.string().check(z.regex(/^whs_[a-zA-Z0-9]+$/, \"Invalid webhook secret\")),\n /**\n * The project this integration is connected to.\n */\n project: BaseProjectSchema,\n /**\n * The user who created this integration connection.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is created.\n * This will be sent if a user clicks \"Connect\" for your integration on the dashboard.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#2-topgg-sends-integrationcreate\n */\nexport const IntegrationCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.create\",\n IntegrationCreateDataSchema\n);\n\n/**\n * The response you must return from your webhook endpoint when you receive an `integration.create` event.\n * This tells Top.gg where to deliver webhook events for this integration connection and which events to deliver.\n *\n * @see https://docs.top.gg/docs/API/v1/integrations#3-respond-with-configuration\n */\nexport const IntegrationCreateResponseSchema = z.object({\n /**\n * The URL where Top.gg should deliver webhook events for this connection.\n */\n webhook_url: z.url(),\n /**\n * An array of webhook scopes to subscribe to.\n *\n * @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes\n */\n routes: z\n .array(IntegrationWebhookEventTypeSchema)\n .check(\n z.refine(\n (arr) => arr.length === new Set(arr).size,\n \"Duplicate webhook scopes are not allowed\"\n )\n ),\n});\n\n/**\n * Data included when an integration connection is deleted.\n */\nexport const IntegrationDeleteDataSchema = z.object({\n /**\n * The unique identifier for the integration connection that was deleted.\n */\n connection_id: SnowflakeSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when an integration connection is deleted.\n */\nexport const IntegrationDeleteWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"integration.delete\",\n IntegrationDeleteDataSchema\n);\n\n// ## Vote Schemas\n\n/**\n * Data included when a vote is created.\n */\nexport const VoteCreateDataSchema = z.extend(VoteSchema, {\n /**\n * The project that was voted for.\n */\n project: BaseProjectSchema,\n /**\n * The user who voted.\n */\n user: UserSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when a user votes for your project and you have subscribed to the `vote.create` event.\n */\nexport const VoteCreateWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"vote.create\",\n VoteCreateDataSchema\n);\n\n// ## Webhook Test Schema\n\n/**\n * Data included in a webhook test event.\n */\nexport const WebhookTestDataSchema = z.object({\n /**\n * A test user.\n */\n user: UserSchema,\n /**\n * A test project.\n */\n project: BaseProjectSchema,\n});\n\n/**\n * The payload delivered to your webhook endpoint when you send a test webhook from the dashboard or via the API.\n */\nexport const WebhookTestWebhookPayloadSchema = WebhookPayloadBaseSchema(\n \"webhook.test\",\n WebhookTestDataSchema\n);\n\n// ## Webhook\n\nexport const WebhookPayloadSchema = z.discriminatedUnion(\"type\", [\n IntegrationCreateWebhookPayloadSchema,\n IntegrationDeleteWebhookPayloadSchema,\n VoteCreateWebhookPayloadSchema,\n WebhookTestWebhookPayloadSchema,\n]);\n\n// ## Project Schemas\n\n/**\n * Response schema for getting the authenticated project.\n *\n * - GET `/v1/projects/@me`\n *\n * @see https://docs.top.gg/docs/API/v1/projects#get-current-project\n */\nexport const GetProjectResponseSchema = z.extend(BaseProjectSchema, {\n /**\n * The project's name.\n */\n name: z.string(),\n /**\n * The project's headline/tagline.\n */\n headline: z.string(),\n /**\n * Tags associated with the project.\n */\n tags: z.array(z.string()),\n /**\n * The number of votes this month.\n */\n votes: z.number(),\n /**\n * The total number of votes all time.\n */\n votes_total: z.number(),\n /**\n * The average review score.\n */\n review_score: z.number(),\n /**\n * The number of reviews.\n */\n review_count: z.number(),\n});\n\n/**\n * Query parameters for getting project votes.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * Either `cursor` or `startDate` must be provided.\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesQuerySchema = z\n .object({\n /**\n * Pagination cursor for fetching the next page of votes. if provided, `startDate` is ignored.\n *\n * From the previous response.\n */\n cursor: z.optional(z.string()),\n /**\n * The start date for fetching votes. Only votes created after this date will be returned. Required if `cursor` is not provided.\n *\n * Maximum 1 year in the past.\n *\n * ISO 8601 date string.\n */\n startDate: z.optional(ISO8601DateSchema),\n })\n .check(\n z.refine((data) => data.cursor || data.startDate, \"Either cursor or startDate must be provided\")\n );\n\n/**\n * Response schema for the Get Project Votes endpoint.\n *\n * - GET `/v1/projects/@me/votes`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-votes\n */\nexport const GetProjectVotesResponseSchema = z.object({\n /**\n * Cursor for fetching the next page of votes.\n */\n cursor: z.string(),\n /**\n * An array of votes for the project.\n */\n data: z.array(ProjectVoteSchema),\n});\n\n/**\n * Query parameters for getting vote status by user.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserQuerySchema = z.object({\n /**\n * The source of the user ID. Defaults to \"topgg\".\n */\n source: z.optional(UserSourceSchema),\n});\n\n/**\n * Response schema for the Get Vote Status By User endpoint.\n *\n * - GET `/v1/projects/@me/votes/:user_id`\n *\n * @see https://docs.top.gg/docs/API/v1/projects/#get-vote-status-by-user\n */\nexport const GetVoteStatusByUserResponseSchema = z.object({\n /**\n * The timestamp of when the user last voted.\n */\n created_at: ISO8601DateSchema,\n /**\n * The timestamp of when the user's vote expires (i.e., when they can vote again).\n */\n expires_at: ISO8601DateSchema,\n /**\n * The amount of votes this vote counted for.\n */\n weight: z.number(),\n});\n"],"mappings":";;;;;;;;;AAaA,MAAa,oCAAoC,EAAE,KAAK,CACtD,sBACA,qBACD,CAAC;;;;;;;AAQF,MAAa,oBAAoB,EAAE,KAAK;CAAC;CAAO;CAAU;CAAO,CAAC;;;;AAKlE,MAAa,4BAA4B,EAAE,KAAK,CAAC,WAAW,SAAS,CAAC;;;;;;;AAQtE,MAAa,mBAAmB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;;;;AAK5D,MAAa,yBAAyB,EAAE,KAAK,CAAC,gBAAgB,cAAc,CAAC;AAE7E,MAAa,0BAA0B,EAAE,MAAM,CAC7C,wBACA,kCACD,CAAC;;;;AAKF,MAAa,cAAc,EAAE,OAAO;CAClC,MAAM,EAAE,QAAQ;CAChB,OAAO,EAAE,QAAQ;CACjB,QA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AAKF,MAAa,kCAAkC,yBAC7C,gBACA,sBACD;AAID,MAAa,uBAAuB,EAAE,mBAAmB,QAAQ;CAC/D;CACA;CACA;CACA;CACD,CAAC;;;;;;;;AAWF,MAAa,2BAA2B,EAAE,OAAO,mBAAmB;CAIlE,MAAM,EAAE,QAAQ;CAIhB,UAAU,EAAE,QAAQ;CAIpB,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;CAIzB,OAAO,EAAE,QAAQ;CAIjB,aAAa,EAAE,QAAQ;CAIvB,cAAc,EAAE,QAAQ;CAIxB,cAAc,EAAE,QAAQ;CACzB,CAAC;;;;;;;;;;AAWF,MAAa,6BAA6B,EACvC,OAAO;CAMN,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC;CAQ9B,WAAW,EAAE,SAAS,kBAAkB;CACzC,CAAC,CACD,MACC,EAAE,QAAQ,SAAS,KAAK,UAAU,KAAK,WAAW,8CAA8C,CACjG;;;;;;;;AASH,MAAa,gCAAgC,EAAE,OAAO;CAIpD,QAAQ,EAAE,QAAQ;CAIlB,MAAM,EAAE,MAAM,kBAAkB;CACjC,CAAC;;;;;;;;AASF,MAAa,iCAAiC,EAAE,OAAO,EAIrD,QAAQ,EAAE,SAAS,iBAAiB,EACrC,CAAC;;;;;;;;AASF,MAAa,oCAAoC,EAAE,OAAO;CAIxD,YAAY;CAIZ,YAAY;CAIZ,QAAQ,EAAE,QAAQ;CACnB,CAAC"}
|
package/dist/v1.d.cts
CHANGED
|
@@ -166,7 +166,7 @@ interface IntegrationCreateResponse {
|
|
|
166
166
|
*
|
|
167
167
|
* @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes
|
|
168
168
|
*/
|
|
169
|
-
routes:
|
|
169
|
+
routes: WebhookEventType[];
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Data included when an integration connection is deleted.
|
package/dist/v1.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ interface IntegrationCreateResponse {
|
|
|
166
166
|
*
|
|
167
167
|
* @see https://docs.top.gg/docs/API/v1/webhooks#supported-scopes
|
|
168
168
|
*/
|
|
169
|
-
routes:
|
|
169
|
+
routes: WebhookEventType[];
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
172
172
|
* Data included when an integration connection is deleted.
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"url": "https://github.com/The-LukeZ"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
|
-
"version": "0.0
|
|
9
|
+
"version": "0.1.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"description": "Top.gg API types and validators for TypeScript",
|
|
12
12
|
"repository": {
|
|
@@ -56,6 +56,9 @@
|
|
|
56
56
|
"zod": "^4.3.6"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
|
+
"v:minor": "pnpm version minor -m \"Bump version to %s\"",
|
|
60
|
+
"v:patch": "pnpm version patch -m \"Bump version to %s\"",
|
|
61
|
+
"v:major": "pnpm version major -m \"Bump version to %s\"",
|
|
59
62
|
"build": "tsdown",
|
|
60
63
|
"dev": "tsdown --watch",
|
|
61
64
|
"format": "prettier --write .",
|