import { IUserProfileResponse , IUserProfileResult } from '../types/user-profile-page' ; import { HTTP , buildURL , NETWORK_BAN_MESSAGE } from '../utils' ; example export const getMediaByUsername = async ( username ) : Promise < IUserProfileResult > => { const result = { profile : null , } ; const url = buildURL ( `${ username }/` ) ; const response = await HTTP < IUserProfileResponse > ( url ) ; const content = response ?. entry_data ?. ProfilePage ; if ( content ) { const { user = null } = { ... content ?. [ 0 ] ?. graphql } ; result . profile = user ; } else { throw new Error ( NETWORK_BAN_MESSAGE ) ; } return result ; } ; export default getMediaByUsername ;