add roster types and getRoster to crew adapter

This commit is contained in:
Justin Edmund 2025-12-20 04:15:15 -08:00
parent 18ab04b32d
commit 0bc00e090c
2 changed files with 46 additions and 1 deletions

View file

@ -12,7 +12,9 @@ import type {
CreatePhantomPlayerInput,
UpdatePhantomPlayerInput,
UpdateMembershipInput,
MemberFilter
MemberFilter,
RosterResponse,
RosterQuery
} from '$lib/types/api/crew'
/**
@ -63,6 +65,23 @@ export class CrewAdapter extends BaseAdapter {
return this.request<CrewMembersResponse>('/crew/members', { ...options, params })
}
/**
* Get collection roster for crew members (officers only)
* Returns ownership info for specified items across all active crew members
*/
async getRoster(query: RosterQuery, options?: RequestOptions): Promise<RosterResponse> {
const searchParams = new URLSearchParams()
query.characterIds?.forEach((id) => searchParams.append('character_ids[]', id))
query.weaponIds?.forEach((id) => searchParams.append('weapon_ids[]', id))
query.summonIds?.forEach((id) => searchParams.append('summon_ids[]', id))
const queryString = searchParams.toString()
const url = queryString ? `/crew/roster?${queryString}` : '/crew/roster'
return this.request<RosterResponse>(url, options)
}
/**
* Leave current crew (not available for captain)
*/

View file

@ -126,3 +126,29 @@ export interface UpdateMembershipInput {
retired?: boolean
retiredAt?: string
}
// Roster feature types
export interface RosterItem {
id: string
uncapLevel: number
}
export interface RosterMember {
userId: string
username: string
role: CrewRole
characters: RosterItem[]
weapons: RosterItem[]
summons: RosterItem[]
}
export interface RosterResponse {
members: RosterMember[]
}
export interface RosterQuery {
characterIds?: string[]
weaponIds?: string[]
summonIds?: string[]
}