entity adapter: add raw data fetch methods

This commit is contained in:
Justin Edmund 2025-12-01 09:54:39 -08:00
parent be75fcbcbd
commit 1cbcd91f94
2 changed files with 62 additions and 0 deletions

View file

@ -402,6 +402,15 @@ export interface WeaponDownloadStatus {
updatedAt?: string
}
/**
* Raw data response from /raw endpoint
*/
export interface EntityRawData {
wikiRaw: string | null
gameRawEn: Record<string, unknown> | null
gameRawJp: Record<string, unknown> | null
}
/**
* Entity adapter for accessing canonical game data
*/
@ -813,6 +822,52 @@ export class EntityAdapter extends BaseAdapter {
updatedAt: response.updated_at
}
}
// ============================================
// Raw Data Methods (for database viewing)
// ============================================
/**
* Gets raw wiki and game data for a character
* This data is fetched separately to avoid bloating regular entity responses
* Note: BaseAdapter.request() automatically transforms snake_case to camelCase
*/
async getCharacterRawData(id: string): Promise<EntityRawData> {
// Response keys are already camelCase after BaseAdapter.transformResponse()
const response = await this.request<EntityRawData>(`/characters/${id}/raw`, {
method: 'GET'
})
return response
}
/**
* Gets raw wiki and game data for a weapon
* This data is fetched separately to avoid bloating regular entity responses
* Note: BaseAdapter.request() automatically transforms snake_case to camelCase
*/
async getWeaponRawData(id: string): Promise<EntityRawData> {
// Response keys are already camelCase after BaseAdapter.transformResponse()
const response = await this.request<EntityRawData>(`/weapons/${id}/raw`, {
method: 'GET'
})
return response
}
/**
* Gets raw wiki and game data for a summon
* This data is fetched separately to avoid bloating regular entity responses
* Note: BaseAdapter.request() automatically transforms snake_case to camelCase
*/
async getSummonRawData(id: string): Promise<EntityRawData> {
// Response keys are already camelCase after BaseAdapter.transformResponse()
const response = await this.request<EntityRawData>(`/summons/${id}/raw`, {
method: 'GET'
})
return response
}
}
/**

View file

@ -105,6 +105,13 @@ export interface Summon {
}
}
// Raw data response from separate /raw endpoint
export interface EntityRawData {
wikiRaw: string | null
gameRawEn: Record<string, unknown> | null
gameRawJp: Record<string, unknown> | null
}
// Job entity from JobBlueprint
export interface Job {
id: string