import { AsyncSource } from './async-source' ; import { AvatarSource } from './avatar-source.enum' ; /**
 *  Google source implementation.
 *  Fetch avatar source based on google identifier
 *  and image size
 */ export class Google extends AsyncSource { readonly sourceType : AvatarSource = AvatarSource . GOOGLE ; constructor ( sourceId ) { super ( sourceId ) ; } public getAvatar ( ) { return `https://picasaweb.google.com/data/entry/api/user/${ this . sourceId }?alt=json` ; } /**
     * Extract google avatar from json data
     */ public processResponse ( data , size ? ) { const avatarSrc = data . entry . gphoto$thumbnail . $t ; if ( avatarSrc ) { return avatarSrc . replace ( 's64' , 's' + size ) ; } return null ; } }