add roster types and getRoster to crew adapter
This commit is contained in:
parent
18ab04b32d
commit
0bc00e090c
2 changed files with 46 additions and 1 deletions
|
|
@ -12,7 +12,9 @@ import type {
|
||||||
CreatePhantomPlayerInput,
|
CreatePhantomPlayerInput,
|
||||||
UpdatePhantomPlayerInput,
|
UpdatePhantomPlayerInput,
|
||||||
UpdateMembershipInput,
|
UpdateMembershipInput,
|
||||||
MemberFilter
|
MemberFilter,
|
||||||
|
RosterResponse,
|
||||||
|
RosterQuery
|
||||||
} from '$lib/types/api/crew'
|
} from '$lib/types/api/crew'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -63,6 +65,23 @@ export class CrewAdapter extends BaseAdapter {
|
||||||
return this.request<CrewMembersResponse>('/crew/members', { ...options, params })
|
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)
|
* Leave current crew (not available for captain)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -126,3 +126,29 @@ export interface UpdateMembershipInput {
|
||||||
retired?: boolean
|
retired?: boolean
|
||||||
retiredAt?: string
|
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[]
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue