{"version":3,"sources":["../../src/guild/premium.ts","../../src/apiInformation.ts","../../src/apikey.ts"],"sourcesContent":["import axios, { HttpStatusCode } from \"axios\";\r\nimport { apiBaseUrl, apiVersion } from \"../apiInformation\";\r\nimport { guildApiKey } from \"../apikey\";\r\nimport type { GuildUpdateUserResponse } from \"../types\";\r\n\r\n/**\r\n * Send's an API request to Bloxlink to update the user in the provided Discord server\r\n *\r\n * @method `POST`\r\n * @premium **This is a premium endpoint!** You must have API Premium or be using an guild API key with Server Premium!\r\n *\r\n * @param {string} discordGuildId The ID of the Discord guild\r\n * @param {string} discordUserId The ID of the Discord user you want to update\r\n * @param {string?} apiKey Optional API key to specifically use (see {@link [apikey#setGuildApiKey](../apiKey.ts)} to set an API key across all of your request)\r\n * @returns {GuildUpdateUserResponse}\r\n */\r\nexport const UpdateUser = async (\r\n  discordGuildId: string,\r\n  discordUserId: string,\r\n  apiKey?: string\r\n): Promise<GuildUpdateUserResponse> => {\r\n  try {\r\n    const response = await axios<Omit<GuildUpdateUserResponse, \"statusCode\">>({\r\n      method: \"POST\",\r\n      url: `${apiBaseUrl}/${apiVersion}/public/guilds/${discordGuildId}/update-user/${discordUserId}`,\r\n      headers: {\r\n        Authorization: apiKey || guildApiKey,\r\n      },\r\n      validateStatus: (status) => status === HttpStatusCode.Ok,\r\n    });\r\n\r\n    return {\r\n      ...response.data,\r\n      statusCode: response.status,\r\n    };\r\n  } catch (error) {\r\n    throw new Error(`[BLOXLINK API] ${error.response.data.error}`);\r\n  }\r\n};\r\n","export const apiBaseUrl = \"https://api.blox.link\";\r\nexport const apiVersion = \"v4\";\r\n","export let globalApiKey = \"\";\r\n\r\n/**\r\n * Set's the default API key for global API requests\r\n *\r\n * @param {string} newKey\r\n * @returns {void}\r\n */\r\nexport const setGlobalApiKey = (newKey: string) => (globalApiKey = newKey);\r\n\r\nexport let guildApiKey = \"\";\r\n\r\n/**\r\n * Set's the default API key for guild API requests\r\n *\r\n * @param {string} newKey\r\n * @returns {void}\r\n */\r\nexport const setGuildApiKey = (newKey: string) => (guildApiKey = newKey);\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsC;;;ACA/B,IAAM,aAAa;AACnB,IAAM,aAAa;;;ACSnB,IAAI,cAAc;;;AFMlB,IAAM,aAAa,OACxB,gBACA,eACA,WACqC;AACrC,MAAI;AACF,UAAM,WAAW,UAAM,aAAAA,SAAmD;AAAA,MACxE,QAAQ;AAAA,MACR,KAAK,GAAG,UAAU,IAAI,UAAU,kBAAkB,cAAc,gBAAgB,aAAa;AAAA,MAC7F,SAAS;AAAA,QACP,eAAe,UAAU;AAAA,MAC3B;AAAA,MACA,gBAAgB,CAAC,WAAW,WAAW,4BAAe;AAAA,IACxD,CAAC;AAED,WAAO;AAAA,MACL,GAAG,SAAS;AAAA,MACZ,YAAY,SAAS;AAAA,IACvB;AAAA,EACF,SAAS,OAAO;AACd,UAAM,IAAI,MAAM,kBAAkB,MAAM,SAAS,KAAK,KAAK,EAAE;AAAA,EAC/D;AACF;","names":["axios"]}