add collection refs and sync methods to frontend types and adapters
This commit is contained in:
parent
4a89f43d05
commit
48121612fc
6 changed files with 94 additions and 1 deletions
|
|
@ -244,7 +244,8 @@ export class ArtifactAdapter extends BaseAdapter {
|
||||||
skill1: input.skill1,
|
skill1: input.skill1,
|
||||||
skill2: input.skill2,
|
skill2: input.skill2,
|
||||||
skill3: input.skill3,
|
skill3: input.skill3,
|
||||||
skill4: input.skill4
|
skill4: input.skill4,
|
||||||
|
collectionArtifactId: input.collectionArtifactId
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -272,6 +273,16 @@ export class ArtifactAdapter extends BaseAdapter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syncs a grid artifact from its linked collection source
|
||||||
|
*/
|
||||||
|
async syncGridArtifact(id: string): Promise<GridArtifact> {
|
||||||
|
const response = await this.request<{ gridArtifact: GridArtifact }>(`/grid_artifacts/${id}/sync`, {
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
return response.gridArtifact
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equips a collection artifact onto a character
|
* Equips a collection artifact onto a character
|
||||||
* This creates a reference to the collection artifact on the grid character
|
* This creates a reference to the collection artifact on the grid character
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ export interface CreateGridWeaponParams {
|
||||||
mainhand?: boolean | undefined
|
mainhand?: boolean | undefined
|
||||||
uncapLevel?: number | undefined
|
uncapLevel?: number | undefined
|
||||||
transcendenceStep?: number | undefined
|
transcendenceStep?: number | undefined
|
||||||
|
/** Optional reference to source collection weapon for syncing */
|
||||||
|
collectionWeaponId?: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateGridCharacterParams {
|
export interface CreateGridCharacterParams {
|
||||||
|
|
@ -37,6 +39,8 @@ export interface CreateGridCharacterParams {
|
||||||
position: number
|
position: number
|
||||||
uncapLevel?: number | undefined
|
uncapLevel?: number | undefined
|
||||||
transcendenceStep?: number | undefined
|
transcendenceStep?: number | undefined
|
||||||
|
/** Optional reference to source collection character for syncing */
|
||||||
|
collectionCharacterId?: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CreateGridSummonParams {
|
export interface CreateGridSummonParams {
|
||||||
|
|
@ -48,6 +52,8 @@ export interface CreateGridSummonParams {
|
||||||
quickSummon?: boolean | undefined
|
quickSummon?: boolean | undefined
|
||||||
uncapLevel?: number | undefined
|
uncapLevel?: number | undefined
|
||||||
transcendenceStep?: number | undefined
|
transcendenceStep?: number | undefined
|
||||||
|
/** Optional reference to source collection summon for syncing */
|
||||||
|
collectionSummonId?: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,6 +96,19 @@ export interface ResolveConflictParams {
|
||||||
conflictingIds: string[]
|
conflictingIds: string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Response from syncing all party items
|
||||||
|
*/
|
||||||
|
export interface SyncAllPartyItemsResponse {
|
||||||
|
party: import('$lib/types/api/party').Party
|
||||||
|
synced: {
|
||||||
|
characters: number
|
||||||
|
weapons: number
|
||||||
|
summons: number
|
||||||
|
artifacts: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Character conflict response from API
|
* Character conflict response from API
|
||||||
*/
|
*/
|
||||||
|
|
@ -463,6 +482,51 @@ export class GridAdapter extends BaseAdapter {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sync operations
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syncs a grid character from its linked collection source
|
||||||
|
*/
|
||||||
|
async syncCharacter(id: string, headers?: Record<string, string>): Promise<GridCharacter> {
|
||||||
|
const response = await this.request<{ gridCharacter: GridCharacter }>(`/grid_characters/${id}/sync`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers
|
||||||
|
})
|
||||||
|
return response.gridCharacter
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syncs a grid weapon from its linked collection source
|
||||||
|
*/
|
||||||
|
async syncWeapon(id: string, headers?: Record<string, string>): Promise<GridWeapon> {
|
||||||
|
const response = await this.request<{ gridWeapon: GridWeapon }>(`/grid_weapons/${id}/sync`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers
|
||||||
|
})
|
||||||
|
return response.gridWeapon
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syncs a grid summon from its linked collection source
|
||||||
|
*/
|
||||||
|
async syncSummon(id: string, headers?: Record<string, string>): Promise<GridSummon> {
|
||||||
|
const response = await this.request<{ gridSummon: GridSummon }>(`/grid_summons/${id}/sync`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers
|
||||||
|
})
|
||||||
|
return response.gridSummon
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Syncs all linked items in a party from their collection sources
|
||||||
|
*/
|
||||||
|
async syncAllPartyItems(partyId: string, headers?: Record<string, string>): Promise<SyncAllPartyItemsResponse> {
|
||||||
|
return this.request<SyncAllPartyItemsResponse>(`/parties/${partyId}/sync_all`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears grid-specific cache
|
* Clears grid-specific cache
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
4
src/lib/types/GridCharacter.d.ts
vendored
4
src/lib/types/GridCharacter.d.ts
vendored
|
|
@ -11,4 +11,8 @@ export interface GridCharacter {
|
||||||
type: Awakening
|
type: Awakening
|
||||||
level: number
|
level: number
|
||||||
}
|
}
|
||||||
|
/** Reference to the source collection character if linked */
|
||||||
|
collectionCharacterId?: string
|
||||||
|
/** Whether the grid item is out of sync with its collection source */
|
||||||
|
outOfSync?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
src/lib/types/GridSummon.d.ts
vendored
4
src/lib/types/GridSummon.d.ts
vendored
|
|
@ -7,4 +7,8 @@ export interface GridSummon {
|
||||||
uncap_level: number
|
uncap_level: number
|
||||||
quick_summon: boolean
|
quick_summon: boolean
|
||||||
transcendence_step: number
|
transcendence_step: number
|
||||||
|
/** Reference to the source collection summon if linked */
|
||||||
|
collectionSummonId?: string
|
||||||
|
/** Whether the grid item is out of sync with its collection source */
|
||||||
|
outOfSync?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
src/lib/types/GridWeapon.d.ts
vendored
4
src/lib/types/GridWeapon.d.ts
vendored
|
|
@ -12,4 +12,8 @@ export interface GridWeapon {
|
||||||
type: Awakening
|
type: Awakening
|
||||||
level: number
|
level: number
|
||||||
}
|
}
|
||||||
|
/** Reference to the source collection weapon if linked */
|
||||||
|
collectionWeaponId?: string
|
||||||
|
/** Whether the grid item is out of sync with its collection source */
|
||||||
|
outOfSync?: boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,10 @@ export interface GridArtifact {
|
||||||
grade: ArtifactGrade
|
grade: ArtifactGrade
|
||||||
/** Reference to the base artifact */
|
/** Reference to the base artifact */
|
||||||
artifact: Artifact
|
artifact: Artifact
|
||||||
|
/** Reference to the source collection artifact if linked */
|
||||||
|
collectionArtifactId?: string
|
||||||
|
/** Whether the grid item is out of sync with its collection source */
|
||||||
|
outOfSync?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|
@ -224,6 +228,8 @@ export interface GridArtifactInput {
|
||||||
skill2?: ArtifactSkillInstance
|
skill2?: ArtifactSkillInstance
|
||||||
skill3?: ArtifactSkillInstance
|
skill3?: ArtifactSkillInstance
|
||||||
skill4?: ArtifactSkillInstance
|
skill4?: ArtifactSkillInstance
|
||||||
|
/** Optional reference to source collection artifact for syncing */
|
||||||
|
collectionArtifactId?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue