diff --git a/src/lib/api/adapters/artifact.adapter.ts b/src/lib/api/adapters/artifact.adapter.ts index 81d51653..b9a321b8 100644 --- a/src/lib/api/adapters/artifact.adapter.ts +++ b/src/lib/api/adapters/artifact.adapter.ts @@ -244,7 +244,8 @@ export class ArtifactAdapter extends BaseAdapter { skill1: input.skill1, skill2: input.skill2, 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 { + const response = await this.request<{ gridArtifact: GridArtifact }>(`/grid_artifacts/${id}/sync`, { + method: 'POST' + }) + return response.gridArtifact + } + /** * Equips a collection artifact onto a character * This creates a reference to the collection artifact on the grid character diff --git a/src/lib/api/adapters/grid.adapter.ts b/src/lib/api/adapters/grid.adapter.ts index c1d136bb..411bd528 100644 --- a/src/lib/api/adapters/grid.adapter.ts +++ b/src/lib/api/adapters/grid.adapter.ts @@ -29,6 +29,8 @@ export interface CreateGridWeaponParams { mainhand?: boolean | undefined uncapLevel?: number | undefined transcendenceStep?: number | undefined + /** Optional reference to source collection weapon for syncing */ + collectionWeaponId?: string | undefined } export interface CreateGridCharacterParams { @@ -37,6 +39,8 @@ export interface CreateGridCharacterParams { position: number uncapLevel?: number | undefined transcendenceStep?: number | undefined + /** Optional reference to source collection character for syncing */ + collectionCharacterId?: string | undefined } export interface CreateGridSummonParams { @@ -48,6 +52,8 @@ export interface CreateGridSummonParams { quickSummon?: boolean | undefined uncapLevel?: 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[] } +/** + * 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 */ @@ -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): Promise { + 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): Promise { + 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): Promise { + 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): Promise { + return this.request(`/parties/${partyId}/sync_all`, { + method: 'POST', + headers + }) + } + /** * Clears grid-specific cache */ diff --git a/src/lib/types/GridCharacter.d.ts b/src/lib/types/GridCharacter.d.ts index 78c3ee88..4f79144c 100644 --- a/src/lib/types/GridCharacter.d.ts +++ b/src/lib/types/GridCharacter.d.ts @@ -11,4 +11,8 @@ export interface GridCharacter { type: Awakening 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 } diff --git a/src/lib/types/GridSummon.d.ts b/src/lib/types/GridSummon.d.ts index 8c8d99a9..b0ad372a 100644 --- a/src/lib/types/GridSummon.d.ts +++ b/src/lib/types/GridSummon.d.ts @@ -7,4 +7,8 @@ export interface GridSummon { uncap_level: number quick_summon: boolean 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 } diff --git a/src/lib/types/GridWeapon.d.ts b/src/lib/types/GridWeapon.d.ts index 67a8003b..e767366f 100644 --- a/src/lib/types/GridWeapon.d.ts +++ b/src/lib/types/GridWeapon.d.ts @@ -12,4 +12,8 @@ export interface GridWeapon { type: Awakening 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 } diff --git a/src/lib/types/api/artifact.ts b/src/lib/types/api/artifact.ts index c1c354b9..3fa78f04 100644 --- a/src/lib/types/api/artifact.ts +++ b/src/lib/types/api/artifact.ts @@ -185,6 +185,10 @@ export interface GridArtifact { grade: ArtifactGrade /** Reference to the base 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 skill3?: ArtifactSkillInstance skill4?: ArtifactSkillInstance + /** Optional reference to source collection artifact for syncing */ + collectionArtifactId?: string } /**