{"version":3,"sources":["../src/types.ts"],"sourcesContent":["import { HttpStatusCode } from \"axios\";\r\nimport { APIGuildMember } from \"discord-api-types/v10\";\r\n\r\n// Util\r\ntype If<T extends boolean, A, B = null> = T extends true\r\n  ? A\r\n  : T extends false\r\n  ? B\r\n  : A | B;\r\n\r\n// Error related responses\r\nexport enum ResponseError {\r\n  NOT_FOUND = \"User not found\",\r\n  QUOTA_REACHED = \"You have reached your API key limit for today. Email cm@blox.link for elevated rates.\",\r\n  INVALID_KEY = \"Invalid API Key\",\r\n  GUILD_NOT_MATCHED = \"Guild ID does not match API Key\",\r\n  REQUIRES_API_PREMIUM = \"This endpoint requires API Premium or Server Premium/Pro\",\r\n}\r\n\r\nexport type FailedResponse = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  error: ResponseError;\r\n};\r\n\r\n// Roblox User Typings\r\nexport interface Headers {\r\n  name: string;\r\n  value: string;\r\n}\r\n\r\nexport interface Groups {\r\n  added: string[];\r\n  removed: string[];\r\n  nickname: string;\r\n}\r\n\r\nexport interface Badges {\r\n  imageUri: string;\r\n  name: string;\r\n}\r\n\r\nexport interface Group {\r\n  id: number;\r\n  name: string;\r\n  memberCount: number;\r\n  hasVerifiedBadge: boolean;\r\n}\r\n\r\nexport interface Role {\r\n  id: number;\r\n  name: string;\r\n  rank: number;\r\n}\r\n\r\nexport interface Groups {\r\n  group: Group;\r\n  role: Role;\r\n}\r\n\r\nexport interface GroupsV2 {\r\n  [groupId: string]: {\r\n    group: Group;\r\n    role: Role;\r\n  };\r\n}\r\n\r\nexport interface Avatar {\r\n  BustThumbnail: string;\r\n  HeadshotThumbnail: string;\r\n  FullBody: string;\r\n}\r\n\r\nexport interface EnrichedRobloxUser {\r\n  name: string;\r\n  id: number;\r\n  displayName: string;\r\n  description: string;\r\n  isBanned: boolean;\r\n  created: Date;\r\n  badges: Badges[];\r\n  profileLink: string;\r\n  presence: null;\r\n  groups: Groups[];\r\n  avatar: Avatar;\r\n  rap: null;\r\n  value: null;\r\n  placeVisits: null;\r\n  hasDisplayName: boolean;\r\n  externalAppDisplayName?: any;\r\n  hasVerifiedBadge: boolean;\r\n  groupsv2: GroupsV2;\r\n}\r\n\r\n// Success responses\r\n\r\nexport type GuildDiscordToRobloxResolved = {\r\n  roblox: EnrichedRobloxUser;\r\n  discord: APIGuildMember;\r\n};\r\n\r\nexport type GuildDiscordToRobloxResponse<Premium extends boolean = boolean> = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  robloxID: string;\r\n  resolved: If<Premium, GuildDiscordToRobloxResolved, {}>;\r\n};\r\n\r\nexport type GlobalDiscordToRobloxResolved = {\r\n  roblox: {};\r\n};\r\n\r\nexport type GlobalDiscordToRobloxResponse<Premium extends boolean = boolean> = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  robloxID: string;\r\n  resolved: If<Premium, GlobalDiscordToRobloxResolved, {}>;\r\n};\r\n\r\nexport type GuildRobloxToDiscordResolved = {\r\n  discord: {\r\n    [discordId: string]: APIGuildMember;\r\n  };\r\n};\r\n\r\nexport type GuildRobloxToDiscordResponse<Premium extends boolean = boolean> = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  discordIDs: string[];\r\n  resolved: If<Premium, GuildRobloxToDiscordResolved, {}>;\r\n};\r\n\r\nexport type GlobalRobloxToDiscordResponse = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  discordIDs: string[];\r\n};\r\n\r\nexport type GuildUpdateUserResponse = {\r\n  /**\r\n   * Not included in the Bloxlink API response data\r\n   */\r\n  statusCode: HttpStatusCode;\r\n  addedRoles: string[];\r\n  removedRoles : string[];\r\n  nickname: string;\r\n};\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAWO,IAAK,gBAAL,kBAAKA,mBAAL;AACL,EAAAA,eAAA,eAAY;AACZ,EAAAA,eAAA,mBAAgB;AAChB,EAAAA,eAAA,iBAAc;AACd,EAAAA,eAAA,uBAAoB;AACpB,EAAAA,eAAA,0BAAuB;AALb,SAAAA;AAAA,GAAA;","names":["ResponseError"]}