import api from 'src/config/api';
import { LinkPreviewResponse } from 'src/types/previewLink';
import { formatLinkPreviewUrl } from 'src/utils/previewLink';

export const getLinkPreview = (url: string, hl: string = 'en') => {
  return api.get<LinkPreviewResponse>('link-previews', {
    params: {
      url: formatLinkPreviewUrl(url, hl),
    },
  });
};
