mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
fix: webhook typings
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import { rest } from "../../rest/rest.ts";
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import { Webhook } from "../../types/webhooks/webhook.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
/** Edit a webhook. Returns the updated webhook object on success. */
|
/** Edit a webhook. Returns the updated webhook object on success. */
|
||||||
export async function editWebhookWithToken(
|
export async function editWebhookWithToken(
|
||||||
@@ -13,5 +15,5 @@ export async function editWebhookWithToken(
|
|||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
|
|
||||||
return result as WebhookPayload;
|
return snakeKeysToCamelCase(result) as Webhook;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
import { rest } from "../../rest/rest.ts";
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import { Webhook } from "../../types/webhooks/webhook.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
/** Returns the new webhook object for the given id. */
|
/** Returns the new webhook object for the given id. */
|
||||||
export async function getWebhook(webhookId: string) {
|
export async function getWebhook(webhookId: string) {
|
||||||
const result = await rest.runMethod("get", endpoints.WEBHOOK_ID(webhookId));
|
const result = await rest.runMethod("get", endpoints.WEBHOOK_ID(webhookId));
|
||||||
|
|
||||||
return result as WebhookPayload;
|
return snakeKeysToCamelCase(result) as Webhook;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { rest } from "../../rest/rest.ts";
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import { Webhook } from "../../types/webhooks/webhook.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
|
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||||
|
|
||||||
/** Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object. */
|
/** Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object. */
|
||||||
export async function getWebhookWithToken(webhookId: string, token: string) {
|
export async function getWebhookWithToken(webhookId: string, token: string) {
|
||||||
@@ -8,5 +10,5 @@ export async function getWebhookWithToken(webhookId: string, token: string) {
|
|||||||
endpoints.WEBHOOK(webhookId, token),
|
endpoints.WEBHOOK(webhookId, token),
|
||||||
);
|
);
|
||||||
|
|
||||||
return result as WebhookPayload;
|
return snakeKeysToCamelCase(result) as Webhook;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user