{"version":3,"sources":["../../src/guild/index.ts","../../src/apikey.ts","../../src/guild/search.ts","../../src/apiInformation.ts","../../src/guild/premium.ts"],"sourcesContent":["import { setGuildApiKey } from \"../apikey\";\r\nimport { DiscordToRoblox, RobloxToDiscord } from \"./search\";\r\nimport { UpdateUser } from \"./premium\";\r\n\r\nexport default {\r\n  setGuildApiKey,\r\n  DiscordToRoblox,\r\n  RobloxToDiscord,\r\n  UpdateUser,\r\n};\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","import axios, { HttpStatusCode } from \"axios\";\r\nimport { apiBaseUrl, apiVersion } from \"../apiInformation\";\r\nimport { guildApiKey } from \"../apikey\";\r\nimport type {\r\n  GuildDiscordToRobloxResponse,\r\n  GuildRobloxToDiscordResponse,\r\n} from \"../types\";\r\n\r\n/**\r\n * Send's an API request to Bloxlink to get the Roblox ID of a Discord user\r\n *\r\n * @method `GET`\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 get\r\n * @param {boolean} premiumResponse If you have API Premium or be using an guild API key with Server Premium, you can set this to true to get an enriched response\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 {GuildDiscordToRobloxResponse}\r\n */\r\nexport const DiscordToRoblox = async <Premium extends boolean = boolean>(\r\n  discordGuildId: string,\r\n  discordUserId: string,\r\n  //@ts-ignore surpress as it is being used for types\r\n  premiumResponse?: Premium,\r\n  apiKey?: string\r\n): Promise<\r\n  GuildDiscordToRobloxResponse<Premium extends true ? true : false>\r\n> => {\r\n  try {\r\n    const response = await axios<\r\n      Omit<GuildDiscordToRobloxResponse, \"statusCode\">\r\n    >({\r\n      method: \"GET\",\r\n      url: `${apiBaseUrl}/${apiVersion}/public/guilds/${discordGuildId}/discord-to-roblox/${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    } as GuildDiscordToRobloxResponse<Premium extends true ? true : false>;\r\n  } catch (error) {\r\n    throw new Error(`[BLOXLINK API] ${error.response.data.error}`);\r\n  }\r\n};\r\n\r\n/**\r\n * Send's an API request to Bloxlink to get the Discord ID of a Roblox user\r\n *\r\n * @method `GET`\r\n *\r\n * @param {string} discordGuildId The ID of the Discord guild\r\n * @param {string} robloxUserId The ID of the Roblox user you want to get\r\n * @param {boolean} premiumResponse If you have API Premium or be using an guild API key with Server Premium, you can set this to true to get an enriched response\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 {GuildRobloxToDiscordResponse}\r\n */\r\nexport const RobloxToDiscord = async <Premium extends boolean = boolean>(\r\n  discordGuildId: string,\r\n  robloxUserId: string,\r\n  //@ts-ignore surpress as it is being used for types\r\n  premiumResponse?: Premium,\r\n  apiKey?: string\r\n): Promise<\r\n  GuildRobloxToDiscordResponse<Premium extends true ? true : false>\r\n> => {\r\n  try {\r\n    const response = await axios<\r\n      Omit<GuildRobloxToDiscordResponse, \"statusCode\">\r\n    >({\r\n      method: \"GET\",\r\n      url: `${apiBaseUrl}/${apiVersion}/public/guilds/${discordGuildId}/roblox-to-discord/${robloxUserId}`,\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    } as GuildRobloxToDiscordResponse<Premium extends true ? true : false>;\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","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,IAAI,cAAc;AAQlB,IAAM,iBAAiB,CAAC,WAAoB,cAAc;;;AClBjE,mBAAsC;;;ACA/B,IAAM,aAAa;AACnB,IAAM,aAAa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