import { Data } from './models' ; internal export class Api { constructor ( public data ) { } } public export function extendApi ( methods ) { const api = Api . prototype ; for ( const key in methods ) { if ( methods . hasOwnProperty ( key ) ) { if ( api [ key ] ) { throw new Error ( 'API method is already defined: ' + key ) ; } else { api [ key ] = methods [ key ] ; } } } return api ; }