Rename code parameter to templateCode to reduce ambiguity

This commit is contained in:
ayntee
2020-11-14 00:41:25 +04:00
parent 1f2c5853de
commit dd60de628c
+15 -34
View File
@@ -623,26 +623,21 @@ export function getGuild(guildID: string, counts = true) {
) as Promise<UpdateGuildPayload>; ) as Promise<UpdateGuildPayload>;
} }
/** /** Returns the guild template if it exists */
* Returns the guild template if it exists export function getGuildTemplate(guildID: string, templateCode: string) {
* @param guildID The ID of the guild const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`;
* @param code The code of the template to get
*/
export function getGuildTemplate(guildID: string, code: string) {
const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${code}`;
return RequestManager.get(endpoint); return RequestManager.get(endpoint);
} }
/** /**
* Create a new guild based on a template * Create a new guild based on a template
* NOTE: This endpoint can be used only by bots in less than 10 guilds. * NOTE: This endpoint can be used only by bots in less than 10 guilds.
* @param code The code of the template to create a guild from
*/ */
export function createGuildFromTemplate( export function createGuildFromTemplate(
code: string, templateCode: string,
data: CreateGuildFromTemplate, data: CreateGuildFromTemplate,
) { ) {
return RequestManager.post(endpoints.GUILD_TEMPLATE(code), data); return RequestManager.post(endpoints.GUILD_TEMPLATE(templateCode), data);
} }
export interface CreateGuildFromTemplate { export interface CreateGuildFromTemplate {
@@ -652,20 +647,14 @@ export interface CreateGuildFromTemplate {
icon?: string; icon?: string;
} }
/** /** Returns an array of guild templates */
* Returns an array of guild templates
* @param guildID The ID of the guild
*/
export function getGuildTemplates(guildID: string) { export function getGuildTemplates(guildID: string) {
return RequestManager.get(endpoints.GUILD_TEMPLATES(guildID)); return RequestManager.get(endpoints.GUILD_TEMPLATES(guildID));
} }
/** /** Deletes a template from a guild */
* Deletes a template from a guild export function deleteGuildTemplate(guildID: string, templateCode: string) {
* @param guildID The guild ID to delete the template from const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`;
*/
export function deleteGuildTemplate(guildID: string, code: string) {
const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${code}`;
return RequestManager.delete(endpoint); return RequestManager.delete(endpoint);
} }
@@ -689,27 +678,19 @@ export interface CreateGuildTemplate {
description?: string | null; description?: string | null;
} }
/** /** Syncs the template to the guild's current state */
* Syncs the template to the guild's current state export function syncGuildTemplate(guildID: string, templateCode: string) {
* @param guildID The ID of the guild const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`;
* @param code The code of the template to sync
*/
export function syncGuildTemplate(guildID: string, code: string) {
const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${code}`;
return RequestManager.put(endpoint); return RequestManager.put(endpoint);
} }
/** /** Edit a template's metadata */
* Edit a template's metadata
* @param guildID The ID of the guild
* @param code The code of the template to edit
*/
export function editGuildTemplate( export function editGuildTemplate(
guildID: string, guildID: string,
code: string, templateCode: string,
data: EditGuildTemplate, data: EditGuildTemplate,
) { ) {
const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${code}`; const endpoint = `${endpoints.GUILD_TEMPLATES(guildID)}/${templateCode}`;
return RequestManager.patch(endpoint, data); return RequestManager.patch(endpoint, data);
} }