All files / src/client/hoyolab hoyolab.interface.ts

100% Statements 116/116
100% Branches 1/1
100% Functions 0/0
100% Lines 116/116

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 11731x 31x 31x 31x 31x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
export enum GamesEnum {
  GENSHIN_IMPACT = 'hk4e_global',
  HONKAI_IMPACT = 'bh3_global',
  HONKAI_STAR_RAIL = 'hkrpg_global',
}
 
import { ICookie } from '../../cookie'
import { LanguageEnum } from '../../language'
 
/**
 * Represents the options for accessing the Hoyolab API.
 *
 * @interface
 */
export interface IHoyolabOptions {
  /**
   * The cookie used to authenticate the request. This can be either a string or an {@link ICookie} object.
   */
  cookie:
    | Pick<ICookie, 'ltoken' | 'ltuid' | 'cookieToken' | 'cookieTokenV2'>
    | string
 
  /**
   * The language to use for the request. This should be a value of {@link LanguageEnum}.
   */
  lang?: LanguageEnum
}
 
/**
 * Represents a game linked to a Hoyolab account.
 *
 * @interface
 */
export interface IGame {
  /**
   * The game's business type.
   */
  game_biz: string
 
  /**
   * The game's server region.
   */
  region: string
 
  /**
   * The game's unique ID.
   */
  game_uid: string
 
  /**
   * The game's nickname.
   */
  nickname: string
 
  /**
   * The game's level.
   */
  level: number
 
  /**
   * Whether the game is currently chosen as the active game.
   */
  is_chosen: boolean
 
  /**
   * The name of the game's region.
   */
  region_name: string
 
  /**
   * Whether the game is an official miHoYo game.
   */
  is_official: boolean
}
 
/**
 * Represents a list of games linked to a Hoyolab account.
 *
 * @interface
 */
export interface IGamesList {
  /**
   * The list of games linked to the account. This should be a value of {@link IGame}.
   */
  list: IGame[]
}
 
/**
 * Interface for representing a game record card.
 *
 * @interface
 */
export interface IGameRecordCard {
  has_role: boolean
  game_id: number
  game_role_id: string
  nickname: string
  region: string
  level: number
  background_image: string
  is_public: boolean
  data: {
    name: string
    type: number
    value: string
  }[]
  region_name: string
  url: string
  data_switches: {
    switch_id: string
    is_public: boolean
    switch_name: string
  }[]
  h5_data_switches: any[]
  background_color: string
}