Пример #1
0
 /**
  * Get the submission status of an Instant Article.
  *
  * @param string|null $submissionStatusID the submission status ID
  * @return InstantArticleStatus
  */
 public function getSubmissionStatus($submissionStatusID)
 {
     if (!$submissionStatusID) {
         return InstantArticleStatus::notFound();
     }
     Type::enforce($submissionStatusID, Type::STRING);
     $response = $this->facebook->get($submissionStatusID . '?fields=status,errors');
     $articleStatus = $response->getGraphNode();
     $messages = [];
     $errors = $articleStatus->getField('errors');
     if (null !== $errors) {
         foreach ($errors as $error) {
             $messages[] = ServerMessage::fromLevel($error['level'], $error['message']);
         }
     }
     return InstantArticleStatus::fromStatus($articleStatus->getField('status'), $messages);
 }
 /**
  * Get the last submission status of an Instant Article.
  *
  * @param string|null $articleID the article ID
  * @return InstantArticleStatus
  */
 public function getLastSubmissionStatus($articleID)
 {
     if (!$articleID) {
         return InstantArticleStatus::notFound();
     }
     Type::enforce($articleID, Type::STRING);
     // Get the latest import status of this article
     $response = $this->facebook->get($articleID . '?fields=most_recent_import_status');
     $articleStatus = $response->getGraphNode()->getField('most_recent_import_status');
     $messages = array();
     if (isset($articleStatus['errors'])) {
         foreach ($articleStatus['errors'] as $error) {
             $messages[] = ServerMessage::fromLevel($error['level'], $error['message']);
         }
     }
     return InstantArticleStatus::fromStatus($articleStatus['status'], $messages);
 }