Add transformer for GridSummon
This commit is contained in:
parent
8ef2bf76e3
commit
fe32a49bc4
3 changed files with 36 additions and 3 deletions
26
transformers/GridSummonTransformer.tsx
Normal file
26
transformers/GridSummonTransformer.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
import * as Summon from './SummonTransformer'
|
||||||
|
|
||||||
|
// Transforms API response to GridSummon object
|
||||||
|
export function toObject(data: any): GridSummon {
|
||||||
|
return {
|
||||||
|
id: data.id,
|
||||||
|
object: Summon.toObject(data.object),
|
||||||
|
position: data.position,
|
||||||
|
main: data.main,
|
||||||
|
friend: data.friend,
|
||||||
|
uncapLevel: data.uncap_level,
|
||||||
|
transcendenceStep: data.transcendence_step,
|
||||||
|
quickSummon: data.quick_summon,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transforms User object into API parameters
|
||||||
|
export function toParams(data: GridSummon): GridSummonParams {
|
||||||
|
return {
|
||||||
|
summon_id: data.id,
|
||||||
|
position: data.position,
|
||||||
|
uncap_level: data.uncapLevel,
|
||||||
|
transcendence_step: data.transcendenceStep,
|
||||||
|
quick_summon: data.quickSummon,
|
||||||
|
}
|
||||||
|
}
|
||||||
6
types/GridSummon.d.ts
vendored
6
types/GridSummon.d.ts
vendored
|
|
@ -4,7 +4,7 @@ interface GridSummon {
|
||||||
friend: boolean
|
friend: boolean
|
||||||
position: number
|
position: number
|
||||||
object: Summon
|
object: Summon
|
||||||
uncap_level: number
|
uncapLevel: number
|
||||||
quick_summon: boolean
|
transcendenceStep: number
|
||||||
transcendence_step: number
|
quickSummon: boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
types/GridSummonParams.d.ts
vendored
Normal file
7
types/GridSummonParams.d.ts
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
interface GridSummonParams {
|
||||||
|
summon_id: string
|
||||||
|
position?: number
|
||||||
|
uncap_level?: number
|
||||||
|
transcendence_step?: number
|
||||||
|
quick_summon?: boolean
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue