import Serde from './Serde' ; export class AcceptTokenRequest { token : string ; constructor ( token ) { this . token = token ; } } export class AcceptTokenRequestSerde implements Serde < AcceptTokenRequest > { static instance : AcceptTokenRequestSerde = new AcceptTokenRequestSerde ( ) ; serialize ( obj ) { return { token : obj . token } ; } deserialize ( data ) { if ( ! data . token ) { throw new Error ( 'Cannot deserialize token request. Token is missing.' ) ; } return new AcceptTokenRequest ( data . token ) ; } }