private function get()
{
// Ensure we have a valid ID.
$apple_id = get_post_meta($this->id, 'apple_news_api_id', true);
if (empty($apple_id)) {
throw new \Apple_Actions\Action_Exception(__('This post does not have a valid Apple News ID, so it cannot be retrieved from the API.', 'apple-news'));
}
// Get the article from the API
$result = $this->get_api()->get_article($apple_id);
if (empty($result->data->revision)) {
throw new \Apple_Actions\Action_Exception(__('The API returned invalid data for this article since the revision is empty.', 'apple-news'));
}
// Update the revision
update_post_meta($this->id, 'apple_news_api_revision', sanitize_text_field($result->data->revision));
}